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

antoniou79 antoniou at cti.gr
Wed Mar 27 11:42:30 CET 2019


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:
bb719ba87c BLADERUNNER: Fix missing sound effects in some occassions


Commit: bb719ba87c5d370c3a62a660118b6cb58576b61b
    https://github.com/scummvm/scummvm/commit/bb719ba87c5d370c3a62a660118b6cb58576b61b
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-03-27T12:39:24+02:00

Commit Message:
BLADERUNNER: Fix missing sound effects in some occassions

LABBUZZ sound for the maze and Animoid sounds

Moved lab buzz in next scene's (PS10) init, and increased size of track buffer to compensate for frequently dropping sounds in places with mayne sound effects (eg Animoid Row, Izo's door and trapdoor)

Changed paths:
    engines/bladerunner/audio_mixer.cpp
    engines/bladerunner/audio_mixer.h
    engines/bladerunner/audio_player.cpp
    engines/bladerunner/audio_player.h
    engines/bladerunner/script/scene/ps10.cpp
    engines/bladerunner/script/scene/ps15.cpp


diff --git a/engines/bladerunner/audio_mixer.cpp b/engines/bladerunner/audio_mixer.cpp
index b1562f3..df3a361 100644
--- a/engines/bladerunner/audio_mixer.cpp
+++ b/engines/bladerunner/audio_mixer.cpp
@@ -28,6 +28,7 @@
 #include "audio/mixer.h"
 
 #include "common/timer.h"
