From 0be019601319c8536cf42a64e97408ba6fb1716b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 6 Sep 2003 10:47:30 +0000 Subject: removed pauseMixer method from mixer, and renamed stop to stopChannel svn-id: r10042 --- scumm/imuse_digi.cpp | 2 +- scumm/smush/smush_mixer.cpp | 2 +- scumm/smush/smush_player.cpp | 2 +- scumm/sound.cpp | 7 ++++--- simon/sound.cpp | 8 ++++---- sound/mixer.cpp | 16 ++++------------ sound/mixer.h | 7 ++----- 7 files changed, 17 insertions(+), 27 deletions(-) diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp index 280ba51e94..d48b570bcb 100644 --- a/scumm/imuse_digi.cpp +++ b/scumm/imuse_digi.cpp @@ -709,7 +709,7 @@ IMuseDigital::~IMuseDigital() { _scumm->_timer->releaseProcedure(imus_digital_handler); for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) { - _scumm->_mixer->stop(_channel[l]._mixerChannel); + _scumm->_mixer->stopChannel(_channel[l]._mixerChannel); } } diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index 02dc117b29..a20b5e68a3 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -41,7 +41,7 @@ SmushMixer::SmushMixer(SoundMixer *m) : SmushMixer::~SmushMixer() { for (int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) { - _mixer->stop(_channels[i].mixer_index); + _mixer->stopChannel(_channels[i].mixer_index); } } diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index e82c7d6ae8..fb99c8a668 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -290,7 +290,7 @@ void SmushPlayer::deinit() { _base = NULL; } - _scumm->_mixer->stop(_IACTchannel); + _scumm->_mixer->stopChannel(_IACTchannel); _scumm->_insaneState = false; _scumm->abortCutscene(); diff --git a/scumm/sound.cpp b/scumm/sound.cpp index ca8ed4303f..377adfb46e 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -590,7 +590,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle || (_scumm->_gameId == GID_SAMNMAX && !_scumm->isScriptRunning(99)))) { for (i = 0; i < _scumm->_mixer->NUM_CHANNELS; i++) { if (i != talkChannel) { - _scumm->_mixer->stop(i); + _scumm->_mixer->stopChannel(i); } } } @@ -871,7 +871,8 @@ void Sound::pauseSounds(bool pause) { return; _soundsPaused = pause; - _scumm->_mixer->pauseMixer(pause); + + _scumm->_mixer->pauseAll(pause); _scumm->_sound->pauseBundleMusic(pause); @@ -1148,7 +1149,7 @@ void Sound::bundleMusicHandler(Scumm *scumm) { if (_musicBundleToBeRemoved) { _scumm->_timer->releaseProcedure(&music_handler); _nameBundleMusic = ""; - _scumm->_mixer->stop(_bundleMusicTrack); + _scumm->_mixer->stopChannel(_bundleMusicTrack); if (_musicBundleBufFinal) { free(_musicBundleBufFinal); _musicBundleBufFinal = NULL; diff --git a/simon/sound.cpp b/simon/sound.cpp index 2aca4b955c..041f626cd9 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -441,7 +441,7 @@ void SimonSound::playVoice(uint sound) { return; if (_voice_handle) - _mixer->stop(_voice_index); + _mixer->stopChannel(_voice_index); _voice_index = _voice->playSound(sound, &_voice_handle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED); } @@ -469,7 +469,7 @@ void SimonSound::playAmbient(uint sound) { return; if (_ambient_handle) - _mixer->stop(_ambient_index); + _mixer->stopChannel(_ambient_index); _ambient_index = _effects->playSound(sound, &_ambient_handle, SoundMixer::FLAG_LOOP|SoundMixer::FLAG_UNSIGNED); } @@ -479,7 +479,7 @@ bool SimonSound::hasVoice() { } void SimonSound::stopVoice() { - _mixer->stop(_voice_index); + _mixer->stopChannel(_voice_index); } void SimonSound::stopAll() { @@ -495,7 +495,7 @@ void SimonSound::ambientPause(bool b) { _ambient_paused = b; if (_ambient_paused && _ambient_playing) { - _mixer->stop(_ambient_index); + _mixer->stopChannel(_ambient_index); } else if (_ambient_playing) { uint tmp = _ambient_playing; _ambient_playing = 0; diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 1f8ba5ce39..4cb53ed927 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -137,7 +137,6 @@ SoundMixer::SoundMixer() { _musicVolume = 0; _paused = false; - _channelsPaused = false; for (i = 0; i != NUM_CHANNELS; i++) _channels[i] = NULL; @@ -280,7 +279,7 @@ int SoundMixer::playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file, void SoundMixer::mix(int16 *buf, uint len) { StackLock lock(_mutex); - if (_premixProc && !_paused) { + if (_premixProc) { int i; _premixProc(_premixParam, buf, len); // Convert mono data from the premix proc to stereo @@ -292,7 +291,7 @@ void SoundMixer::mix(int16 *buf, uint len) { memset(buf, 0, 2 * len * sizeof(int16)); } - if (!_paused && !_channelsPaused) { + if (!_paused) { // now mix all channels for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i] && !_channels[i]->isPaused()) @@ -315,7 +314,7 @@ void SoundMixer::stopAll() { _channels[i]->destroy(); } -void SoundMixer::stop(int index) { +void SoundMixer::stopChannel(int index) { if ((index < 0) || (index >= NUM_CHANNELS)) { warning("soundMixer::stop has invalid index %d", index); return; @@ -388,15 +387,8 @@ void SoundMixer::setChannelPan(PlayingSoundHandle handle, int8 pan) { _channels[index]->setChannelPan(pan); } -void SoundMixer::pauseMixer(bool paused) { - // TODO/FIXME: This is only used by scumm/sound.cpp, and - // even there it can probably be replaced by a call to pauseAll. - // Research that, and if possible remove this method. - _paused = paused; -} - void SoundMixer::pauseAll(bool paused) { - _channelsPaused = paused; + _paused = paused; } void SoundMixer::pauseChannel(int index, bool paused) { diff --git a/sound/mixer.h b/sound/mixer.h index 8fd7883418..d688513d01 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -72,7 +72,7 @@ private: int _globalVolume; int _musicVolume; - bool _paused, _channelsPaused; + bool _paused; Channel *_channels[NUM_CHANNELS]; @@ -112,7 +112,7 @@ public: void stopAll(); /** stop playing the given channel */ - void stop(int channel); + void stopChannel(int channel); /** stop playing the sound with given ID */ void stopID(int id); @@ -120,9 +120,6 @@ public: /** stop playing the channel for the given handle */ void stopHandle(PlayingSoundHandle handle); - /** pause/unpause all mixing (including adlib) */ - void pauseMixer(bool paused); - /** pause/unpause all channels */ void pauseAll(bool paused); -- cgit v1.2.3