diff options
author | Paweł Kołodziejski | 2003-09-01 06:13:47 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2003-09-01 06:13:47 +0000 |
commit | beb138d4d80ca3292ac81ff03232c474ac01da2b (patch) | |
tree | 5b79a9b156ffdb68b7a6ef7e836b1c2636925e3d /sword2 | |
parent | e9727c157e1ffd455adddad7c351e25da03a2094 (diff) | |
download | scummvm-rg350-beb138d4d80ca3292ac81ff03232c474ac01da2b.tar.gz scummvm-rg350-beb138d4d80ca3292ac81ff03232c474ac01da2b.tar.bz2 scummvm-rg350-beb138d4d80ca3292ac81ff03232c474ac01da2b.zip |
added warkaround for not exist music stream id at appendStream call
svn-id: r9950
Diffstat (limited to 'sword2')
-rw-r--r-- | sword2/driver/d_sound.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 3bf6c721b2..5fecba02b8 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -1370,6 +1370,7 @@ int32 Sword2Sound::StreamCompMusic(const char *filename, uint32 musicId, int32 l data16[i] = TO_BE_16(data16[i]); } + assert(!soundHandleMusic[primaryStream]); soundHandleMusic[primaryStream] = g_engine->_mixer->newStream(data16, bufferSizeMusic, 22050, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, 100000, volume, 0); @@ -1899,8 +1900,15 @@ void Sword2Sound::UpdateCompSampleStreaming(void) { // be necessary. if (len & 1) len--; - assert(soundHandleMusic[i]); - g_engine->_mixer->appendStream(soundHandleMusic[i], data16, len); + + if (soundHandleMusic[i] == 0) { + warning("play music appendStream(): this shouldn't happen"); + int volume = musicVolTable[volMusic[i]]; + soundHandleMusic[i] = g_engine->_mixer->newStream(data16, bufferSizeMusic, 22050, + SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, 100000, volume, 0); + } else { + g_engine->_mixer->appendStream(soundHandleMusic[i], data16, len); + } free(data16); |