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

aquadran noreply at scummvm.org
Mon Nov 22 17:08:29 UTC 2021


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

Summary:
1b4547dbd5 SCUMM: DiMUSE: Fix bug #13084
f896e44e92 SCUMM: DiMUSE: Change hardcoded sample rate to macro in the InternalMxier
3c10c825c9 SCUMM: DiMUSE: Correctly remove streamZones when releasing a dispatch
a1710c4533 SCUMM: DiMUSE: Properly implement audio handling when skipping SMUSH videos
7660fb3136 SCUMM: DiMUSE: Fix macro alignment
d1833afe12 SCUMM: DiMUSE: Clarify comment


Commit: 1b4547dbd56458380e04dd644df65268e85206aa
    https://github.com/scummvm/scummvm/commit/1b4547dbd56458380e04dd644df65268e85206aa
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2021-11-22T18:08:21+01:00

Commit Message:
SCUMM: DiMUSE: Fix bug #13084

Changed paths:
    engines/scumm/imuse_digi/dimuse_engine.cpp


diff --git a/engines/scumm/imuse_digi/dimuse_engine.cpp b/engines/scumm/imuse_digi/dimuse_engine.cpp
index 71d75f0f55..391e4e5d77 100644
--- a/engines/scumm/imuse_digi/dimuse_engine.cpp
+++ b/engines/scumm/imuse_digi/dimuse_engine.cpp
@@ -191,6 +191,10 @@ int IMuseDigital::startVoice(int soundId, const char *soundName, byte speakingAc
 
 			diMUSESetParam(kTalkSoundID, DIMUSE_P_TRANSPOSE, a->_talkFrequency);
 			diMUSESetParam(kTalkSoundID, DIMUSE_P_PAN, a->_talkPan);
+
+			_currentSpeechVolume = a->_talkVolume;
+			_currentSpeechFrequency = a->_talkFrequency;
+			_currentSpeechPan = a->_talkPan;
 		}
 
 		// The interpreter really calls for processStreams two times in a row,


Commit: f896e44e92edb06304430ac56f585ec3621ca1f4
    https://github.com/scummvm/scummvm/commit/f896e44e92edb06304430ac56f585ec3621ca1f4
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2021-11-22T18:08:21+01:00

Commit Message:
SCUMM: DiMUSE: Change hardcoded sample rate to macro in the InternalMxier

Changed paths:
    engines/scumm/imuse_digi/dimuse_internalmixer.cpp


