[Scummvm-git-logs] scummvm master -> 5f09a046d1cd8d7277ffefc3a1893f3831b980f3

antoniou79 a.antoniou79 at gmail.com
Fri Jul 2 13:39:11 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:
5f09a046d1 BLADERUNNER: Support mixer sound type for ambient sounds


Commit: 5f09a046d1cd8d7277ffefc3a1893f3831b980f3
    https://github.com/scummvm/scummvm/commit/5f09a046d1cd8d7277ffefc3a1893f3831b980f3
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2021-07-02T16:38:49+03:00

Commit Message:
BLADERUNNER: Support mixer sound type for ambient sounds

And set custom sounds for RC outtake FLYTRU_E.VQA to use kSpeechSoundType as do all outtakes

Changed paths:
    engines/bladerunner/ambient_sounds.cpp
    engines/bladerunner/ambient_sounds.h
    engines/bladerunner/audio_player.cpp
    engines/bladerunner/audio_player.h
    engines/bladerunner/audio_speech.cpp
    engines/bladerunner/audio_speech.h
    engines/bladerunner/music.cpp
    engines/bladerunner/outtake.cpp
    engines/bladerunner/vqa_player.cpp
    engines/bladerunner/vqa_player.h


diff --git a/engines/bladerunner/ambient_sounds.cpp b/engines/bladerunner/ambient_sounds.cpp
index 0abb8f907b..d4e1d82b9e 100644
--- a/engines/bladerunner/ambient_sounds.cpp
+++ b/engines/bladerunner/ambient_sounds.cpp
@@ -39,6 +39,13 @@ AmbientSounds::AmbientSounds(BladeRunnerEngine *vm) {
 	_nonLoopingSounds = new NonLoopingSound[kNonLoopingSounds];
 	_loopingSounds = new LoopingSound[kLoopingSounds];
 
+	// The actual volume of ambient sounds is determined by the mixer (see BladeRunnerEngine::syncSoundSettings())
+	// In our BladeRunner engine ambient sounds do not have a distinct sound type of their own,
+	// so they are treated as kAmbientSoundType (default type, see: ambient_sounds.h).
+	//
+	// _ambientVolume here sets a percentage to be appied on the specified track volume
+	// before sending it to the audio player
+	// (setting _ambientVolume to 100 renders it indifferent)
 	_ambientVolume = BLADERUNNER_ORIGINAL_SETTINGS ? 65 : 100;
 
 	for (int i = 0; i != kNonLoopingSounds; ++i) {
@@ -73,6 +80,10 @@ static inline void sort(uint32 *a, uint32 *b) {
 	}
 }
 
+//
+// addSound() will add a track to the non-looping tracks array list
+// it will use the kAmbientSoundType for Mixer's Sound Type.
+// see AmbientSounds::tick()
 void AmbientSounds::addSound(
 	int sfxId,
 	uint32 delayMinSeconds, uint32 delayMaxSeconds,
@@ -113,6 +124,10 @@ void AmbientSounds::removeAllNonLoopingSounds(bool stopPlaying) {
 	}
 }
 
+//
+// addSpeech() will add a track to the non-looping tracks array list
+// it will use the kAmbientSoundType for Mixer's Sound Type
+// see AmbientSounds::tick()
 void AmbientSounds::addSpeech(int actorId, int sentenceId, uint32 delayMinSeconds, uint32 delayMaxSeconds, int volumeMin, int volumeMax, int panStartMin, int panStartMax, int panEndMin, int panEndMax, int priority, int unk) {
 #if BLADERUNNER_ORIGINAL_BUGS
 #else
@@ -131,16 +146,33 @@ void AmbientSounds::addSpeech(int actorId, int sentenceId, uint32 delayMinSecond
 					priority, unk);
 }
 
-void AmbientSounds::playSound(int sfxId, int volume, int panStart, int panEnd, int priority) {
-	_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(sfxId), volume * _ambientVolume / 100, panStart, panEnd, priority, kAudioPlayerOverrideVolume);
+// Explicitly plays a sound effect (sfx) track (specified by id)
+// It does not add it as a track to the non-looping tracks array list
+// It uses the parameter "type" as the mixer's sound type - which determines the volume setting in effect.
+// By default sound type is kAmbientSoundType (see ambient_sounds.h).
+void AmbientSounds::playSound(int sfxId, int volume, int panStart, int panEnd, int priority, Audio::Mixer::SoundType type) {
+	_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(sfxId), volume * _ambientVolume / 100, panStart, panEnd, priority, kAudioPlayerOverrideVolume, type);
 }
 
