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

sev- noreply at scummvm.org
Fri Apr 25 11:56:30 UTC 2025


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

Summary:
27ad5cb0fa QDENGINE: Remove SOUND_FLAG_PAUSED flag when sound is resumed
c4faab22e6 QDENGINE: Fix in-game sound volume control not working


Commit: 27ad5cb0fa64f7dc7f59eac3bf026a06baeeb0ee
    https://github.com/scummvm/scummvm/commit/27ad5cb0fa64f7dc7f59eac3bf026a06baeeb0ee
Author: Alikhan Balpykov (lowliet1990 at mail.ru)
Date: 2025-04-25T19:56:27+08:00

Commit Message:
QDENGINE: Remove SOUND_FLAG_PAUSED flag when sound is resumed

This fixes the bug where pausing the game in the midst of actor's speech
causes that actor stay in one state forever (even after resuming the
game), repeating the same animation that was playing before the pause.
This happened because "paused" flag was never removed after resuming the
sound, so the sound and animation that were synced to that sound could not finish.

Changed paths:
    engines/qdengine/system/sound/snd_sound.cpp


diff --git a/engines/qdengine/system/sound/snd_sound.cpp b/engines/qdengine/system/sound/snd_sound.cpp
index 72b58996544..a7849cf06eb 100644
--- a/engines/qdengine/system/sound/snd_sound.cpp
+++ b/engines/qdengine/system/sound/snd_sound.cpp
@@ -91,6 +91,7 @@ void sndSound::pause() {
 void sndSound::resume() {
 	debugC(5, kDebugSound, "sndSound::resume(). this: %p",  (void *)this);
 
+	_flags &= ~SOUND_FLAG_PAUSED;
 	g_system->getMixer()->pauseHandle(_audHandle, false);
 }
 


Commit: c4faab22e618709ecc71d3ec7a8b8e574657c4a8
    https://github.com/scummvm/scummvm/commit/c4faab22e618709ecc71d3ec7a8b8e574657c4a8
Author: Alikhan Balpykov (lowliet1990 at mail.ru)
Date: 2025-04-25T19:56:27+08:00

Commit Message:
QDENGINE: Fix in-game sound volume control not working

Changed paths:
    engines/qdengine/system/sound/snd_dispatcher.cpp
    engines/qdengine/system/sound/snd_sound.cpp
    engines/qdengine/system/sound/snd_sound.h


diff --git a/engines/qdengine/system/sound/snd_dispatcher.cpp b/engines/qdengine/system/sound/snd_dispatcher.cpp
index b7266233a1b..b2dc2dbba29 100644
--- a/engines/qdengine/system/sound/snd_dispatcher.cpp
+++ b/engines/qdengine/system/sound/snd_dispatcher.cpp
@@ -94,7 +94,7 @@ bool sndDispatcher::play_sound(const sndSound *snd, bool loop, int vol) {
 		if (loop)
 			p.toggle_looping();
 
-		int snd_volume = (vol == 255) ? volume_dB() : convert_volume_to_dB((volume() * vol) >> 8);
+		int snd_volume = vol * volume() / 256;
 
 		if (!p.create_sound_buffer())
 			return false;
@@ -161,7 +161,7 @@ sndSound::status_t sndDispatcher::sound_status(const sndSound *snd) const {
 
 bool sndDispatcher::update_volume() {
 	for (sound_list_t::iterator it = _sounds.begin(); it != _sounds.end(); ++it)
-		it->set_volume(volume_dB());
+		it->set_volume(volume());
 
 	return true;
 }
diff --git a/engines/qdengine/system/sound/snd_sound.cpp b/engines/qdengine/system/sound/snd_sound.cpp
index a7849cf06eb..bb0fa57664a 100644
--- a/engines/qdengine/system/sound/snd_sound.cpp
+++ b/engines/qdengine/system/sound/snd_sound.cpp
@@ -61,9 +61,9 @@ bool sndSound::play() {
 
 	if (_flags & SOUND_FLAG_LOOPING) {
 		Audio::AudioStream *audio = new Audio::LoopingAudioStream(_sound->_audioStream, 0, DisposeAfterUse::NO);
-		g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_audHandle, audio, -1, Audio::Mixer::kMaxChannelVolume, 0,  DisposeAfterUse::NO);
+		g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_audHandle, audio, -1, _volume, 0,  DisposeAfterUse::NO);
 	} else {
-		g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_audHandle, _sound->_audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0,  DisposeAfterUse::NO);
+		g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_audHandle, _sound->_audioStream, -1, _volume, 0,  DisposeAfterUse::NO);
 	}
 
 	return true;
@@ -119,6 +119,7 @@ bool sndSound::is_stopped() const {
 }
 
 bool sndSound::set_volume(int vol) {
+	_volume = vol;
 	g_system->getMixer()->setChannelVolume(_audHandle, vol);
 	return true;
 }
diff --git a/engines/qdengine/system/sound/snd_sound.h b/engines/qdengine/system/sound/snd_sound.h
index 97327e655b8..67ab9e93bd7 100644
--- a/engines/qdengine/system/sound/snd_sound.h
+++ b/engines/qdengine/system/sound/snd_sound.h
@@ -121,6 +121,8 @@ private:
 
 	Audio::SoundHandle _audHandle;
 
+	byte _volume = 255;
+
 	bool _isStopped = false;
 };
 




More information about the Scummvm-git-logs mailing list