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

AndywinXp noreply at scummvm.org
Sat Jun 1 14:20:51 UTC 2024


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:
e649cb6843 SWORD1: Fix sound volume being applied twice


Commit: e649cb68439a6b4edbfb4425db716d972bd6aaf7
    https://github.com/scummvm/scummvm/commit/e649cb68439a6b4edbfb4425db716d972bd6aaf7
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-06-01T16:20:14+02:00

Commit Message:
SWORD1: Fix sound volume being applied twice

Setting audio components to their respective type makes it so that
in mixer.cpp:Channel::updateChannelVolumes() the volume gets
proportionally re-applied. This has the consequence of transforming
very low volumes to zero volume.

To fix this, we apply the kPlainSoundType to every type of sound in
the game. This doesn't break volume sync between GMM and game
menu.

Changed paths:
    engines/sword1/sound.cpp


diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index 48fc9a9f838..b3a0ba3e79f 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -847,7 +847,7 @@ void Sound::playSpeech() {
 
 	Audio::SeekableAudioStream *stream = Audio::makeRawStream(
 		(byte *)_speechSample, _speechSize, 11025, SPEECH_FLAGS, DisposeAfterUse::NO);
-	_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_hSampleSpeech, stream);
+	_mixer->playStream(Audio::Mixer::kPlainSoundType, &_hSampleSpeech, stream);
 
 	if (SwordEngine::_systemVars.useWindowsAudioMode) {
 		int32 vol = 0;
@@ -1045,7 +1045,7 @@ bool Sound::prepareMusicStreaming(const Common::Path &filename, int newHandleId,
 	}
 
 	_musicOutputStream[newHandleId] = Audio::makeQueuingAudioStream(sampleRate, isStereo);
-	_mixer->playStream(Audio::Mixer::kMusicSoundType, &_hSampleMusic[newHandleId], _musicOutputStream[newHandleId]);
+	_mixer->playStream(Audio::Mixer::kPlainSoundType, &_hSampleMusic[newHandleId], _musicOutputStream[newHandleId]);
 
 	_mixer->setChannelRate(_hSampleMusic[newHandleId], sampleRate);
 	_mixer->setChannelVolume(_hSampleMusic[newHandleId], clampVolume((int32)volume));
@@ -1352,7 +1352,7 @@ void Sound::playFX(int32 fxID, int32 type, uint8 *wavData, uint32 vol[2]) {
 			}
 
 			if (stream) {
-				_mixer->playStream(Audio::Mixer::kSFXSoundType, &_hSampleFX[i], stream, -1, 0);
+				_mixer->playStream(Audio::Mixer::kPlainSoundType, &_hSampleFX[i], stream, -1, 0);
 
 				if (SwordEngine::_systemVars.useWindowsAudioMode) {
 					int32 leftVol  = (vol[0] * _volFX[0]) >> 4;




More information about the Scummvm-git-logs mailing list