diff --git a/engines/scumm/imuse_digi/dimuse_internalmixer.cpp b/engines/scumm/imuse_digi/dimuse_internalmixer.cpp
index 1d8cf798d5..2d216da2e4 100644
--- a/engines/scumm/imuse_digi/dimuse_internalmixer.cpp
+++ b/engines/scumm/imuse_digi/dimuse_internalmixer.cpp
@@ -32,7 +32,7 @@
 namespace Scumm {
 
 IMuseDigiInternalMixer::IMuseDigiInternalMixer(Audio::Mixer *mixer) {
-	_stream = Audio::makeQueuingAudioStream(22050, true);
+	_stream = Audio::makeQueuingAudioStream(DIMUSE_SAMPLERATE, true);
 	_mixer = mixer;
 	_radioChatter = 0;
 	_amp8Table = nullptr;


Commit: 3c10c825c9f9e2373ce21bd68816fc93911f7c08
    https://github.com/scummvm/scummvm/commit/3c10c825c9f9e2373ce21bd68816fc93911f7c08
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2021-11-22T18:08:21+01:00

Commit Message:
SCUMM: DiMUSE: Correctly remove streamZones when releasing a dispatch

Changed paths:
    engines/scumm/imuse_digi/dimuse_dispatch.cpp


diff --git a/engines/scumm/imuse_digi/dimuse_dispatch.cpp b/engines/scumm/imuse_digi/dimuse_dispatch.cpp
index 5f18a4646b..445e6ecb60 100644
--- a/engines/scumm/imuse_digi/dimuse_dispatch.cpp
+++ b/engines/scumm/imuse_digi/dimuse_dispatch.cpp
@@ -261,6 +261,7 @@ int IMuseDigital::dispatchRelease(IMuseDigiTrack *trackPtr) {
 			do {
 				streamZoneList->useFlag = 0;
 				removeStreamZoneFromList(&dispatchToDeallocate->streamZoneList, streamZoneList);
+				streamZoneList = dispatchToDeallocate->streamZoneList;
 			} while (dispatchToDeallocate->streamZoneList);
 		}
 	}


Commit: a1710c4533904a1b92a4e479ddbd9234d1d2942f
    https://github.com/scummvm/scummvm/commit/a1710c4533904a1b92a4e479ddbd9234d1d2942f
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2021-11-22T18:08:21+01:00

Commit Message:
SCUMM: DiMUSE: Properly implement audio handling when skipping SMUSH videos

Changed paths:
    engines/scumm/imuse_digi/dimuse_defs.h
    engines/scumm/imuse_digi/dimuse_engine.cpp
    engines/scumm/imuse_digi/dimuse_engine.h
    engines/scumm/imuse_digi/dimuse_tracks.cpp
    engines/scumm/imuse_digi/dimuse_wave.cpp
    engines/scumm/smush/smush_player.cpp


diff --git a/engines/scumm/imuse_digi/dimuse_defs.h b/engines/scumm/imuse_digi/dimuse_defs.h
index 56b8bb2245..76a5d66879 100644
--- a/engines/scumm/imuse_digi/dimuse_defs.h
+++ b/engines/scumm/imuse_digi/dimuse_defs.h
@@ -51,7 +51,7 @@ namespace Scumm {
 #define DIMUSE_GROUP_MUSICEFF 4
 #define DIMUSE_BUFFER_SPEECH  1
 #define DIMUSE_BUFFER_MUSIC   2
-#define DIMUSE_BUFFER_SFX     3
+#define DIMUSE_BUFFER_SMUSH     3
 
 // Parameters IDs
 #define DIMUSE_P_BOGUS_ID       0x0
diff --git a/engines/scumm/imuse_digi/dimuse_engine.cpp b/engines/scumm/imuse_digi/dimuse_engine.cpp
index 391e4e5d77..cdf926c5d5 100644
--- a/engines/scumm/imuse_digi/dimuse_engine.cpp
+++ b/engines/scumm/imuse_digi/dimuse_engine.cpp
@@ -94,14 +94,14 @@ IMuseDigital::IMuseDigital(ScummEngine_v7 *scumm, Audio::Mixer *mixer)
 		_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_SPEECH, 176000, 44000, 88000);
 		_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_MUSIC, 528000, 44000, 352000);
 	} else if (_vm->_game.id == GID_DIG && !isFTSoundEngine()) {
-		_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_SPEECH, 88000, 22000, 44000);
-		_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_MUSIC, 528000, 11000, 132000);
+		_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_SPEECH, 132000, 22000, 44000);
+		_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_MUSIC, 660000, 11000, 132000);
 	} else {
 		_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_SPEECH, 110000, 22000, 44000);
 		_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_MUSIC, 220000, 22000, 44000);
 	}
 
-	_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_SFX, 198000, 0, 0);
+	_filesHandler->allocSoundBuffer(DIMUSE_BUFFER_SMUSH, 198000, 0, 0);
 
 	_vm->getTimerManager()->installTimerProc(timer_handler, 1000000 / _callbackFps, this, "IMuseDigital");
 }
