diff options
author | Paweł Kołodziejski | 2008-01-14 23:41:42 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2008-01-14 23:41:42 +0000 |
commit | f433c621121e8b1d60e0f2b086f2c9313e76ab5e (patch) | |
tree | f5e1e168a82fb269add96f8d5bd981cec7fd22a3 /engines/scumm/imuse_digi/dimuse_track.cpp | |
parent | 8ada12d3d8f47e122e6ce5bb7d2d01230aa6b9a4 (diff) | |
download | scummvm-rg350-f433c621121e8b1d60e0f2b086f2c9313e76ab5e.tar.gz scummvm-rg350-f433c621121e8b1d60e0f2b086f2c9313e76ab5e.tar.bz2 scummvm-rg350-f433c621121e8b1d60e0f2b086f2c9313e76ab5e.zip |
implement force flush old fadeTrack. fixed trackId in new fadeTrack, it wasn't set properly, caused switching regions.
svn-id: r30489
Diffstat (limited to 'engines/scumm/imuse_digi/dimuse_track.cpp')
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_track.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index 984bb3b6f4..aaf41fca7d 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -318,7 +318,7 @@ void IMuseDigital::setHookIdForMusic(int hookId) { IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDelay) { assert(track); - Track *fadeTrack = 0; + Track *fadeTrack; debug(0, "IMuseDigital::cloneToFadeOutTrack(%d, %d)", track->trackId, fadeDelay); @@ -327,21 +327,23 @@ IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDel return NULL; } - if (_track[track->trackId + MAX_DIGITAL_TRACKS]->used) { - warning("IMuseDigital::cloneToFadeOutTrack: No free fade track"); - return NULL; - } - + ImuseDigiSndMgr::SoundDesc *soundDesc = _sound->cloneSound(track->soundDesc); + assert(soundDesc); fadeTrack = _track[track->trackId + MAX_DIGITAL_TRACKS]; + if (fadeTrack->used) { + warning("IMuseDigital::cloneToFadeOutTrack: No free fade track, force flush"); + flushTrack(fadeTrack); + _mixer->stopHandle(fadeTrack->mixChanHandle); + } + // Clone the settings of the given track memcpy(fadeTrack, track, sizeof(Track)); + fadeTrack->trackId = track->trackId + MAX_DIGITAL_TRACKS; - // Clone the sound. We use the original sound in the fadeTrack, - // and the cloned sound in the original track. This fixes bug #1635361. - assert(fadeTrack->soundDesc); - track->soundDesc = _sound->cloneSound(fadeTrack->soundDesc); - assert(track->soundDesc); + // Clone the sound. + // leaving bug number for now #1635361 + fadeTrack->soundDesc = soundDesc; // Set the volume fading parameters to indicate a fade out fadeTrack->volFadeDelay = fadeDelay; |