diff options
author | Max Horn | 2008-01-05 20:49:18 +0000 |
---|---|---|
committer | Max Horn | 2008-01-05 20:49:18 +0000 |
commit | 8b12998c72409743139f694ae7a23722a8052082 (patch) | |
tree | 63fc32909688270aa037006467b9ec1013fc7f34 | |
parent | c9a8d02f6ef8f2f67b6c24228ff043ba975241c5 (diff) | |
download | scummvm-rg350-8b12998c72409743139f694ae7a23722a8052082.tar.gz scummvm-rg350-8b12998c72409743139f694ae7a23722a8052082.tar.bz2 scummvm-rg350-8b12998c72409743139f694ae7a23722a8052082.zip |
Use souStreamUsed to distinguish between 'stream' and 'streamSou' usage
svn-id: r30257
-rw-r--r-- | engines/scumm/imuse_digi/dimuse.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_script.cpp | 10 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_track.cpp | 15 |
3 files changed, 17 insertions, 14 deletions
diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index 2f097e6c0e..ff5731f526 100644 --- a/engines/scumm/imuse_digi/dimuse.cpp +++ b/engines/scumm/imuse_digi/dimuse.cpp @@ -277,7 +277,8 @@ void IMuseDigital::callback() { if (track->volGroupId == 3) type = Audio::Mixer::kMusicSoundType; - if (track->stream) { + if (!track->souStreamUsed) { + assert(track->stream); byte *tmpSndBufferPtr = NULL; int32 curFeedSize = 0; @@ -357,7 +358,8 @@ void IMuseDigital::callback() { feedSize -= curFeedSize; assert(feedSize >= 0); } while (feedSize != 0); - } else if (track->streamSou) { + } else { + assert(track->streamSou); if (_mixer->isReady()) { // FIXME: Can't we replace track->mixerStreamRunning by // _mixer->isSoundHandleActive(track->mixChanHandle) ? diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp index b9e242e529..f663d1c628 100644 --- a/engines/scumm/imuse_digi/dimuse_script.cpp +++ b/engines/scumm/imuse_digi/dimuse_script.cpp @@ -165,7 +165,8 @@ void IMuseDigital::parseScriptCmds(int cmd, int b, int c, int d, int e, int f, i void IMuseDigital::flushTrack(Track *track) { track->toBeRemoved = true; - if (track->stream) { + if (!track->souStreamUsed) { + assert(track->stream); // Finalize the appendable stream track->stream->finish(); // There might still be some data left in the buffers of the @@ -179,7 +180,8 @@ void IMuseDigital::flushTrack(Track *track) { track->soundDesc = NULL; track->used = false; } - } else if (track->streamSou) { + } else { + assert(track->streamSou); _mixer->stopHandle(track->mixChanHandle); delete track->streamSou; track->streamSou = NULL; @@ -397,13 +399,15 @@ void IMuseDigital::stopAllSounds() { // Stop the sound output, *now*. No need to use toBeRemoved etc. // as we are protected by a mutex, and this method is never called // from IMuseDigital::callback either. - if (track->stream) { + if (!track->souStreamUsed) { + assert(track->stream); _mixer->stopHandle(track->mixChanHandle); delete track->stream; track->stream = NULL; _sound->closeSound(track->soundDesc); track->soundDesc = NULL; } else if (track->streamSou) { + assert(track->streamSou); _mixer->stopHandle(track->mixChanHandle); delete track->streamSou; track->streamSou = NULL; diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index 402385aa2c..0f1cd8ba8e 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -114,13 +114,16 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int bits = 0, freq = 0, channels = 0; - if (input) { + track->souStreamUsed = (input != 0); + + if (track->souStreamUsed) { track->feedSize = 0; - track->souStreamUsed = true; track->soundName[0] = 0; track->soundDesc = NULL; + track->streamSou = input; + track->stream = NULL; + track->mixerStreamRunning = false; } else { - track->souStreamUsed = false; strcpy(track->soundName, soundName); track->soundDesc = _sound->openSound(soundId, soundName, soundType, volGroupId, -1); @@ -162,13 +165,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, if (track->sndDataExtComp) track->mixerFlags |= kFlagLittleEndian; #endif - } - if (input) { - track->streamSou = input; - track->stream = NULL; - track->mixerStreamRunning = false; - } else { const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int vol = track->vol / 1000; Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; |