[Scummvm-cvs-logs] scummvm master -> 5e726f604316d31695dbf289870abfef08c8b9b9

dreammaster dreammaster at scummvm.org
Sat Jul 30 11:21:25 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5e726f6043 TSAGE: Tweaks to better detect when a playing sound effect has ended


Commit: 5e726f604316d31695dbf289870abfef08c8b9b9
    https://github.com/scummvm/scummvm/commit/5e726f604316d31695dbf289870abfef08c8b9b9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-07-30T02:18:00-07:00

Commit Message:
TSAGE: Tweaks to better detect when a playing sound effect has ended

Changed paths:
    engines/tsage/sound.cpp



diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 60b11e3..69ac426 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)






More information about the Scummvm-git-logs mailing list