+// Explicitly plays a speech cue
+// It does not add it as a track to the non-looping tracks array list
+// It uses mixer's sound type kSpeechSoundType - which determines the volume setting in effect (Speech)
 void AmbientSounds::playSpeech(int actorId, int sentenceId, int volume, int panStart, int panEnd, int priority) {
 	Common::String name = Common::String::format( "%02d-%04d%s.AUD", actorId, sentenceId, _vm->_languageCode.c_str());
 	_vm->_audioPlayer->playAud(name, volume * _ambientVolume / 100, panStart, panEnd, priority, kAudioPlayerOverrideVolume, Audio::Mixer::kSpeechSoundType);
 }
 
-void AmbientSounds::addLoopingSound(int sfxId, int volume, int pan, uint32 delaySeconds) {
+// Looping Sound will use paramerter "type" as the mixer's SoundType when playing this track.
+// By default sound type is kAmbientSoundType (see ambient_sounds.h).
+// This determines the volume setting that will be in effect for the audio.
+//
+// NOTE If restoring from a saved game, a looping track will always use the default SoundType (kAmbientSoundType)
+// because sound type is not stored.
+// TODO We could save the sound type re-using the space for field "track.audioPlayerTrack"
+// which is skipped for *both* looping and non-looping tracks in save() and load() code
+// However, the issue is negligible; the default SoundType for looping tracks is overridden
+// only in one special case so far (restored content Outtake "FLYTRU_E.VQA", see: outtake.cpp)
+void AmbientSounds::addLoopingSound(int sfxId, int volume, int pan, uint32 delaySeconds, Audio::Mixer::SoundType type) {
 	const Common::String &name = _vm->_gameInfo->getSfxTrack(sfxId);
 	int32 hash = MIXArchive::getHash(name);
 
@@ -159,6 +191,7 @@ void AmbientSounds::addLoopingSound(int sfxId, int volume, int pan, uint32 delay
 	track.hash = hash;
 	track.pan = pan;
 	track.volume = volume;
+	track.soundType = (int32) type;
 
 	int actualVolumeStart = volume * _ambientVolume / 100;
 	int actualVolumeEnd = actualVolumeStart;
@@ -167,7 +200,7 @@ void AmbientSounds::addLoopingSound(int sfxId, int volume, int pan, uint32 delay
 		actualVolumeStart = 0;
 	}
 
-	track.audioPlayerTrack = _vm->_audioPlayer->playAud(name, actualVolumeStart, pan, pan, 99, kAudioPlayerLoop | kAudioPlayerOverrideVolume);
+	track.audioPlayerTrack = _vm->_audioPlayer->playAud(name, actualVolumeStart, pan, pan, 99, kAudioPlayerLoop | kAudioPlayerOverrideVolume, type);
 
 	if (track.audioPlayerTrack == -1) {
 		removeLoopingSoundByIndex(i, 0u);
@@ -208,6 +241,7 @@ void AmbientSounds::removeAllLoopingSounds(uint32 delaySeconds) {
 	}
 }
 
+// tick() only handles the non-looping added ambient sounds
 void AmbientSounds::tick() {
 	uint32 now = _vm->_time->current();
 
@@ -229,12 +263,17 @@ void AmbientSounds::tick() {
 
 		track.volume = _vm->_rnd.getRandomNumberRng(track.volumeMin, track.volumeMax);
 
+		Audio::Mixer::SoundType mixerAmbientSoundType = kAmbientSoundType;
+		if (track.soundType >= 0) {
+			mixerAmbientSoundType = (Audio::Mixer::SoundType) track.soundType;
+		}
 		track.audioPlayerTrack = _vm->_audioPlayer->playAud(track.name,
-															track.volume * _ambientVolume / 100,
-															panStart,
-															panEnd,
-															track.priority,
-															kAudioPlayerOverrideVolume);
+		                                                    track.volume * _ambientVolume / 100,
+		                                                    panStart,
+		                                                    panEnd,
+		                                                    track.priority,
+		                                                    kAudioPlayerOverrideVolume,
+		                                                    mixerAmbientSoundType);
 
 		track.nextPlayTimeStart = now;
 		track.nextPlayTimeDiff  = _vm->_rnd.getRandomNumberRng(track.delayMin, track.delayMax);
@@ -249,7 +288,11 @@ void AmbientSounds::setVolume(int volume) {
 				if (_vm->_audioPlayer->isActive(_loopingSounds[i].audioPlayerTrack)) {
 					_vm->_audioPlayer->adjustVolume(_loopingSounds[i].audioPlayerTrack, newVolume, 1u, false);
 				} else {
-					_loopingSounds[i].audioPlayerTrack = _vm->_audioPlayer->playAud(_loopingSounds[i].name, 1, _loopingSounds[i].pan, _loopingSounds[i].pan, 99, kAudioPlayerLoop | kAudioPlayerOverrideVolume);
+					Audio::Mixer::SoundType mixerAmbientSoundType = kAmbientSoundType;
+					if (_loopingSounds[i].soundType >= 0) {
+						mixerAmbientSoundType = (Audio::Mixer::SoundType) _loopingSounds[i].soundType;
+					}
+					_loopingSounds[i].audioPlayerTrack = _vm->_audioPlayer->playAud(_loopingSounds[i].name, 1, _loopingSounds[i].pan, _loopingSounds[i].pan, 99, kAudioPlayerLoop | kAudioPlayerOverrideVolume, mixerAmbientSoundType);
 					if (_loopingSounds[i].audioPlayerTrack == -1) {
 						removeLoopingSound(i, 0u);
 					} else {
@@ -354,6 +397,7 @@ void AmbientSounds::addSoundByName(
 	track.panEndMin = panEndMin;
 	track.panEndMax = panEndMax;
 	track.priority = priority;
+	track.soundType = -1;
 }
 
 void AmbientSounds::removeNonLoopingSoundByIndex(int index, bool stopPlaying) {
@@ -366,6 +410,7 @@ void AmbientSounds::removeNonLoopingSoundByIndex(int index, bool stopPlaying) {
 	track.isActive = false;
 	track.audioPlayerTrack = -1;
 	//	track.field_45 = 0;
+	track.soundType = -1;
 }
 
 void AmbientSounds::removeLoopingSoundByIndex(int index, uint32 delaySeconds) {
@@ -383,6 +428,7 @@ void AmbientSounds::removeLoopingSoundByIndex(int index, uint32 delaySeconds) {
 	track.audioPlayerTrack = -1;
 	track.volume = 0;
 	track.pan = 0;
+	track.soundType = -1;
 }
 
 void AmbientSounds::save(SaveFileWriteStream &f) {
@@ -460,6 +506,7 @@ void AmbientSounds::load(SaveFileReadStream &f) {
 #endif // BLADERUNNER_ORIGINAL_BUGS
 		track.priority = f.readInt();
 		f.skip(4); // field_45
+		track.soundType = -1;
 	}
 
 	for (int i = 0; i != kLoopingSounds; ++i) {
@@ -471,12 +518,17 @@ void AmbientSounds::load(SaveFileReadStream &f) {
 		track.audioPlayerTrack = -1;
 		track.volume = f.readInt();
 		track.pan = f.readInt();
+		track.soundType = -1;
 	}
 
 	for (int i = 0; i != kLoopingSounds; ++i) {
 		LoopingSound &track = _loopingSounds[i];
 		if (track.isActive) {
-			track.audioPlayerTrack = _vm->_audioPlayer->playAud(track.name, 1, track.pan, track.pan, 99, kAudioPlayerLoop | kAudioPlayerOverrideVolume);
+			Audio::Mixer::SoundType mixerAmbientSoundType = kAmbientSoundType;
+			if (track.soundType >= 0) {
+				mixerAmbientSoundType = (Audio::Mixer::SoundType) track.soundType;
+			}
+			track.audioPlayerTrack = _vm->_audioPlayer->playAud(track.name, 1, track.pan, track.pan, 99, kAudioPlayerLoop | kAudioPlayerOverrideVolume, mixerAmbientSoundType);
 			if (track.audioPlayerTrack == -1) {
 				removeLoopingSoundByIndex(i, 0u);
 			} else {
diff --git a/engines/bladerunner/ambient_sounds.h b/engines/bladerunner/ambient_sounds.h
index 14145a0c67..2c7723d0f3 100644
--- a/engines/bladerunner/ambient_sounds.h
+++ b/engines/bladerunner/ambient_sounds.h
@@ -24,6 +24,7 @@
 #define BLADERUNNER_AMBIENT_SOUNDS_H
 
 #include "audio/audiostream.h"
+#include "audio/mixer.h"
 
 #include "common/str.h"
 
@@ -34,8 +35,9 @@ class SaveFileReadStream;
 class SaveFileWriteStream;
 
 class AmbientSounds {
-	static const int kNonLoopingSounds = 25;
-	static const int kLoopingSounds = 3;
+	static const int kNonLoopingSounds                     = 25;
+	static const int kLoopingSounds                        = 3;
+	static const Audio::Mixer::SoundType kAmbientSoundType = Audio::Mixer::kSFXSoundType;
 
 	struct NonLoopingSound {
 		bool           isActive;
@@ -54,6 +56,7 @@ class AmbientSounds {
 		int            panEndMin;
 		int            panEndMax;
 		int            priority;
+		int32          soundType; // new - not stored in saved games
 	};
 
 	struct LoopingSound {
@@ -63,6 +66,7 @@ class AmbientSounds {
 		int            audioPlayerTrack;
 		int            volume;
 		int            pan;
+		int32          soundType; // new - not stored in saved games
 	};
 
 	BladeRunnerEngine *_vm;
@@ -93,10 +97,10 @@ public:
 		int panStartMin, int panStartMax,
 		int panEndMin, int panEndMax,
 		int priority, int unk);
-	void playSound(int sfxId, int volume, int panStart, int panEnd, int priority);
+	void playSound(int sfxId, int volume, int panStart, int panEnd, int priority, Audio::Mixer::SoundType type = kAmbientSoundType);
 	void playSpeech(int actorId, int sentenceId, int volume, int panStart, int panEnd, int priority);
 
-	void addLoopingSound(int sfxId, int volume, int pan, uint32 delaySeconds);
+	void addLoopingSound(int sfxId, int volume, int pan, uint32 delaySeconds, Audio::Mixer::SoundType type = kAmbientSoundType);
 	void adjustLoopingSound(int sfxId, int volume, int pan, uint32 delaySeconds);
 	// it seems there is little confusion in original code about delay parameter,
 	// sometimes it is used as boolean in same way as stopPlaying from non looping
diff --git a/engines/bladerunner/audio_player.cpp b/engines/bladerunner/audio_player.cpp
index dc283462e3..7ffb76c75f 100644
--- a/engines/bladerunner/audio_player.cpp
+++ b/engines/bladerunner/audio_player.cpp
@@ -48,6 +48,9 @@ AudioPlayer::AudioPlayer(BladeRunnerEngine *vm) {
 		_tracks[i].stream = nullptr;
 	}
 
+	// _sfxVolume here sets a percentage to be appied on the specified track volume
+	// before sending it to the audio player
+	// (setting _sfxVolume to 100 renders it indifferent)
 	_sfxVolume = BLADERUNNER_ORIGINAL_SETTINGS ? 65 : 100;
 }
 
@@ -89,9 +92,11 @@ void AudioPlayer::adjustPan(int track, int pan, uint32 delaySeconds) {
 	_vm->_audioMixer->adjustPan(_tracks[track].channel, pan, 60u * delaySeconds);
 }
 
-void AudioPlayer::setVolume(int volume) {
-	_sfxVolume = volume;
-}
+// We no longer set the _sfxVolume (audio player's default volume percent) via a public method
+// It is set in AudioPlayer::AudioPlayer() constructor and keeps its value constant.
+//void AudioPlayer::setVolume(int volume) {
+//	_sfxVolume = volume;
+//}
 
 int AudioPlayer::getVolume() const {
 	return _sfxVolume;
diff --git a/engines/bladerunner/audio_player.h b/engines/bladerunner/audio_player.h
index 4e0e3fcf6a..5846a869cf 100644
--- a/engines/bladerunner/audio_player.h
+++ b/engines/bladerunner/audio_player.h
@@ -48,6 +48,8 @@ class AudioPlayer {
 	// increase tracks, reduce probability of tracks being skipped
 	static const int kTracks = 12;
 #endif // BLADERUNNER_ORIGINAL_BUGS
+	// Use SFX sound type if none is specified
+	static const Audio::Mixer::SoundType kAudioPlayerSoundType = Audio::Mixer::kSFXSoundType;
 
 	struct Track {
 		bool                isActive;
@@ -68,7 +70,7 @@ public:
 	AudioPlayer(BladeRunnerEngine *vm);
 	~AudioPlayer();
 
-	int playAud(const Common::String &name, int volume, int panStart, int panEnd, int priority, byte flags = 0, Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType);
+	int playAud(const Common::String &name, int volume, int panStart, int panEnd, int priority, byte flags = 0, Audio::Mixer::SoundType type = kAudioPlayerSoundType);
 	bool isActive(int track) const;
 	uint32 getLength(int track) const;
 	void stop(int track, bool immediately);
@@ -76,7 +78,7 @@ public:
 	void adjustVolume(int track, int volume, uint32 delaySeconds, bool overrideVolume);
 	void adjustPan(int track, int pan, uint32 delaySeconds);
 
-	void setVolume(int volume);
+//	void setVolume(int volume);
 	int getVolume() const;
 	void playSample();
 
diff --git a/engines/bladerunner/audio_speech.cpp b/engines/bladerunner/audio_speech.cpp
index a181891a63..0ebc9aabeb 100644
--- a/engines/bladerunner/audio_speech.cpp
+++ b/engines/bladerunner/audio_speech.cpp
@@ -49,6 +49,9 @@ void AudioSpeech::mixerChannelEnded(int channel, void *data) {
 
 AudioSpeech::AudioSpeech(BladeRunnerEngine *vm) {
 	_vm = vm;
+	// _speechVolume here sets a percentage to be appied on the specified voice cue volume
+	// before sending it to the audio player
+	// (setting _speechVolume to 100 renders it indifferent)
 	_speechVolume = BLADERUNNER_ORIGINAL_SETTINGS ? 50 : 100;
 	_isActive = false;
 	_data = new byte[kBufferSize];
@@ -132,9 +135,11 @@ bool AudioSpeech::playSpeechLine(int actorId, int sentenceId, int volume, int a4
 	return _vm->_audioPlayer->playAud(name, _speechVolume * volume / 100, pan, pan, priority, kAudioPlayerOverrideVolume, Audio::Mixer::kSpeechSoundType);
 }
 
-void AudioSpeech::setVolume(int volume) {
-	_speechVolume = volume;
-}
+// We no longer set the _speechVolume (speech default volume percent) via a public method
+// It is set in AudioSpeech::AudioSpeech() constructor and keeps its value constant.
+//void AudioSpeech::setVolume(int volume) {
+//	_speechVolume = volume;
+//}
 
 int AudioSpeech::getVolume() const {
 	return _speechVolume;
diff --git a/engines/bladerunner/audio_speech.h b/engines/bladerunner/audio_speech.h
index 180995ce4f..4b49535348 100644
--- a/engines/bladerunner/audio_speech.h
+++ b/engines/bladerunner/audio_speech.h
@@ -51,7 +51,7 @@ public:
 
 	bool playSpeechLine(int actorId, int sentenceId, int volume, int a4, int priority);
 
-	void setVolume(int volume);
+//	void setVolume(int volume);
 	int getVolume() const;
 	void playSample();
 
diff --git a/engines/bladerunner/music.cpp b/engines/bladerunner/music.cpp
index ca35f623d6..97d6eed9db 100644
--- a/engines/bladerunner/music.cpp
+++ b/engines/bladerunner/music.cpp
@@ -34,6 +34,9 @@ namespace BladeRunner {
 
 Music::Music(BladeRunnerEngine *vm) {
 	_vm = vm;
+	// _musicVolume here sets a percentage to be appied on the specified track volume
+	// before sending it to the audio player
+	// (setting _musicVolume to 100 renders it indifferent)
 	_musicVolume = BLADERUNNER_ORIGINAL_SETTINGS ? 65 : 100;
 	reset();
 }
diff --git a/engines/bladerunner/outtake.cpp b/engines/bladerunner/outtake.cpp
index c7162e805d..8f9ea63cf4 100644
--- a/engines/bladerunner/outtake.cpp
+++ b/engines/bladerunner/outtake.cpp
@@ -97,40 +97,49 @@ void OuttakePlayer::play(const Common::String &name, bool noLocalization, int co
 			_vm->blitToScreen(_vm->_surfaceFront);
 			if (_vm->_cutContent && resName.equals("FLYTRU_E.VQA")) {
 				// This FLYTRU_E outtake has 150 frames
-				_vm->_ambientSounds->tick();
+				//
+				// We can have at most kLoopingSounds (3) looping ambient tracks
+				// Outtakes in general use a specific Mixer Sound Type (ie. VQAPlayer::kVQASoundType)
+				//      so the sounds here should conform too.
+				//     (see VQAPlayer::update())
+				//
+				// No need for _ambientSounds->tick() since it's not required for looping ambient tracks,
+				// nor for explicitly played Sounds (via playSound())
+				// It is harmless however, so it could remain.
+				//_vm->_ambientSounds->tick();
 				switch (frame) {
 				case 0:
-					_vm->_ambientSounds->addLoopingSound(kSfxLABAMB1,   95, 0, 0u);
-					_vm->_ambientSounds->addLoopingSound(kSfxROOFAIR1, 100, 0, 0u);
-					_vm->_ambientSounds->addLoopingSound(kSfxPSPA6,     74, 0, 1u);
+					_vm->_ambientSounds->addLoopingSound(kSfxLABAMB1,   95, 0, 0u, VQAPlayer::kVQASoundType);
+					_vm->_ambientSounds->addLoopingSound(kSfxROOFAIR1, 100, 0, 0u, VQAPlayer::kVQASoundType);
+					_vm->_ambientSounds->addLoopingSound(kSfxPSPA6,     74, 0, 1u, VQAPlayer::kVQASoundType);
 					break;
 				case 18:
-					_vm->_ambientSounds->playSound(kSfxSPIN2A, 100, 90, 20, 99);
+					_vm->_ambientSounds->playSound(kSfxSPIN2A, 100, 90, 20, 99, VQAPlayer::kVQASoundType);
 					break;
 				case 24:
-					_vm->_ambientSounds->playSound(kSfxSWEEP4, 45, 90, 20, 99);
+					_vm->_ambientSounds->playSound(kSfxSWEEP4, 45, 90, 20, 99, VQAPlayer::kVQASoundType);
 					break;
 				case 32:
 					if (_vm->_rnd.getRandomNumberRng(1, 5) < 4) 
-						_vm->_ambientSounds->playSound(kSfxTHNDER3, 82, -20, -20, 99);
+						_vm->_ambientSounds->playSound(kSfxTHNDER3, 82, -20, -20, 99, VQAPlayer::kVQASoundType);
 					break;
 				case 41:
-					_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(kSfxMUSVOL8), 22, 46, 46, 99, 0, Audio::Mixer::kMusicSoundType);
+					_vm->_ambientSounds->playSound(kSfxMUSVOL8, 22, 46, 46, 99, VQAPlayer::kVQASoundType);
 					break;
 				case 52:
 					if (_vm->_rnd.getRandomNumberRng(1, 4) < 4) 
-						_vm->_ambientSounds->playSound(kSfxTHNDR3, 90, 10, 10, 89);
+						_vm->_ambientSounds->playSound(kSfxTHNDR3, 90, 10, 10, 89, VQAPlayer::kVQASoundType);
 					break;
 				case 78:
 					if (_vm->_rnd.getRandomNumberRng(1, 5) < 5) 
-						_vm->_ambientSounds->playSound(kSfxSIREN2, 62, -60, 45, 99);
+						_vm->_ambientSounds->playSound(kSfxSIREN2, 62, -60, 45, 99, VQAPlayer::kVQASoundType);
 					break;
 				case 105:
-					_vm->_ambientSounds->playSound(kSfxSWEEP3, 22, 20, 95, 99);
+					_vm->_ambientSounds->playSound(kSfxSWEEP3, 22, 20, 95, 99, VQAPlayer::kVQASoundType);
 					break;
 				case 112:
 					if (_vm->_rnd.getRandomNumberRng(1, 5) < 4) 
-						_vm->_ambientSounds->playSound(kSfxTHNDER4, 95, -20, -20, 99);
+						_vm->_ambientSounds->playSound(kSfxTHNDER4, 95, -20, -20, 99, VQAPlayer::kVQASoundType);
 					break;
 				}
 			}
diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp
index b29cfde1f8..fd9783a42e 100644
--- a/engines/bladerunner/vqa_player.cpp
+++ b/engines/bladerunner/vqa_player.cpp
@@ -170,11 +170,10 @@ int VQAPlayer::update(bool forceDraw, bool advanceFrame, bool useTime, Graphics:
 					}
 				}
 				if (_vm->_mixer->isReady()) {
-					// Use speech sound type as in original engine
 					// Audio stream starts playing, consuming queued "audio frames"
 					// Note: On its own, the audio will not re-synch with video;
 					// It plays independently so it can get ahead!
-					_vm->_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_soundHandle, _audioStream);
+					_vm->_mixer->playStream(kVQASoundType, &_soundHandle, _audioStream);
 				}
 				_audioStarted = true;
 			}
diff --git a/engines/bladerunner/vqa_player.h b/engines/bladerunner/vqa_player.h
index 8b7efe6914..8d44cece9a 100644
--- a/engines/bladerunner/vqa_player.h
+++ b/engines/bladerunner/vqa_player.h
@@ -45,6 +45,7 @@ class ZBuffer;
 
 class VQAPlayer {
 	friend class Debugger;
+	friend class OuttakePlayer;
 
 	BladeRunnerEngine           *_vm;
 	Common::String               _name;
@@ -53,8 +54,10 @@ class VQAPlayer {
 	Audio::QueuingAudioStream   *_audioStream;
 	Graphics::Surface           *_surface;
 
-	static const uint32  kVqaFrameTimeDiff        = 4000; // 60 * 1000 / 15
-	static const int     kMaxAudioPreloadedFrames = 15;
+	static const uint32  kVqaFrameTimeDiff             = 4000; // 60 * 1000 / 15
+	static const int     kMaxAudioPreloadedFrames      = 15;
+	// Use speech sound type as in original engine
+	static const Audio::Mixer::SoundType kVQASoundType = Audio::Mixer::kSpeechSoundType;
 
 	int _frame;
 	int _frameNext;




More information about the Scummvm-git-logs mailing list