diff options
| -rw-r--r-- | engines/agos/sound.cpp | 2 | ||||
| -rw-r--r-- | engines/kyra/sound_digital.cpp | 8 | ||||
| -rw-r--r-- | engines/saga/music.cpp | 6 | ||||
| -rw-r--r-- | engines/sword2/sound.cpp | 4 | ||||
| -rw-r--r-- | engines/tucker/resource.cpp | 3 | ||||
| -rw-r--r-- | engines/tucker/sequences.cpp | 3 | ||||
| -rw-r--r-- | sound/audiocd.cpp | 3 | ||||
| -rw-r--r-- | sound/mixer.cpp | 43 | ||||
| -rw-r--r-- | sound/mixer.h | 65 | 
9 files changed, 15 insertions, 122 deletions
| diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index 4481778871..77604eca75 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -788,7 +788,7 @@ void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint soun  	convertVolume(vol);  	convertPan(pan); -	_mixer->playInputStreamLooping(Audio::Mixer::kSFXSoundType, handle, sndStream, loop ? 0 : 1, -1, vol, pan); +	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, Audio::makeLoopingAudioStream(sndStream, loop ? 0 : 1), -1, vol, pan);  }  void Sound::stopSfx5() { diff --git a/engines/kyra/sound_digital.cpp b/engines/kyra/sound_digital.cpp index a6d89ba7ee..84b18ebc33 100644 --- a/engines/kyra/sound_digital.cpp +++ b/engines/kyra/sound_digital.cpp @@ -481,13 +481,7 @@ int SoundDigital::playSound(const char *filename, uint8 priority, Audio::Mixer::  	if (type == Audio::Mixer::kSpeechSoundType && _vm->heliumMode())  		use->stream->setRate(32765); -	if (loop) { -		Audio::Timestamp zero(0, 1000); -		_mixer->playInputStreamLooping(type, &use->handle, use->stream, 0, zero, zero, -1, volume); -	} else { -		_mixer->playInputStream(type, &use->handle, use->stream, -1, volume); -	} - +	_mixer->playInputStream(type, &use->handle, makeLoopingAudioStream(use->stream, loop ? 0 : 1), -1, volume);  	return use - _sounds;  } diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index de29747db5..a5c28c213e 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -279,7 +279,8 @@ void Music::play(uint32 resourceId, MusicFlags flags) {  	for (int i = 0; i < 2; ++i) {  		stream = Audio::SeekableAudioStream::openStreamFile(trackName[i]);  		if (stream) { -			_mixer->playInputStreamLooping(Audio::Mixer::kMusicSoundType, &_musicHandle, stream, (flags == MUSIC_LOOP) ? 0 : 1); +			_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, +			                        Audio::makeLoopingAudioStream(stream, (flags == MUSIC_LOOP) ? 0 : 1));  			_digitalMusic = true;  			return;  		} @@ -336,7 +337,8 @@ void Music::play(uint32 resourceId, MusicFlags flags) {  	if (audioStream) {  		debug(2, "Playing digitized music"); -		_mixer->playInputStreamLooping(Audio::Mixer::kMusicSoundType, &_musicHandle, audioStream, (flags == MUSIC_LOOP ? 0 : 1)); +		_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, +		                        Audio::makeLoopingAudioStream(audioStream, (flags == MUSIC_LOOP ? 0 : 1)));  		_digitalMusic = true;  		return;  	} diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp index 03352a2166..213f3e7c83 100644 --- a/engines/sword2/sound.cpp +++ b/engines/sword2/sound.cpp @@ -340,7 +340,9 @@ int32 Sound::playFx(Audio::SoundHandle *handle, byte *data, uint32 len, uint8 vo  	assert(input); -	_vm->_mixer->playInputStreamLooping(soundType, handle, input, loop ? 0 : 1, -1, vol, pan, true, false, isReverseStereo()); +	_vm->_mixer->playInputStream(soundType, handle, +	                             Audio::makeLoopingAudioStream(input, loop ? 0 : 1), +	                             -1, vol, pan, true, false, isReverseStereo());  	return RD_OK;  } diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index af0af41c3d..6c244d070a 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -954,7 +954,8 @@ void TuckerEngine::loadSound(Audio::Mixer::SoundType type, int num, int volume,  	if (stream) {  		_mixer->stopHandle(*handle); -		_mixer->playInputStreamLooping(type, handle, stream, loop ? 0 : 1, -1, scaleMixerVolume(volume, kMaxSoundVolume)); +		_mixer->playInputStream(type, handle, Audio::makeLoopingAudioStream(stream, loop ? 0 : 1), +		                        -1, scaleMixerVolume(volume, kMaxSoundVolume));  	}  } diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index fd51faf207..cae0f527c2 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -635,7 +635,8 @@ void AnimationSequencePlayer::updateSounds() {  			break;  		case 1:  			if ((s = loadSound(p->num, kAnimationSoundTypeWAV)) != 0) { -				_mixer->playInputStreamLooping(Audio::Mixer::kSFXSoundType, &_soundsHandle[p->index], s, 0, -1, scaleMixerVolume(p->volume)); +				_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_soundsHandle[p->index], Audio::makeLoopingAudioStream(s, 0), +				                        -1, scaleMixerVolume(p->volume));  			}  			break;  		case 2: diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp index 9869f31ac1..836f92b33d 100644 --- a/sound/audiocd.cpp +++ b/sound/audiocd.cpp @@ -78,7 +78,8 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration,  			repetitions. Finally, -1 means infinitely many  			*/  			_emulating = true; -			_mixer->playInputStreamLooping(Audio::Mixer::kMusicSoundType, &_handle, stream, (numLoops < 1) ? numLoops + 1 : numLoops, start, end); +			_mixer->playInputStream(Mixer::kMusicSoundType, &_handle, +			                        makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops));  		} else {  			_emulating = false;  			if (!only_emulate) diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 84a3949656..16a7dcf024 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -264,49 +264,6 @@ void MixerImpl::playInputStream(  	insertChannel(handle, chan);  } -void Mixer::playInputStreamLooping( -			SoundType type, -			SoundHandle *handle, -			RewindableAudioStream *input, -			uint loopCount, -			int id, byte volume, int8 balance, -			bool autofreeStream, -			bool permanent, -			bool reverseStereo) { - -	// Just in case the user wants the stream just looped once, we will take care of that with the normal -	// playInputStream method -	if (loopCount == 1) { -		playInputStream(type, handle, input, id, volume, balance, autofreeStream, permanent, reverseStereo); -		return; -	} - -	LoopingAudioStream *loopingStream = new LoopingAudioStream(input, loopCount, autofreeStream); -	assert(loopingStream); - -	playInputStream(type, handle, loopingStream, id, volume, balance, true, permanent, reverseStereo); -} - -void Mixer::playInputStreamLooping( -			SoundType type, -			SoundHandle *handle, -			SeekableAudioStream *input, -			uint loopCount, -			Timestamp loopStart, Timestamp loopEnd, -			int id, byte volume, int8 balance, -			bool autofreeStream, -			bool permanent, -			bool reverseStereo) { - -	if (loopStart >= loopEnd) -		return; - -	input = new SubSeekableAudioStream(input, loopStart, loopEnd, autofreeStream); -	assert(input); - -	playInputStreamLooping(type, handle, input, loopCount, id, volume, balance, true, permanent, reverseStereo); -} -  void MixerImpl::mixCallback(byte *samples, uint len) {  	assert(samples); diff --git a/sound/mixer.h b/sound/mixer.h index 500a35e4c7..78dc336f2e 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -171,71 +171,6 @@ public:  		bool reverseStereo = false) = 0;  	/** -	 * Start playing the given audio input stream with looping. -	 * -	 * Note that the sound id assigned below is unique. At most one stream -	 * with a given id can play at any given time. Trying to play a sound -	 * with an id that is already in use causes the new sound to be not played. -	 * -	 * @param type	the type (voice/sfx/music) of the stream -	 * @param handle	a SoundHandle which can be used to reference and control -	 *                  the stream via suitable mixer methods -	 * @param input	the actual RewindableAudioStream to be played -	 * @param loopCount			how often the data shall be looped (0 = infinite) -	 * @param id	a unique id assigned to this stream -	 * @param volume	the volume with which to play the sound, ranging from 0 to 255 -	 * @param balance	the balance with which to play the sound, ranging from -128 to 127 -	 * @param autofreeStream	a flag indicating whether the stream should be -	 *                          freed after playback finished -	 * @param permanent	a flag indicating whether a plain stopAll call should -	 *                  not stop this particular stream -	 * @param reverseStereo	a flag indicating whether left and right channels shall be swapped -	 */ -	void playInputStreamLooping( -		SoundType type, -		SoundHandle *handle, -		RewindableAudioStream *input, -		uint loopCount, -		int id = -1, byte volume = kMaxChannelVolume, int8 balance = 0, -		bool autofreeStream = true, -		bool permanent = false, -		bool reverseStereo = false); - -	/** -	 * Start playing the given audio input stream with looping. -	 * -	 * Note that the sound id assigned below is unique. At most one stream -	 * with a given id can play at any given time. Trying to play a sound -	 * with an id that is already in use causes the new sound to be not played. -	 * -	 * @param type	the type (voice/sfx/music) of the stream -	 * @param handle	a SoundHandle which can be used to reference and control -	 *                  the stream via suitable mixer methods -	 * @param input	the actual SeekableAudioStream to be played -	 * @param loopCount			how often the data shall be looped (0 = infinite) -	 * @param loopStart			the time offset from which to start playback -	 * @param loopEnd			the time offset where the loop should end -	 * @param id	a unique id assigned to this stream -	 * @param volume	the volume with which to play the sound, ranging from 0 to 255 -	 * @param balance	the balance with which to play the sound, ranging from -128 to 127 -	 * @param autofreeStream	a flag indicating whether the stream should be -	 *                          freed after playback finished -	 * @param permanent	a flag indicating whether a plain stopAll call should -	 *                  not stop this particular stream -	 * @param reverseStereo	a flag indicating whether left and right channels shall be swapped -	 */ -	void playInputStreamLooping( -		SoundType type, -		SoundHandle *handle, -		SeekableAudioStream *input, -		uint loopCount, -		Timestamp loopStart, Timestamp loopEnd, -		int id = -1, byte volume = kMaxChannelVolume, int8 balance = 0, -		bool autofreeStream = true, -		bool permanent = false, -		bool reverseStereo = false); - -	/**  	 * Stop all currently playing sounds.  	 */  	virtual void stopAll() = 0; | 
