[Scummvm-git-logs] scummvm master -> 11dbe3ca3d75f26034ed2118c2b663f723c250fc

NMIError 60350957+NMIError at users.noreply.github.com
Fri Sep 3 19:24:24 UTC 2021


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:
11dbe3ca3d BURIED: Add volume control


Commit: 11dbe3ca3d75f26034ed2118c2b663f723c250fc
    https://github.com/scummvm/scummvm/commit/11dbe3ca3d75f26034ed2118c2b663f723c250fc
Author: Coen Rampen (crampen at gmail.com)
Date: 2021-09-03T21:24:17+02:00

Commit Message:
BURIED: Add volume control

This adds volume control to the game by setting the mixer sound type on the
various audio streams to values other than the default "plain".

This uses the following sound types:
Ambient (music, environment sounds): music
AI voice: speech
Effects, interface, footsteps, movie audio: SFX

This could be further improved by specifying sound types for individual sounds,
f.e. SFX for environment sounds, or music for the "effects" in the appartment
which are short musical cues. The movie audio is of course pre-mixed music,
speech and SFX.

Changed paths:
    engines/buried/sound.cpp
    engines/buried/sound.h
    engines/buried/video_window.cpp


diff --git a/engines/buried/sound.cpp b/engines/buried/sound.cpp
index 8d0c1e47e8..fa5b593e86 100644
--- a/engines/buried/sound.cpp
+++ b/engines/buried/sound.cpp
@@ -144,6 +144,7 @@ bool SoundManager::setAmbientSound(const Common::String &fileName, bool fade, by
 			_soundData[kAmbientIndexBase + newAmbientTrack]->_timedEffectDelta = finalVolumeLevel / 16;
 			_soundData[kAmbientIndexBase + newAmbientTrack]->_timedEffectStart = g_system->getMillis();
 			_soundData[kAmbientIndexBase + newAmbientTrack]->_timedEffectRemaining = 2000;
+			_soundData[kAmbientIndexBase + newAmbientTrack]->_soundType = Audio::Mixer::kMusicSoundType;
 
 			// Start the new ambient
 			retVal = _soundData[kAmbientIndexBase + newAmbientTrack]->start();
@@ -155,6 +156,7 @@ bool SoundManager::setAmbientSound(const Common::String &fileName, bool fade, by
 				// Set some parameters
 				_soundData[kAmbientIndexBase + newAmbientTrack]->_volume = finalVolumeLevel;
 				_soundData[kAmbientIndexBase + newAmbientTrack]->_loop = true;
+				_soundData[kAmbientIndexBase + newAmbientTrack]->_soundType = Audio::Mixer::kMusicSoundType;
 
 				// Stop the current ambient
 				delete _soundData[kAmbientIndexBase + _lastAmbient];
@@ -248,6 +250,7 @@ bool SoundManager::setSecondaryAmbientSound(const Common::String &fileName, bool
 		_soundData[kAmbientIndexBase + newAmbientTrack]->_timedEffectDelta = finalVolumeLevel / 16;
 		_soundData[kAmbientIndexBase + newAmbientTrack]->_timedEffectStart = g_system->getMillis();
 		_soundData[kAmbientIndexBase + newAmbientTrack]->_timedEffectRemaining = 2000;
+		_soundData[kAmbientIndexBase + newAmbientTrack]->_soundType = Audio::Mixer::kMusicSoundType;
 
 		// Start the new ambient
 		return _soundData[kAmbientIndexBase + newAmbientTrack]->start();
@@ -260,6 +263,7 @@ bool SoundManager::setSecondaryAmbientSound(const Common::String &fileName, bool
 	// Set some parameters
 	_soundData[kAmbientIndexBase + newAmbientTrack]->_volume = finalVolumeLevel;
 	_soundData[kAmbientIndexBase + newAmbientTrack]->_loop = true;
+	_soundData[kAmbientIndexBase + newAmbientTrack]->_soundType = Audio::Mixer::kMusicSoundType;
 
 	// Start the new ambient
 	return _soundData[kAmbientIndexBase + newAmbientTrack]->start();
@@ -342,6 +346,8 @@ bool SoundManager::playSynchronousAIComment(const Common::String &fileName) {
 	if (!_soundData[kAIVoiceIndex]->load(fileName))
 		return false;
 
+	_soundData[kAIVoiceIndex]->_soundType = Audio::Mixer::kSpeechSoundType;
+
 	// Play the file
 	bool retVal = _soundData[kAIVoiceIndex]->start();
 
@@ -369,6 +375,7 @@ bool SoundManager::playAsynchronousAIComment(const Common::String &fileName) {
 	// Set some parameters
 	_soundData[kAIVoiceIndex]->_flags = SOUND_FLAG_DESTROY_AFTER_COMPLETION;
 	_soundData[kAIVoiceIndex]->_volume = 127;
+	_soundData[kAIVoiceIndex]->_soundType = Audio::Mixer::kSpeechSoundType;
 
 	// Play the file
 	return _soundData[kAIVoiceIndex]->start();
@@ -410,6 +417,7 @@ int SoundManager::playSoundEffect(const Common::String &fileName, int volume, bo
 	_soundData[kEffectsIndexBase + effectChannel]->_loop = loop;
 	if (oneShot)
 		_soundData[kEffectsIndexBase + effectChannel]->_flags = SOUND_FLAG_DESTROY_AFTER_COMPLETION;
+	_soundData[kEffectsIndexBase + effectChannel]->_soundType = Audio::Mixer::kSFXSoundType;
 
 	// Play the file
 	_soundData[kEffectsIndexBase + effectChannel]->start();
@@ -530,6 +538,7 @@ bool SoundManager::playInterfaceSound(const Common::String &fileName) {
 		return false;
 
 	_soundData[kInterfaceIndex]->_flags = SOUND_FLAG_DESTROY_AFTER_COMPLETION;
+	_soundData[kInterfaceIndex]->_soundType = Audio::Mixer::kSFXSoundType;
 
 	// Play the file
 	return _soundData[kInterfaceIndex]->start();
@@ -572,6 +581,7 @@ bool SoundManager::startFootsteps(int footstepsID) {
 		// Load the footsteps sample data and modify the internal flags
 		_soundData[kFootstepsIndex]->load(_vm->getFilePath(IDS_FOOTSTEPS_FILENAME_BASE + footstepsID));
 		_soundData[kFootstepsIndex]->_loop = true;
+		_soundData[kFootstepsIndex]->_soundType = Audio::Mixer::kSFXSoundType;
 	}
 
 	// Play the footsteps
@@ -694,6 +704,7 @@ SoundManager::Sound::Sound() {
 	_timedEffectRemaining = 0;
 
 	_wasPlaying = false;
+	_soundType = Audio::Mixer::kPlainSoundType;
 }
 
 SoundManager::Sound::~Sound() {
@@ -733,7 +744,7 @@ bool SoundManager::Sound::start() {
 		disposeAfterUse = DisposeAfterUse::YES;
 	}
 
-	g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _handle, audioStream,
+	g_system->getMixer()->playStream(_soundType, _handle, audioStream,
 			-1, clipVolume(_volume << 1), 0, disposeAfterUse);
 
 	return true;
diff --git a/engines/buried/sound.h b/engines/buried/sound.h
index 7d70fe95b9..d72fef6d8a 100644
--- a/engines/buried/sound.h
+++ b/engines/buried/sound.h
@@ -26,6 +26,7 @@
 #ifndef BURIED_SOUND_H
 #define BURIED_SOUND_H
 
+#include "audio/mixer.h"
 #include "common/str.h"
 
 namespace Audio {
@@ -134,6 +135,7 @@ private:
 		uint32 _timedEffectRemaining;             // The remaining amount of time for the effect
 
 		bool _wasPlaying;
+		Audio::Mixer::SoundType _soundType;
 	};
 
 	BuriedEngine *_vm;
diff --git a/engines/buried/video_window.cpp b/engines/buried/video_window.cpp
index 5019dc7a12..2054f718bc 100644
--- a/engines/buried/video_window.cpp
+++ b/engines/buried/video_window.cpp
@@ -104,6 +104,7 @@ bool VideoWindow::openVideo(const Common::String &fileName) {
 		closeVideo();
 		return false;
 	}
+	_video->setSoundType(Audio::Mixer::kSFXSoundType);
 
 	if (!_vm->isTrueColor()) {
 		Graphics::PixelFormat videoFormat = _video->getPixelFormat();




More information about the Scummvm-git-logs mailing list