+//#include "common/debug.h"
 
 namespace BladeRunner {
 
@@ -64,8 +65,10 @@ int AudioMixer::play(Audio::Mixer::SoundType type, Audio::RewindableAudioStream
 	}
 	if (channel == -1) {
 		if (priority < lowestPriority) {
+			//debug("No available audio channel found - giving up");
 			return -1;
 		}
+		//debug("Stopping lowest priority channel %d with lower prio %d!", lowestPriorityChannel, lowestPriority);
 		stop(lowestPriorityChannel, 0);
 		channel = lowestPriorityChannel;
 	}
diff --git a/engines/bladerunner/audio_mixer.h b/engines/bladerunner/audio_mixer.h
index ca4b480..ce7040b 100644
--- a/engines/bladerunner/audio_mixer.h
+++ b/engines/bladerunner/audio_mixer.h
@@ -33,9 +33,9 @@ namespace BladeRunner {
 class BladeRunnerEngine;
 
 class AudioMixer {
-	static const int kChannels = 9;
-	static const int kUsableChannels = 8;
-	static const int kMusicChannel = 8;
+	static const int kChannels         = 15; // original was 9;
+	static const int kUsableChannels   = 14; // original was 8;
+	static const int kMusicChannel     = 14; // original was 8;
 	static const int kUpdatesPerSecond = 40;
 
 	struct Channel {
diff --git a/engines/bladerunner/audio_player.cpp b/engines/bladerunner/audio_player.cpp
index 4507506..8673fab 100644
--- a/engines/bladerunner/audio_player.cpp
+++ b/engines/bladerunner/audio_player.cpp
@@ -41,7 +41,7 @@ namespace BladeRunner {
 AudioPlayer::AudioPlayer(BladeRunnerEngine *vm) {
 	_vm = vm;
 
-	for (int i = 0; i != 6; ++i) {
+	for (int i = 0; i != kTracks; ++i) {
 		_tracks[i].priority = 0;
 		_tracks[i].isActive = false;
 		_tracks[i].channel = -1;
@@ -138,8 +138,9 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in
 	int lowestPriority = 1000000;
 	int lowestPriorityTrack = -1;
 
-	for (int i = 0; i != 6; ++i) {
+	for (int i = 0; i != kTracks; ++i) {
 		if (!isActive(i)) {
+			//debug ("Assigned track %i to %s", i, name.c_str());
 			track = i;
 			break;
 		}
@@ -154,12 +155,14 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in
 	 * the new priority
 	 */
 	if (track == -1 && lowestPriority < priority) {
+		//debug ("Stop lowest priority  track (with lower prio: %d %d), for %s %d!", lowestPriorityTrack, lowestPriority, name.c_str(), priority);
 		stop(lowestPriorityTrack, true);
 		track = lowestPriorityTrack;
 	}
 
 	/* If there's still no available track, give up */
 	if (track == -1) {
+		//debug ("No available track for %s %d - giving up", name.c_str(), priority);
 		return -1;
 	}
 
@@ -168,6 +171,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in
 	if (!_vm->_audioCache->findByHash(hash)) {
 		Common::SeekableReadStream *r = _vm->getResourceStream(name);
 		if (!r) {
+			//debug ("Could not get stream for %s %d - giving up", name.c_str(), priority);
 			return -1;
 		}
 
@@ -175,6 +179,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in
 		while (!_vm->_audioCache->canAllocate(size)) {
 			if (!_vm->_audioCache->dropOldest()) {
 				delete r;
+				//debug ("No available mem in cache for %s %d - giving up", name.c_str(), priority);
 				return -1;
 			}
 		}
@@ -201,6 +206,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in
 
 	if (channel == -1) {
 		delete audioStream;
+		//debug ("No available channel for %s %d - giving up", name.c_str(), priority);
 		return -1;
 	}
 
diff --git a/engines/bladerunner/audio_player.h b/engines/bladerunner/audio_player.h
index 580bdbc..8fb3c48 100644
--- a/engines/bladerunner/audio_player.h
+++ b/engines/bladerunner/audio_player.h
@@ -41,7 +41,7 @@ enum AudioPlayerFlags {
 };
 
 class AudioPlayer {
-	static const int kTracks = 6;
+	static const int kTracks = 12; // original was 6
 
 	struct Track {
 		bool                isActive;
diff --git a/engines/bladerunner/script/scene/ps10.cpp b/engines/bladerunner/script/scene/ps10.cpp
index eadcea5..e2cbb5e 100644
--- a/engines/bladerunner/script/scene/ps10.cpp
+++ b/engines/bladerunner/script/scene/ps10.cpp
@@ -416,6 +416,11 @@ void SceneScriptPS10::InitializeScene() {
 	Ambient_Sounds_Add_Sound(306,  5, 100, 17, 27, -100, 100, -101, -101, 0, 0);
 	Ambient_Sounds_Add_Sound(307,  5, 100, 17, 27, -100, 100, -101, -101, 0, 0);
 	Ambient_Sounds_Add_Sound(308,  5, 100, 17, 27, -100, 100, -101, -101, 0, 0);
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
+	// Moved here from PS15
+	Sound_Play(155, 90, 0, 0, 50);  // LABBUZZ1.AUD
+#endif // BLADERUNNER_ORIGINAL_BUGS
 }
 
 void SceneScriptPS10::SceneLoaded() {
diff --git a/engines/bladerunner/script/scene/ps15.cpp b/engines/bladerunner/script/scene/ps15.cpp
index def00bf..c8405e0 100644
--- a/engines/bladerunner/script/scene/ps15.cpp
+++ b/engines/bladerunner/script/scene/ps15.cpp
@@ -123,7 +123,12 @@ bool SceneScriptPS15::ClickedOnExit(int exitId) {
 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -183.58f, -113.43f, 91.7f, 0, true, false, 0)) {
 			Actor_Says(kActorMcCoy, 4440, 18);
 			Actor_Says(kActorSergeantWalls, 150, 17);
-			Sound_Play(155, 90, 0, 0, 50);
+#if BLADERUNNER_ORIGINAL_BUGS
+			// Sometimes the scene transition code (or the Ambient_Sounds_Remove_All_Non_Looping_Sounds)
+			// would stop this from playing (rare occasions)
+			// Solution: moved into PS10 code
+			Sound_Play(155, 90, 0, 0, 50);  // LABBUZZ1.AUD
+#endif // BLADERUNNER_ORIGINAL_BUGS
 			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
 			Ambient_Sounds_Remove_All_Looping_Sounds(1);
 			Set_Enter(kSetPS10_PS11_PS12_PS13, kScenePS10);





More information about the Scummvm-git-logs mailing list