[Scummvm-cvs-logs] SF.net SVN: scummvm:[55356] scummvm/trunk/graphics/video

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Jan 20 18:07:17 CET 2011


Revision: 55356
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55356&view=rev
Author:   drmccoy
Date:     2011-01-20 17:07:17 +0000 (Thu, 20 Jan 2011)

Log Message:
-----------
VIDEO: Don't delete, just finish the audiostream on video end

Modified Paths:
--------------
    scummvm/trunk/graphics/video/coktel_decoder.cpp
    scummvm/trunk/graphics/video/coktel_decoder.h

Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp	2011-01-20 17:06:50 UTC (rev 55355)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp	2011-01-20 17:07:17 UTC (rev 55356)
@@ -200,19 +200,18 @@
 
 void CoktelDecoder::disableSound() {
 	if (_audioStream) {
-
-		if (_soundStage == kSoundPlaying) {
+		if ((_soundStage == kSoundPlaying) || (_soundStage == kSoundFinished)) {
 			_audioStream->finish();
 			_mixer->stopHandle(_audioHandle);
-		} else
-			delete _audioStream;
+		}
 
+		delete _audioStream;
 	}
 
 	_soundEnabled = false;
 	_soundStage   = kSoundNone;
 
-	_audioStream  = 0;
+	_audioStream = 0;
 }
 
 void CoktelDecoder::colorModeChanged() {
@@ -1275,16 +1274,15 @@
 
 	// Start the audio stream if necessary
 	if (startSound && _soundEnabled) {
-		_mixer->playStream(_soundType, &_audioHandle, _audioStream);
+			_mixer->playStream(_soundType, &_audioHandle, _audioStream,
+					-1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
 		_soundStage = kSoundPlaying;
 	}
 
 	// End the audio stream if necessary
 	if ((_curFrame >= (int32)(_frameCount - 1)) && (_soundStage == kSoundPlaying)) {
 		_audioStream->finish();
-		_mixer->stopHandle(_audioHandle);
-		_audioStream = 0;
-		_soundStage  = kSoundNone;
+		_soundStage = kSoundFinished;
 	}
 
 }
@@ -1419,7 +1417,9 @@
 		return false;
 	}
 
-	if (!_audioStream) {
+	if (!_audioStream || (_soundStage == kSoundFinished)) {
+		delete _audioStream;
+
 		_audioStream = Audio::makeQueuingAudioStream(_soundFreq, false);
 		_soundStage  = kSoundLoaded;
 	}
@@ -1550,7 +1550,11 @@
 		return true;
 
 	// Restart sound
-	if (_hasSound && (frame == -1) && (_soundStage == kSoundNone) && !_audioStream) {
+	if (_hasSound && (frame == -1) &&
+			((_soundStage == kSoundNone) || (_soundStage == kSoundFinished))) {
+
+		delete _audioStream;
+
 		_soundStage  = kSoundLoaded;
 		_audioStream = Audio::makeQueuingAudioStream(_soundFreq, _soundStereo != 0);
 	}
@@ -2150,7 +2154,8 @@
 
 	if (startSound && _soundEnabled) {
 		if (_hasSound && _audioStream) {
-			_mixer->playStream(Audio::Mixer::kSFXSoundType, &_audioHandle, _audioStream);
+			_mixer->playStream(_soundType, &_audioHandle, _audioStream,
+					-1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
 			_soundStage = kSoundPlaying;
 		} else
 			_soundStage = kSoundNone;
@@ -2158,9 +2163,7 @@
 
 	if (((uint32)_curFrame == (_frameCount - 1)) && (_soundStage == 2)) {
 		_audioStream->finish();
-		_mixer->stopHandle(_audioHandle);
-		_audioStream = 0;
-		_soundStage  = kSoundNone;
+		_soundStage = kSoundFinished;
 	}
 }
 

Modified: scummvm/trunk/graphics/video/coktel_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.h	2011-01-20 17:06:50 UTC (rev 55355)
+++ scummvm/trunk/graphics/video/coktel_decoder.h	2011-01-20 17:07:17 UTC (rev 55356)
@@ -136,9 +136,10 @@
 
 protected:
 	enum SoundStage {
-		kSoundNone    = 0, ///< No sound.
-		kSoundLoaded  = 1, ///< Sound loaded.
-		kSoundPlaying = 2  ///< Sound is playing.
+		kSoundNone     = 0, ///< No sound.
+		kSoundLoaded   = 1, ///< Sound loaded.
+		kSoundPlaying  = 2, ///< Sound is playing.
+		kSoundFinished = 3  ///< No more new sound data.
 	};
 
 	enum Features {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list