[Scummvm-git-logs] scummvm master -> 3066deecbdfe8fdcac2c3c2a9fbd34bf7abed529

moralrecordings code at moral.net.au
Sat Mar 28 16:35:24 UTC 2020


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

Summary:
bcf5250f8c DIRECTOR: Force single playback per sound channel
3066deecbd DIRECTOR: Add looping support to b_puppetSound


Commit: bcf5250f8c714093ec4cda5657a252bba7a6162d
    https://github.com/scummvm/scummvm/commit/bcf5250f8c714093ec4cda5657a252bba7a6162d
Author: Scott Percival (code at moral.net.au)
Date: 2020-03-29T00:15:19+08:00

Commit Message:
DIRECTOR: Force single playback per sound channel

Changed paths:
    engines/director/sound.cpp


diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 1c5b3a73b6..29a7f8fba6 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -105,6 +105,7 @@ void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) {
 
 	Audio::RewindableAudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
 
+	_mixer->stopHandle(*_channels[soundChannel - 1]);
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, _channels[soundChannel - 1], sound);
 }
 
@@ -124,6 +125,7 @@ void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) {
 
 	Audio::RewindableAudioStream *sound = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
 
+	_mixer->stopHandle(*_channels[soundChannel - 1]);
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, _channels[soundChannel - 1], sound);
 }
 
@@ -131,6 +133,7 @@ void DirectorSound::playMCI(Audio::AudioStream &stream, uint32 from, uint32 to)
 	Audio::SeekableAudioStream *seekStream = dynamic_cast<Audio::SeekableAudioStream *>(&stream);
 	Audio::SubSeekableAudioStream *subSeekStream = new Audio::SubSeekableAudioStream(seekStream, Audio::Timestamp(from, seekStream->getRate()), Audio::Timestamp(to, seekStream->getRate()));
 
+	_mixer->stopHandle(*_scriptSound);
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, _scriptSound, subSeekStream);
 }
 
@@ -145,6 +148,7 @@ void DirectorSound::playStream(Audio::SeekableAudioStream &stream, uint8 soundCh
 		return;
 	}
 
+	_mixer->stopHandle(*_channels[soundChannel - 1]);
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, _channels[soundChannel - 1], &stream);
 }
 


Commit: 3066deecbdfe8fdcac2c3c2a9fbd34bf7abed529
    https://github.com/scummvm/scummvm/commit/3066deecbdfe8fdcac2c3c2a9fbd34bf7abed529
Author: Scott Percival (code at moral.net.au)
Date: 2020-03-29T00:35:00+08:00

Commit Message:
DIRECTOR: Add looping support to b_puppetSound

Changed paths:
    engines/director/lingo/lingo-builtins.cpp
    engines/director/sound.cpp
    engines/director/sound.h


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index d43ed117b5..6abbc85662 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1424,12 +1424,16 @@ void LB::b_puppetSound(int nargs) {
 			error("b_puppetSound: attempted to play a non-SoundCast cast member");
 			return;
 		}
+		bool looping = ((SoundCast *)cast)->_looping;
 		SNDDecoder *sd = ((SoundCast *)cast)->_audio;
 		if (!sd) {
 			warning("b_puppetSound: no audio data attached to cast");
 			return;
 		}
-		sound->playStream(*sd->getAudioStream(), 1);
+		if (looping)
+			sound->playStream(*sd->getLoopingAudioStream(), 1);
+		else
+			sound->playStream(*sd->getAudioStream(), 1);
 	}
 
 }
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 29a7f8fba6..009b69b15a 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -138,11 +138,6 @@ void DirectorSound::playMCI(Audio::AudioStream &stream, uint32 from, uint32 to)
 }
 
 void DirectorSound::playStream(Audio::AudioStream &stream, uint8 soundChannel) {
-	Audio::SeekableAudioStream *seekStream = dynamic_cast<Audio::SeekableAudioStream *>(&stream);
-	playStream(*seekStream, soundChannel);
-}
-
-void DirectorSound::playStream(Audio::SeekableAudioStream &stream, uint8 soundChannel) {
 	if (soundChannel == 0 || soundChannel > _channels.size()) {
 		warning("Invalid sound channel %d", soundChannel);
 		return;
@@ -256,5 +251,10 @@ Audio::SeekableAudioStream *SNDDecoder::getAudioStream() {
 	return Audio::makeRawStream(_data, _size, _rate, _flags, DisposeAfterUse::NO);
 }
 
+Audio::AudioStream *SNDDecoder::getLoopingAudioStream() {
+	return new Audio::LoopingAudioStream(Audio::makeRawStream(_data, _size, _rate, _flags, DisposeAfterUse::NO), 0);
+}
+
+
 
 } // End of namespace Director
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 663d17578d..21f6d8e6e1 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -50,7 +50,6 @@ public:
 	void playFile(Common::String filename, uint8 soundChannel);
 	void playMCI(Audio::AudioStream &stream, uint32 from, uint32 to);
 	void playStream(Audio::AudioStream &stream, uint8 soundChannel);
-	void playStream(Audio::SeekableAudioStream &stream, uint8 soundChannel);
 	void systemBeep();
 	bool isChannelActive(uint8 soundChannel);
 	void stopSound(uint8 soundChannel);
@@ -65,6 +64,7 @@ public:
 
 	bool loadStream(Common::SeekableSubReadStreamEndian &stream);
 	Audio::SeekableAudioStream *getAudioStream();
+	Audio::AudioStream *getLoopingAudioStream();
 
 private:
 	byte *_data;




More information about the Scummvm-git-logs mailing list