aboutsummaryrefslogtreecommitdiff
path: root/engines/toon/audio.cpp
diff options
context:
space:
mode:
authorSylvain Dupont2010-10-16 19:27:11 +0000
committerSylvain Dupont2010-10-16 19:27:11 +0000
commit748e00f1cf30e9690532bd98087de2e65ca2bac2 (patch)
tree5cf53064657bf66cf37ab452e1dc2449cec9b871 /engines/toon/audio.cpp
parentc9f9c75a838719921003287af6c44625ee71352c (diff)
downloadscummvm-rg350-748e00f1cf30e9690532bd98087de2e65ca2bac2.tar.gz
scummvm-rg350-748e00f1cf30e9690532bd98087de2e65ca2bac2.tar.bz2
scummvm-rg350-748e00f1cf30e9690532bd98087de2e65ca2bac2.zip
TOON: Implemented the 4 different mute modes for sound/text
As specified in the hotkeys screen (music,dialog,sound,text on/off) Sounds are still played but with a volume = 0 (for timing issues) svn-id: r53545
Diffstat (limited to 'engines/toon/audio.cpp')
-rw-r--r--engines/toon/audio.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index 2ae2b2cc31..fb2eb18c0d 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -45,11 +45,31 @@ static int ADPCM_table[89] = {
AudioManager::AudioManager(ToonEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
for (int32 i = 0; i < 16; i++)
_channels[i] = 0;
+
+ voiceMuted = false;
+ musicMuted = false;
+ sfxMuted = false;
}
AudioManager::~AudioManager(void) {
}
+void AudioManager::muteMusic(bool muted) {
+ setMusicVolume(muted ? 0 : 255);
+ musicMuted = muted;
+}
+
+void AudioManager::muteVoice(bool muted) {
+ if(voiceStillPlaying() && _channels[2]) {
+ _channels[2]->setVolume(muted ? 0 : 255);
+ }
+ voiceMuted = muted;
+}
+
+void AudioManager::muteSfx(bool muted) {
+ sfxMuted = muted;
+}
+
void AudioManager::removeInstance(AudioStreamInstance *inst) {
debugC(1, kDebugAudio, "removeInstance(inst)");
@@ -99,6 +119,7 @@ void AudioManager::playMusic(Common::String dir, Common::String music) {
//if (!_channels[_currentMusicChannel])
// delete _channels[_currentMusicChannel];
_channels[_currentMusicChannel] = new AudioStreamInstance(this, _mixer, srs, true);
+ _channels[_currentMusicChannel]->setVolume(musicMuted ? 0 : 255);
_channels[_currentMusicChannel]->play(true, Audio::Mixer::kMusicSoundType);
}
@@ -125,6 +146,7 @@ void AudioManager::playVoice(int32 id, bool genericVoice) {
_channels[2] = new AudioStreamInstance(this, _mixer, stream);
_channels[2]->play(false, Audio::Mixer::kSpeechSoundType);
+ _channels[2]->setVolume(voiceMuted ? 0 : 255);
}
@@ -146,7 +168,7 @@ void AudioManager::playSFX(int32 id, int volume , bool genericSFX) {
if (!_channels[i]) {
_channels[i] = new AudioStreamInstance(this, _mixer, stream);
_channels[i]->play(false, Audio::Mixer::kSFXSoundType);
- _channels[i]->setVolume(volume);
+ _channels[i]->setVolume(sfxMuted ? 0 : volume);
break;
}
}
@@ -349,7 +371,7 @@ void AudioStreamInstance::play(bool fade, Audio::Mixer::SoundType soundType) {
_fadeTime = 0;
_soundType = soundType;
_musicAttenuation = 1000; // max volume
- _mixer->playStream(soundType, &_handle, this);
+ _mixer->playStream(soundType, &_handle, this, -1);
handleFade(0);
}