diff options
Diffstat (limited to 'engines/saga/music.cpp')
-rw-r--r-- | engines/saga/music.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 1005b0ab5f..75008efb7d 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -249,6 +249,8 @@ void MusicPlayer::setVolume(int volume) { _masterVolume = volume; + Common::StackLock lock(_mutex); + for (int i = 0; i < 16; ++i) { if (_channel[i]) { _channel[i]->volume(_channelVolume[i] * _masterVolume / 255); @@ -346,7 +348,7 @@ void MusicPlayer::stopMusic() { } } -Music::Music(SagaEngine *vm, Audio::Mixer *mixer, MidiDriver *driver) : _vm(vm), _mixer(mixer), _adlib(false) { +Music::Music(SagaEngine *vm, Audio::Mixer *mixer, MidiDriver *driver, int enabled) : _vm(vm), _mixer(mixer), _enabled(enabled), _adlib(false) { _player = new MusicPlayer(driver); _currentVolume = 0; @@ -432,7 +434,11 @@ void Music::play(uint32 resourceId, MusicFlags flags) { uint32 loopStart; debug(2, "Music::play %d, %d", resourceId, flags); - + + if (!_enabled) { + return; + } + if (isPlaying() && _trackNumber == resourceId) { return; } @@ -440,7 +446,11 @@ void Music::play(uint32 resourceId, MusicFlags flags) { _trackNumber = resourceId; _player->stopMusic(); _mixer->stopHandle(_musicHandle); - + + if (!_vm->_musicVolume) { + return; + } + int realTrackNumber; if (_vm->getGameType() == GType_ITE) { |