[Scummvm-cvs-logs] SF.net SVN: scummvm: [24304] scummvm/trunk/engines/agos

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sat Oct 14 07:47:23 CEST 2006


Revision: 24304
          http://svn.sourceforge.net/scummvm/?rev=24304&view=rev
Author:   kirben
Date:     2006-10-13 22:47:18 -0700 (Fri, 13 Oct 2006)

Log Message:
-----------
Fix stopping of music in PP

Modified Paths:
--------------
    scummvm/trunk/engines/agos/res.cpp
    scummvm/trunk/engines/agos/sound.cpp

Modified: scummvm/trunk/engines/agos/res.cpp
===================================================================
--- scummvm/trunk/engines/agos/res.cpp	2006-10-14 03:15:35 UTC (rev 24303)
+++ scummvm/trunk/engines/agos/res.cpp	2006-10-14 05:47:18 UTC (rev 24304)
@@ -825,8 +825,10 @@
 }
 
 void AGOSEngine::loadVoice(uint speechId) {
-	if (getGameType() == GType_PP && speechId == 99)
+	if (getGameType() == GType_PP && speechId == 99) {
+		_sound->stopVoice();
 		return;
+	}
 
 	if (getFeatures() & GF_ZLIBCOMP) {
 		char filename[15];

Modified: scummvm/trunk/engines/agos/sound.cpp
===================================================================
--- scummvm/trunk/engines/agos/sound.cpp	2006-10-14 03:15:35 UTC (rev 24303)
+++ scummvm/trunk/engines/agos/sound.cpp	2006-10-14 05:47:18 UTC (rev 24304)
@@ -148,7 +148,7 @@
 	byte *buffer = (byte *)malloc(size);
 	assert(buffer);
 	_file->read(buffer, size);
-	_mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE);
+	_mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, sound);
 }
 
 void VocSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {
@@ -160,7 +160,7 @@
 	int size, rate;
 	byte *buffer = Audio::loadVOCFromStream(*_file, size, rate);
 	assert(buffer);
-	_mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE);
+	_mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, sound);
 }
 
 void RawSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {
@@ -173,7 +173,7 @@
 	byte *buffer = (byte *)malloc(size);
 	assert(buffer);
 	_file->read(buffer, size);
-	_mixer->playRaw(handle, buffer, size, 22050, flags | Audio::Mixer::FLAG_AUTOFREE);
+	_mixer->playRaw(handle, buffer, size, 22050, flags | Audio::Mixer::FLAG_AUTOFREE, sound);
 }
 
 #if defined(USE_MAD) || defined(USE_VORBIS) || defined(USE_FLAC)
@@ -254,7 +254,7 @@
 
 void MP3Sound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)
 {
-	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new CompAudioStream(this, sound, (flags & Audio::Mixer::FLAG_LOOP) != 0));
+	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new CompAudioStream(this, sound, (flags & Audio::Mixer::FLAG_LOOP) != 0), sound);
 }
 #endif
 
@@ -283,7 +283,7 @@
 
 void VorbisSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)
 {
-	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new CompAudioStream(this, sound, (flags & Audio::Mixer::FLAG_LOOP) != 0));
+	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new CompAudioStream(this, sound, (flags & Audio::Mixer::FLAG_LOOP) != 0), sound);
 }
 #endif
 
@@ -312,7 +312,7 @@
 
 void FlacSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)
 {
-	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new CompAudioStream(this, sound, (flags & Audio::Mixer::FLAG_LOOP) != 0));
+	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, new CompAudioStream(this, sound, (flags & Audio::Mixer::FLAG_LOOP) != 0), sound);
 }
 #endif
 
@@ -547,6 +547,9 @@
 	if (!_voice)
 		return;
 
+	if (_mixer->getSoundID(_voiceHandle) == (int)sound)
+		return;
+
 	_mixer->stopHandle(_voiceHandle);
 	if (_vm->getGameType() == GType_PP) {
 		_voice->playSound(sound, &_voiceHandle, Audio::Mixer::FLAG_LOOP);
@@ -629,7 +632,7 @@
 	byte *buffer = (byte *)malloc(size);
 	memcpy(buffer, soundData, size);
 
-	_mixer->playRaw(&_effectsHandle, buffer, size, 8000, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE);
+	_mixer->playRaw(&_effectsHandle, buffer, size, 8000, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE, sound);
 }
 
 // Feeble Files specific
@@ -722,7 +725,7 @@
 		memcpy(buffer, soundData + stream.pos(), size);
 	}
 
-	_mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, -1, v, p);
+	_mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, sound, v, p);
 }
 
 void Sound::stopSfx5() {


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