@@ -110,7 +110,7 @@ IMuseDigital::~IMuseDigital() {
 	_vm->getTimerManager()->removeTimerProc(timer_handler);
 	_filesHandler->deallocSoundBuffer(DIMUSE_BUFFER_SPEECH);
 	_filesHandler->deallocSoundBuffer(DIMUSE_BUFFER_MUSIC);
-	_filesHandler->deallocSoundBuffer(DIMUSE_BUFFER_SFX);
+	_filesHandler->deallocSoundBuffer(DIMUSE_BUFFER_SMUSH);
 	cmdsDeinit();
 	diMUSETerminate();
 	delete _internalMixer;
@@ -437,6 +437,33 @@ bool IMuseDigital::isEngineDisabled() {
 	return _isEngineDisabled;
 }
 
+void IMuseDigital::stopSMUSHAudio() {
+	if (!isFTSoundEngine()) {
+		if (_vm->_game.id == GID_DIG) {
+			int foundSoundId, bufSize, criticalSize, freeSpace, paused;
+			foundSoundId = diMUSEGetNextSound(0);
+			while (foundSoundId) {
+				if (diMUSEGetParam(foundSoundId, DIMUSE_P_SND_HAS_STREAM)) {
+					diMUSEQueryStream(foundSoundId, bufSize, criticalSize, freeSpace, paused);
+
+					// Here, the disasm explicitly asks for "bufSize == 193900";
+					// since this works half of the time in ScummVM (because of how we handle sound buffers),
+					// we do the check but we alternatively check for the SMUSH channel soundId, so to cover the
+					// remaining cases. This fixes instances in which exiting from a cutscene leaves both
+					// DiMUSE streams locked, with speech consequently unable to play and a "WARNING: three
+					// streams in use" message from streamerProcessStreams()
+					if (bufSize == 193900 || foundSoundId == DIMUSE_SMUSH_SOUNDID + DIMUSE_BUFFER_SMUSH)
+						diMUSEStopSound(foundSoundId);
+				}
+
+				foundSoundId = diMUSEGetNextSound(foundSoundId);
+			}
+		}
+
+		diMUSESetSequence(0);
+	}
+}
+
 bool IMuseDigital::isFTSoundEngine() {
 	return _isEarlyDiMUSE;
 }
@@ -704,6 +731,10 @@ int IMuseDigital::diMUSEProcessStreams() {
 	return cmdsHandleCmd(27);
 }
 
+void IMuseDigital::diMUSEQueryStream(int soundId, int32 &bufSize, int32 &criticalSize, int32 &freeSpace, int &paused) {
+	waveQueryStream(soundId, bufSize, criticalSize, freeSpace, paused);
+}
+
 int IMuseDigital::diMUSEFeedStream(int soundId, uint8 *srcBuf, int32 sizeToFeed, int paused) {
 	return cmdsHandleCmd(29, srcBuf, soundId, -1, sizeToFeed, paused);
 }
diff --git a/engines/scumm/imuse_digi/dimuse_engine.h b/engines/scumm/imuse_digi/dimuse_engine.h
index da0d1bb659..ccb7926d04 100644
--- a/engines/scumm/imuse_digi/dimuse_engine.h
+++ b/engines/scumm/imuse_digi/dimuse_engine.h
@@ -190,6 +190,7 @@ private:
 	int tracksStopSound(int soundId);
 	int tracksStopAllSounds();
 	int tracksGetNextSound(int soundId);
+	void tracksQueryStream(int soundId, int32 &bufSize, int32 &criticalSize, int32 &freeSpace, int &paused);
 	int tracksFeedStream(int soundId, uint8 *srcBuf, int32 sizeToFeed, int paused);
 	void tracksClear(IMuseDigiTrack *trackPtr);
 	int tracksSetParam(int soundId, int opcode, int value);
@@ -267,6 +268,7 @@ private:
 	int waveSwitchStream(int oldSoundId, int newSoundId, int fadeLengthMs, int fadeSyncFlag2, int fadeSyncFlag1);
 	int waveSwitchStream(int oldSoundId, int newSoundId, uint8 *crossfadeBuffer, int crossfadeBufferSize, int vocLoopFlag);
 	int waveProcessStreams();
+	void waveQueryStream(int soundId, int32 &bufSize, int32 &criticalSize, int32 &freeSpace, int &paused);
 	int waveFeedStream(int soundId, uint8 *srcBuf, int32 sizeToFeed, int paused);
 	int waveLipSync(int soundId, int syncId, int msPos, int32 &width, int32 &height);
 
@@ -322,6 +324,7 @@ public:
 	void flushTracks();
 	void disableEngine();
 	bool isEngineDisabled();
+	void stopSMUSHAudio();
 
 	bool isFTSoundEngine(); // Used in the handlers to check if we're using the FT version of the engine
 
@@ -354,6 +357,7 @@ public:
 	int diMUSESwitchStream(int oldSoundId, int newSoundId, int fadeDelay, int fadeSyncFlag2, int fadeSyncFlag1);
 	int diMUSESwitchStream(int oldSoundId, int newSoundId, uint8 *crossfadeBuffer, int crossfadeBufferSize, int vocLoopFlag);
 	int diMUSEProcessStreams();
+	void diMUSEQueryStream(int soundId, int32 &bufSize, int32 &criticalSize, int32 &freeSpace, int &paused);
 	int diMUSEFeedStream(int soundId, uint8 *srcBuf, int32 sizeToFeed, int paused);
 	int diMUSELipSync(int soundId, int syncId, int msPos, int32 &width, int32 &height);
 	int diMUSESetMusicGroupVol(int volume);
diff --git a/engines/scumm/imuse_digi/dimuse_tracks.cpp b/engines/scumm/imuse_digi/dimuse_tracks.cpp
index 590fb1515c..e0e7b5481b 100644
--- a/engines/scumm/imuse_digi/dimuse_tracks.cpp
+++ b/engines/scumm/imuse_digi/dimuse_tracks.cpp
@@ -282,6 +282,24 @@ int IMuseDigital::tracksGetNextSound(int soundId) {
 	return foundSoundId;
 }
 
+void IMuseDigital::tracksQueryStream(int soundId, int32 &bufSize, int32 &criticalSize, int32 &freeSpace, int &paused) {
+	if (!_trackList)
+		debug(5, "IMuseDigital::tracksQueryStream(): WARNING: empty trackList, ignoring call...");
+
+	IMuseDigiTrack *track = _trackList;
+	do {
+		if (track->soundId) {
+			if (soundId == track->soundId && track->dispatchPtr->streamPtr) {
+				streamerQueryStream(track->dispatchPtr->streamPtr, bufSize, criticalSize, freeSpace, paused);
+				return;
+			}
+		}
+		track = track->next;
+	} while (track);
+
+	debug(5, "IMuseDigital::tracksQueryStream(): WARNING: couldn't find sound %d in trackList, ignoring call...", soundId);
+}
+
 int IMuseDigital::tracksFeedStream(int soundId, uint8 *srcBuf, int32 sizeToFeed, int paused) {
 	if (!_trackList)
 		return -1;
diff --git a/engines/scumm/imuse_digi/dimuse_wave.cpp b/engines/scumm/imuse_digi/dimuse_wave.cpp
index 31539e0201..fb6a5c35eb 100644
--- a/engines/scumm/imuse_digi/dimuse_wave.cpp
+++ b/engines/scumm/imuse_digi/dimuse_wave.cpp
@@ -116,6 +116,11 @@ int IMuseDigital::waveProcessStreams() {
 	return streamerProcessStreams();
 }
 
+void IMuseDigital::waveQueryStream(int soundId, int32 &bufSize, int32 &criticalSize, int32 &freeSpace, int &paused) {
+	Common::StackLock lock(_mutex);
+	tracksQueryStream(soundId, bufSize, criticalSize, freeSpace, paused);
+}
+
 int IMuseDigital::waveFeedStream(int soundId, uint8 *srcBuf, int32 sizeToFeed, int paused) {
 	Common::StackLock lock(_mutex);
 	return tracksFeedStream(soundId, srcBuf, sizeToFeed, paused);
diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp
index 0da998264c..7384842e3a 100644
--- a/engines/scumm/smush/smush_player.cpp
+++ b/engines/scumm/smush/smush_player.cpp
@@ -506,7 +506,7 @@ void SmushPlayer::handleIACT(int32 subSize, Common::SeekableReadStream &b) {
 				bufId = DIMUSE_BUFFER_MUSIC;
 				volume = 2 * userId - 400;
 			} else if (userId >= 300 && userId <= 363) {
-				bufId = DIMUSE_BUFFER_SFX;
+				bufId = DIMUSE_BUFFER_SMUSH;
 				volume = 2 * userId - 600;
 			} else {
 				free(dataBuffer);
@@ -1344,6 +1344,7 @@ void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 st
 			_vm->_mixer->stopHandle(*_compressedFileSoundHandle);
 			_vm->_mixer->stopHandle(*_IACTchannel);
 			_IACTpos = 0;
+			_imuseDigital->stopSMUSHAudio();
 			break;
 		}
 		_vm->_system->delayMillis(10);


Commit: 7660fb31369429a814bb6494e44cef4520589a9e
    https://github.com/scummvm/scummvm/commit/7660fb31369429a814bb6494e44cef4520589a9e
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2021-11-22T18:08:21+01:00

Commit Message:
SCUMM: DiMUSE: Fix macro alignment

Changed paths:
    engines/scumm/imuse_digi/dimuse_defs.h


diff --git a/engines/scumm/imuse_digi/dimuse_defs.h b/engines/scumm/imuse_digi/dimuse_defs.h
index 76a5d66879..aff60b5727 100644
--- a/engines/scumm/imuse_digi/dimuse_defs.h
+++ b/engines/scumm/imuse_digi/dimuse_defs.h
@@ -51,7 +51,7 @@ namespace Scumm {
 #define DIMUSE_GROUP_MUSICEFF 4
 #define DIMUSE_BUFFER_SPEECH  1
 #define DIMUSE_BUFFER_MUSIC   2
-#define DIMUSE_BUFFER_SMUSH     3
+#define DIMUSE_BUFFER_SMUSH   3
 
 // Parameters IDs
 #define DIMUSE_P_BOGUS_ID       0x0


Commit: d1833afe12605d0238f917f44b68da79fa2104a9
    https://github.com/scummvm/scummvm/commit/d1833afe12605d0238f917f44b68da79fa2104a9
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2021-11-22T18:08:21+01:00

Commit Message:
SCUMM: DiMUSE: Clarify comment

Changed paths:
    engines/scumm/imuse_digi/dimuse_engine.cpp


diff --git a/engines/scumm/imuse_digi/dimuse_engine.cpp b/engines/scumm/imuse_digi/dimuse_engine.cpp
index cdf926c5d5..aae05fad5f 100644
--- a/engines/scumm/imuse_digi/dimuse_engine.cpp
+++ b/engines/scumm/imuse_digi/dimuse_engine.cpp
@@ -446,7 +446,7 @@ void IMuseDigital::stopSMUSHAudio() {
 				if (diMUSEGetParam(foundSoundId, DIMUSE_P_SND_HAS_STREAM)) {
 					diMUSEQueryStream(foundSoundId, bufSize, criticalSize, freeSpace, paused);
 
-					// Here, the disasm explicitly asks for "bufSize == 193900";
+					// Here, the original engine for DIG explicitly asks for "bufSize == 193900";
 					// since this works half of the time in ScummVM (because of how we handle sound buffers),
 					// we do the check but we alternatively check for the SMUSH channel soundId, so to cover the
 					// remaining cases. This fixes instances in which exiting from a cutscene leaves both




More information about the Scummvm-git-logs mailing list