aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/imuse_digi
diff options
context:
space:
mode:
authorMax Horn2008-01-05 23:58:27 +0000
committerMax Horn2008-01-05 23:58:27 +0000
commitd340e77f24e3aff469a82268ed2561b9717a0e08 (patch)
tree86f3c720bd61589a63485be4b8d67868f9e167bb /engines/scumm/imuse_digi
parent273c5b5cf175e733fdf5e549dad8ecfbab8136b1 (diff)
downloadscummvm-rg350-d340e77f24e3aff469a82268ed2561b9717a0e08.tar.gz
scummvm-rg350-d340e77f24e3aff469a82268ed2561b9717a0e08.tar.bz2
scummvm-rg350-d340e77f24e3aff469a82268ed2561b9717a0e08.zip
Made IMuseDigital::stopSound use flushTrack instead of setting track->toBeRemoved = true; cleanup in flushTrack()
svn-id: r30282
Diffstat (limited to 'engines/scumm/imuse_digi')
-rw-r--r--engines/scumm/imuse_digi/dimuse_script.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp
index 185ef80e02..35bb9c0ddb 100644
--- a/engines/scumm/imuse_digi/dimuse_script.cpp
+++ b/engines/scumm/imuse_digi/dimuse_script.cpp
@@ -164,8 +164,6 @@ 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->souStreamUsed) {
_mixer->stopHandle(track->mixChanHandle);
} else if (track->stream) {
@@ -175,17 +173,20 @@ void IMuseDigital::flushTrack(Track *track) {
// played. The audio mixer will take care of it afterwards (and dispose it).
track->stream->finish();
track->stream = 0;
- if (track->soundDesc)
+ if (track->soundDesc) {
_sound->closeSound(track->soundDesc);
+ track->soundDesc = 0;
+ }
}
if (!_mixer->isSoundHandleActive(track->mixChanHandle)) {
memset(track, 0, sizeof(Track));
-
- // Still set toBeRemoved to true in case we are running inside the callback()
- // function
- track->toBeRemoved = true;
+
}
+
+ // Set toBeRemoved to true, even if we just stopped the sound completly
+ // (and thus set "used" to false);
+ track->toBeRemoved = true;
}
void IMuseDigital::flushTracks() {
@@ -310,7 +311,7 @@ void IMuseDigital::stopSound(int soundId) {
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
Track *track = _track[l];
if ((track->soundId == soundId) && track->used && !track->toBeRemoved) {
- track->toBeRemoved = true;
+ flushTrack();
}
}
}