From 124a84033f302b21751fc3cf8c5fea83acdd05fb Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 2 Sep 2003 16:20:10 +0000 Subject: Unless I'm gravely mistaken, StreamCompMusic() should always create a new stream, in which case the warning about the sound handle being 0 is bogus. svn-id: r9973 --- sword2/driver/d_sound.cpp | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'sword2/driver') diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 395dff60cc..436e7e3897 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -1352,20 +1352,14 @@ int32 Sword2Sound::StreamCompMusic(const char *filename, uint32 musicId, int32 l int8 pan; if (v0 > v1) { - volume = musicVolTable[v0]; - pan = (musicVolTable[v1 * 16 / v0] / 2) - 127; -// IDirectSoundBuffer_SetVolume(lpDsbMus[primaryStream], musicVolTable[v0]); -// IDirectSoundBuffer_SetPan(lpDsbMus[primaryStream], musicVolTable[v1*16/v0]); + volume = musicVolTable[v0]; + pan = (musicVolTable[v1 * 16 / v0] / 2) - 127; } else if (v1 > v0) { - volume = musicVolTable[v1]; - pan = (musicVolTable[v0 * 16 / v1] / 2) + 127; -// IDirectSoundBuffer_SetVolume(lpDsbMus[primaryStream], musicVolTable[v1]); -// IDirectSoundBuffer_SetPan(lpDsbMus[primaryStream], -musicVolTable[v0*16/v1]); + volume = musicVolTable[v1]; + pan = (musicVolTable[v0 * 16 / v1] / 2) + 127; } else { - volume = musicVolTable[v1]; - pan = 0; -// IDirectSoundBuffer_SetVolume(lpDsbMus[primaryStream], musicVolTable[v1]); -// IDirectSoundBuffer_SetPan(lpDsbMus[primaryStream], 0); + volume = musicVolTable[v1]; + pan = 0; } // FIXME: Until the mixer supports LE samples natively, we need to @@ -1374,14 +1368,10 @@ int32 Sword2Sound::StreamCompMusic(const char *filename, uint32 musicId, int32 l data16[i] = TO_BE_16(data16[i]); } - if (soundHandleMusic[primaryStream] == 0) { - warning("play music newStream(): this shouldn't happen"); -// assert(!soundHandleMusic[primaryStream]); - g_engine->_mixer->newStream(&soundHandleMusic[primaryStream], data16, bufferSizeMusic, 22050, - SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, 100000, volume, 0); - } else { - g_engine->_mixer->appendStream(soundHandleMusic[primaryStream], data16, bufferSizeMusic); - } + g_engine->_mixer->newStream(&soundHandleMusic[primaryStream], data16, + bufferSizeMusic, 22050, + SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE, + 100000, volume, pan); // Recorder some last variables musStreaming[primaryStream] = 1; -- cgit v1.2.3