diff options
author | Paul Gilbert | 2011-07-28 21:36:15 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-07-28 21:36:15 +1000 |
commit | 53e5522e5a895ba8bdd7fc20b03d0c67bc840eeb (patch) | |
tree | aa4a5edfed1c05a9858123fa1c3900a28d9bddfb /engines/tsage/sound.cpp | |
parent | 30005b450bc2b503dc7b43ea351e6e3621882f84 (diff) | |
download | scummvm-rg350-53e5522e5a895ba8bdd7fc20b03d0c67bc840eeb.tar.gz scummvm-rg350-53e5522e5a895ba8bdd7fc20b03d0c67bc840eeb.tar.bz2 scummvm-rg350-53e5522e5a895ba8bdd7fc20b03d0c67bc840eeb.zip |
TSAGE: Fixed a problem with only the first Fx sound being played
Diffstat (limited to 'engines/tsage/sound.cpp')
-rw-r--r-- | engines/tsage/sound.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 3d725a4522..da70ea2ab7 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -2306,16 +2306,17 @@ void Sound::_soServiceTrackType1(int trackIndex, const byte *channelData) { for (uint entryIndex = 0; entryIndex < vtStruct->_entries.size(); ++entryIndex) { VoiceStructEntry &vte = vtStruct->_entries[entryIndex]; VoiceStructEntryType1 &vse = vte._type1; - if ((vse._sound == this) && (vse._channelNum == channel) && (vse._field4 == vtStruct->_total)) { + if ((vse._sound == this) && (vse._channelNum == channel) && (vse._field4 == *(channelData + 1))) { SoundDriver *driver = vte._driver; - int v1, isEnded; - driver->proc42(vte._voiceNum, vtStruct->_total, _loop ? 1 : 0, &v1, &isEnded); + int isEnded, resetTimer; + driver->proc42(vte._voiceNum, vtStruct->_total, _loop ? 1 : 0, &isEnded, &resetTimer); if (isEnded) { _trkState[trackIndex] = 0; - } else if (vtStruct->_total) { + } else if (resetTimer) { _timer = 0; } + return; } } @@ -2911,15 +2912,18 @@ void AdlibFxSoundDriver::proc42(int channel, int cmd, int value, int *v1, int *v // Note: Checking whether a playing Fx sound had finished was originally done in another // method in the sample playing code. But since we're using the ScummVM audio soundsystem, // it's easier simply to do the check right here - if (_audioStream && _audioStream->endOfStream()) { - delete _audioStream; + if (_audioStream && (_audioStream->numQueuedStreams() == 0)) { + _mixer->stopHandle(_soundHandle); _audioStream = NULL; _channelData = NULL; } if (!_channelData) // Flag that sound isn't playing - *v2 = 1; + *v1 = 1; + + // TODO: v2 is used for flagging a reset of the timer. I'm not sure if it's needed + *v2 = 0; } void AdlibFxSoundDriver::write(int v) { |