diff options
author | Paweł Kołodziejski | 2003-09-03 06:03:29 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2003-09-03 06:03:29 +0000 |
commit | 3fba3b3d4c3cf3d46f5f609e994ca26267f3b2a2 (patch) | |
tree | ae56268ab78f61e26ae0763e00d7688da0e7eb9a | |
parent | 1fc3c0be23f9d8bbf655a376577fd63276b89c49 (diff) | |
download | scummvm-rg350-3fba3b3d4c3cf3d46f5f609e994ca26267f3b2a2.tar.gz scummvm-rg350-3fba3b3d4c3cf3d46f5f609e994ca26267f3b2a2.tar.bz2 scummvm-rg350-3fba3b3d4c3cf3d46f5f609e994ca26267f3b2a2.zip |
fixed music fading out. it's "goto" hack.
originaly dsound has 3 seconds buffer fillled with data enought for fading
this hack continue play music for time while fading is going
svn-id: r9983
-rw-r--r-- | sword2/driver/d_sound.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 130e1bd067..238ee9d245 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -1156,20 +1156,24 @@ void Sword2Sound::UpdateCompSampleStreaming(void) { if (v0 > v1) { volume = musicVolTable[v0]; pan = (musicVolTable[v1 * 16 / v0] / 2) - 127; + } + if (v1 > v0) { + volume = musicVolTable[v1]; + pan = (musicVolTable[v0 * 16 / v1] / 2) + 127; } else { - if (v1 > v0) { - volume = musicVolTable[v1]; - pan = (musicVolTable[v0 * 16 / v1] / 2) + 127; - } else { - volume = musicVolTable[v1]; - pan = 0; - } - g_engine->_mixer->setChannelVolume(soundHandleMusic[i], volume); - g_engine->_mixer->setChannelPan(soundHandleMusic[i], pan); + volume = musicVolTable[v1]; + pan = 0; } + g_engine->_mixer->setChannelVolume(soundHandleMusic[i], volume); + g_engine->_mixer->setChannelPan(soundHandleMusic[i], pan); + // FIXME: hack. this need cleanup. + // originaly it has 3 second buffer ahead enought for fading + // that why it's need play music for time while fading is going + goto label1; } } } else { +label1: len = bufferSizeMusic; // Reduce length if it requires reading past the end of the music @@ -1232,7 +1236,7 @@ void Sword2Sound::UpdateCompSampleStreaming(void) { // be necessary. if (len & 1) len--; - + g_engine->_mixer->appendStream(soundHandleMusic[i], data16, len); free(data16); |