[Scummvm-git-logs] scummvm master -> e667376511ab32147f52b02dd98a9714c3d1a17d

NMIError noreply at scummvm.org
Sat Jun 18 18:28:19 UTC 2022


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:
e667376511 CHEWY: Fix intro music


Commit: e667376511ab32147f52b02dd98a9714c3d1a17d
    https://github.com/scummvm/scummvm/commit/e667376511ab32147f52b02dd98a9714c3d1a17d
Author: Coen Rampen (crampen at gmail.com)
Date: 2022-06-18T20:28:12+02:00

Commit Message:
CHEWY: Fix intro music

playIntroSequence would not set the playVideo stopMusic parameter to false,
so the music would be immediately stopped. Also, the CfoVideoTrack destructor
would stop all mixer channels, including the music. This would cause the music
to stop at the end of each video. This is replaced by a call to stopAllSounds,
and stopMusic is only called when the music is in the video data.
This commit also fixes an issue where playing a sound on a channel where a
sound was already active would not stop the old sound, but replace the sound
handle with a new one. The old sound could then no longer be accessed by the
sound class.

Changed paths:
    engines/chewy/r_event.cpp
    engines/chewy/sound.cpp
    engines/chewy/video/cfo_decoder.cpp


diff --git a/engines/chewy/r_event.cpp b/engines/chewy/r_event.cpp
index ae9bc0f1ee5..79cff1160da 100644
--- a/engines/chewy/r_event.cpp
+++ b/engines/chewy/r_event.cpp
@@ -676,7 +676,7 @@ static void playIntroSequence() {
 		if (introDialog[i] != -1)
 			start_aad(introDialog[i], -1);
 
-		ret = g_engine->_video->playVideo(introVideo[i]) ? 0 : -1;
+		ret = g_engine->_video->playVideo(introVideo[i], false) ? 0 : -1;
 		_G(atds)->stopAad();
 		SHOULD_QUIT_RETURN;
 	}
diff --git a/engines/chewy/sound.cpp b/engines/chewy/sound.cpp
index cce6a6c67f3..e8bf3d29cf0 100644
--- a/engines/chewy/sound.cpp
+++ b/engines/chewy/sound.cpp
@@ -76,6 +76,8 @@ void Sound::playSound(int num, uint channel, bool loop) {
 }
 
 void Sound::playSound(uint8 *data, uint32 size, uint channel, bool loop, DisposeAfterUse::Flag dispose) {
+	stopSound(channel);
+
 	Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
 		new ChewyVocStream(
 			new Common::MemorySeekableReadWriteStream(data, size, dispose),
@@ -101,7 +103,7 @@ void Sound::stopSound(uint channel) {
 }
 
 void Sound::stopAllSounds() {
-	for (int i = 4; i < 8; i++)
+	for (int i = 0; i < 14; i++)
 		stopSound(i);
 }
 
diff --git a/engines/chewy/video/cfo_decoder.cpp b/engines/chewy/video/cfo_decoder.cpp
index 1524c3bdc40..e556651fe7a 100644
--- a/engines/chewy/video/cfo_decoder.cpp
+++ b/engines/chewy/video/cfo_decoder.cpp
@@ -86,14 +86,19 @@ CfoDecoder::CfoVideoTrack::CfoVideoTrack(Common::SeekableReadStream *stream, uin
 }
 
 CfoDecoder::CfoVideoTrack::~CfoVideoTrack() {
-	_sound->stopAll();
+	// Stop all sound effects.
+	_sound->stopAllSounds();
 
 	for (int i = 0; i < MAX_SOUND_EFFECTS; i++) {
 		delete[] _soundEffects[i];
 	}
 
-	delete[] _musicData;
-	_musicData = nullptr;
+	// Only stop music if it is included in the video data.
+	if (_musicData) {
+		_sound->stopMusic();
+		delete[] _musicData;
+		_musicData = nullptr;
+	}
 }
 
 void CfoDecoder::CfoVideoTrack::readHeader() {




More information about the Scummvm-git-logs mailing list