diff options
author | Johannes Schickel | 2008-04-10 19:33:06 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-04-10 19:33:06 +0000 |
commit | 5f3bfc702c062cf7a918617a616947e55e005f7d (patch) | |
tree | 69ffadbb99cafa36d7d70acf8502c8b318b670fd /engines/kyra | |
parent | 924912b7fb324a84d8f3cf6b96f5228d86af4fb2 (diff) | |
download | scummvm-rg350-5f3bfc702c062cf7a918617a616947e55e005f7d.tar.gz scummvm-rg350-5f3bfc702c062cf7a918617a616947e55e005f7d.tar.bz2 scummvm-rg350-5f3bfc702c062cf7a918617a616947e55e005f7d.zip |
- fixed valgrind warning
- reduced midi volume fadeout from 2s to 1s like HoF is doing (Kyra1 should use the same value)
svn-id: r31473
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/sound.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index 476b3b8b03..34c314f68d 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -155,6 +155,9 @@ SoundMidiPC::SoundMidiPC(KyraEngine *vm, Audio::Mixer *mixer, MidiDriver *driver _nativeMT32 = _useC55 = false; + _fadeStartTime = 0; + _fadeMusicOut = false; + memset(_channel, 0, sizeof(_channel)); memset(_channelVolume, 50, sizeof(_channelVolume)); _channelVolume[10] = 100; @@ -381,26 +384,28 @@ void SoundMidiPC::onTimer(void *refCon) { Common::StackLock lock(sound->_mutex); // this should be set to the fadeToBlack value - static const uint32 musicFadeTime = 2 * 1000; + static const uint32 musicFadeTime = 1 * 1000; - if (sound->_fadeMusicOut && sound->_fadeStartTime + musicFadeTime > sound->_vm->_system->getMillis()) { - byte volume = (byte)((musicFadeTime - (sound->_vm->_system->getMillis() - sound->_fadeStartTime)) * sound->_musicVolume / musicFadeTime); - sound->updateChannelVolume(volume); - } else if (sound->_fadeStartTime) { - sound->_fadeStartTime = 0; - sound->_fadeMusicOut = false; - sound->_isMusicPlaying = false; - - sound->_eventFromMusic = true; - // from sound/midiparser.cpp - for (int i = 0; i < 128; ++i) { - for (int j = 0; j < 16; ++j) { - sound->send(0x80 | j | i << 8); + if (sound->_fadeMusicOut) { + if (sound->_fadeStartTime + musicFadeTime > sound->_vm->_system->getMillis()) { + byte volume = (byte)((musicFadeTime - (sound->_vm->_system->getMillis() - sound->_fadeStartTime)) * sound->_musicVolume / musicFadeTime); + sound->updateChannelVolume(volume); + } else { + sound->_fadeStartTime = 0; + sound->_fadeMusicOut = false; + sound->_isMusicPlaying = false; + + sound->_eventFromMusic = true; + // from sound/midiparser.cpp + for (int i = 0; i < 128; ++i) { + for (int j = 0; j < 16; ++j) { + sound->send(0x80 | j | i << 8); + } } - } - for (int i = 0; i < 16; ++i) - sound->send(0x007BB0 | i); + for (int i = 0; i < 16; ++i) + sound->send(0x007BB0 | i); + } } if (sound->_isMusicPlaying) { |