diff options
author | Paul Gilbert | 2011-07-30 19:18:00 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-07-30 19:18:00 +1000 |
commit | 5e726f604316d31695dbf289870abfef08c8b9b9 (patch) | |
tree | 35cffb2dad24cb2396b2e311367c95827615892d | |
parent | f482e25f2a7419828351e0eb598247275646b8c2 (diff) | |
download | scummvm-rg350-5e726f604316d31695dbf289870abfef08c8b9b9.tar.gz scummvm-rg350-5e726f604316d31695dbf289870abfef08c8b9b9.tar.bz2 scummvm-rg350-5e726f604316d31695dbf289870abfef08c8b9b9.zip |
TSAGE: Tweaks to better detect when a playing sound effect has ended
-rw-r--r-- | engines/tsage/sound.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 60b11e3f8c..69ac426964 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -2803,6 +2803,7 @@ SoundBlasterDriver::SoundBlasterDriver(): SoundDriver() { _mixer = _vm->_mixer; _sampleRate = _mixer->getOutputRate(); _audioStream = NULL; + _channelData = NULL; } SoundBlasterDriver::~SoundBlasterDriver() { @@ -2835,6 +2836,8 @@ void SoundBlasterDriver::playSound(const byte *channelData, int dataOffset, int if (program != -1) return; + assert(channel == 0); + // If sound data has been previously set, then release it if (_channelData) updateVoice(channel); @@ -2856,7 +2859,12 @@ void SoundBlasterDriver::playSound(const byte *channelData, int dataOffset, int } void SoundBlasterDriver::updateVoice(int channel) { - // No implementation + // Stop the playing voice + if (_mixer->isSoundHandleActive(_soundHandle)) + _mixer->stopHandle(_soundHandle); + + _audioStream = NULL; + _channelData = NULL; } void SoundBlasterDriver::proc38(int channel, int cmd, int value) { @@ -2875,9 +2883,7 @@ void SoundBlasterDriver::proc42(int channel, int cmd, int value, int *v1, int *v // 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->numQueuedStreams() == 0)) { - _mixer->stopHandle(_soundHandle); - _audioStream = NULL; - _channelData = NULL; + updateVoice(channel); } if (!_channelData) |