[Scummvm-git-logs] scummvm master -> 4a3e074b7dc212500bc59fc206c7e1f690da9e13
fracturehill
noreply at scummvm.org
Tue Aug 22 18:09:46 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
67188041d7 NANCY: Pause all sounds in GMM and console
2deb31503a NANCY: Add sound_info console command
4a3e074b7d NANCY: Do not apply 3D effects to inappropriate sounds
Commit: 67188041d776c56378dc41f6c679e3eb3f38b8eb
https://github.com/scummvm/scummvm/commit/67188041d776c56378dc41f6c679e3eb3f38b8eb
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-08-22T21:08:17+03:00
Commit Message:
NANCY: Pause all sounds in GMM and console
Fixes an issue where some sounds would still play even
when the GMM or console were open.
Changed paths:
engines/nancy/sound.cpp
engines/nancy/sound.h
engines/nancy/state/scene.cpp
diff --git a/engines/nancy/sound.cpp b/engines/nancy/sound.cpp
index 7b75b3e92dc..fcbfb0138f3 100644
--- a/engines/nancy/sound.cpp
+++ b/engines/nancy/sound.cpp
@@ -398,6 +398,10 @@ void SoundManager::pauseSound(const Common::String &chunkName, bool pause) {
pauseSound(_commonSounds[chunkName], pause);
}
+void SoundManager::pauseAllSounds(bool pause) {
+ _mixer->pauseAll(pause);
+}
+
bool SoundManager::isSoundPlaying(uint16 channelID) const {
if (channelID >= _channels.size() || !_channels[channelID].stream)
return false;
diff --git a/engines/nancy/sound.h b/engines/nancy/sound.h
index 79776406bd4..05adab4462f 100644
--- a/engines/nancy/sound.h
+++ b/engines/nancy/sound.h
@@ -81,6 +81,7 @@ public:
void pauseSound(uint16 channelID, bool pause);
void pauseSound(const SoundDescription &description, bool pause);
void pauseSound(const Common::String &chunkName, bool pause);
+ void pauseAllSounds(bool pause);
bool isSoundPlaying(uint16 channelID) const;
bool isSoundPlaying(const SoundDescription &description) const;
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index bd951c96de9..68c2d73fae3 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -171,7 +171,13 @@ void Scene::onStateEnter(const NancyState::NancyState prevState) {
g_nancy->_cursorManager->setCursorItemID(getHeldItem());
}
- unpauseSceneSpecificSounds();
+
+ if (prevState == NancyState::kPause) {
+ g_nancy->_sound->pauseAllSounds(false);
+ } else {
+ unpauseSceneSpecificSounds();
+ }
+
g_nancy->_sound->stopSound("MSND");
}
}
@@ -182,7 +188,13 @@ bool Scene::onStateExit(const NancyState::NancyState nextState) {
}
_actionManager.onPause(true);
- pauseSceneSpecificSounds();
+
+ if (nextState == NancyState::kPause) {
+ g_nancy->_sound->pauseAllSounds(true);
+ } else {
+ pauseSceneSpecificSounds();
+ }
+
_gameStateRequested = NancyState::kNone;
// Re-register the clock so the open/close animation can continue playing inside Map
Commit: 2deb31503aad662029efd03734caed61a7d4fcf9
https://github.com/scummvm/scummvm/commit/2deb31503aad662029efd03734caed61a7d4fcf9
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-08-22T21:08:17+03:00
Commit Message:
NANCY: Add sound_info console command
Added a console command that displays info about
currently playing channels.
Changed paths:
engines/nancy/console.cpp
engines/nancy/console.h
engines/nancy/sound.h
diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index 52340522603..44f5914b5e0 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -49,7 +49,7 @@ NancyConsole::NancyConsole() : GUI::Debugger() {
registerCmd("chunk_list", WRAP_METHOD(NancyConsole, Cmd_chunkList));
registerCmd("show_image", WRAP_METHOD(NancyConsole, Cmd_showImage));
registerCmd("play_video", WRAP_METHOD(NancyConsole, Cmd_playVideo));
- registerCmd("play_audio", WRAP_METHOD(NancyConsole, Cmd_playAudio));
+ registerCmd("play_sound", WRAP_METHOD(NancyConsole, Cmd_playSound));
registerCmd("load_scene", WRAP_METHOD(NancyConsole, Cmd_loadScene));
registerCmd("scene_id", WRAP_METHOD(NancyConsole, Cmd_sceneID));
registerCmd("list_actionrecords", WRAP_METHOD(NancyConsole, Cmd_listActionRecords));
@@ -62,6 +62,7 @@ NancyConsole::NancyConsole() : GUI::Debugger() {
registerCmd("set_player_time", WRAP_METHOD(NancyConsole, Cmd_setPlayerTime));
registerCmd("get_difficulty", WRAP_METHOD(NancyConsole, Cmd_getDifficulty));
registerCmd("set_difficulty", WRAP_METHOD(NancyConsole, Cmd_setDifficulty));
+ registerCmd("sound_info", WRAP_METHOD(NancyConsole, Cmd_soundInfo));
}
@@ -371,7 +372,7 @@ bool NancyConsole::Cmd_loadCal(int argc, const char **argv) {
return true;
}
-bool NancyConsole::Cmd_playAudio(int argc, const char **argv) {
+bool NancyConsole::Cmd_playSound(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("Plays an audio file\n");
debugPrintf("Usage: %s <name>\n", argv[0]);
@@ -878,4 +879,47 @@ bool NancyConsole::Cmd_setDifficulty(int argc, const char **argv) {
return cmdExit(0, nullptr);
}
+bool NancyConsole::Cmd_soundInfo(int argc, const char **argv) {
+ if (g_nancy->getGameType() >= kGameTypeNancy3) {
+ const Math::Vector3d &pos = NancySceneState.getSceneSummary().listenerPosition;
+ const Math::Vector3d &or = g_nancy->_sound->_orientation;
+ debugPrintf("3D listener position: %f, %f, %f\n", pos.x(), pos.y(), pos.z());
+ debugPrintf("3D listener orientation: %f, %f, %f\n\n", or.x(), or.y(), or.z());
+ }
+
+ Common::Array<byte> channelIDs;
+ if (argc == 1) {
+ debugPrintf("Currently playing sounds:\n\n");
+
+ for (uint i = 0; i < g_nancy->getStaticData().soundChannelInfo.numChannels; ++i) {
+ channelIDs.push_back(i);
+ }
+ } else {
+ for (int i = 1; i < argc; ++i) {
+ channelIDs.push_back(atoi(argv[i]));
+ }
+ }
+
+ for (byte channelID : channelIDs) {
+ const auto &chan = g_nancy->_sound->_channels[channelID];
+
+ if (g_nancy->_sound->isSoundPlaying(channelID)) {
+ debugPrintf("Channel %u, filename %s\n", channelID, chan.name.c_str());
+ debugPrintf("Source rate %i, playing at %i\n", chan.stream->getRate(), g_nancy->_sound->_mixer->getChannelRate(chan.handle));
+ debugPrintf("Volume: %u, pan: %i, numLoops: %u\n\n", chan.volume, g_nancy->_sound->_mixer->getChannelBalance(chan.handle), chan.numLoops);
+
+ if (chan.playCommands != SoundManager::kPlaySequential) {
+ debugPrintf("\tPlay commands 0x%08x\n", chan.playCommands);
+
+ if (chan.effectData) {
+ debugPrintf("\tPosition: %f, %f, %f, ", chan.position.x(), chan.position.y(), chan.position.z());
+ debugPrintf("delta: %f, %f, %f\n\n", chan.positionDelta.x(), chan.positionDelta.y(), chan.positionDelta.z());
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
} // End of namespace Nancy
diff --git a/engines/nancy/console.h b/engines/nancy/console.h
index e8e93fd7d4e..99d1453b3ea 100644
--- a/engines/nancy/console.h
+++ b/engines/nancy/console.h
@@ -50,7 +50,7 @@ private:
bool Cmd_chunkList(int argc, const char **argv);
bool Cmd_showImage(int argc, const char **argv);
bool Cmd_playVideo(int argc, const char **argv);
- bool Cmd_playAudio(int argc, const char **argv);
+ bool Cmd_playSound(int argc, const char **argv);
bool Cmd_loadScene(int argc, const char **argv);
bool Cmd_sceneID(int argc, const char **argv);
bool Cmd_listActionRecords(int argc, const char **argv);
@@ -63,6 +63,7 @@ private:
bool Cmd_setPlayerTime(int argc, const char **argv);
bool Cmd_getDifficulty(int argc, const char **argv);
bool Cmd_setDifficulty(int argc, const char **argv);
+ bool Cmd_soundInfo(int argc, const char **argv);
void recurseDependencies(const Nancy::Action::DependencyRecord &record);
diff --git a/engines/nancy/sound.h b/engines/nancy/sound.h
index 05adab4462f..d4c87e0e285 100644
--- a/engines/nancy/sound.h
+++ b/engines/nancy/sound.h
@@ -38,10 +38,11 @@ class QueuingAudioStream;
namespace Nancy {
class IFF;
-
+class NancyConsole;
class NancyEngine;
class SoundManager {
+ friend class NancyConsole;
public:
// Settings for playing a sound, used in nancy3 and up
// Older versions had a different, non-bitflag enum, but testing
Commit: 4a3e074b7dc212500bc59fc206c7e1f690da9e13
https://github.com/scummvm/scummvm/commit/4a3e074b7dc212500bc59fc206c7e1f690da9e13
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-08-22T21:08:17+03:00
Commit Message:
NANCY: Do not apply 3D effects to inappropriate sounds
Added a missing check without which some sounds that
weren't marked as 3D would still get positioned in space.
Changed paths:
engines/nancy/sound.cpp
diff --git a/engines/nancy/sound.cpp b/engines/nancy/sound.cpp
index fcbfb0138f3..1d59397b554 100644
--- a/engines/nancy/sound.cpp
+++ b/engines/nancy/sound.cpp
@@ -686,7 +686,9 @@ void SoundManager::soundEffectMaintenance(uint16 channelID) {
}
// Panning/volume/rate adjustment used in nancy3 and up. Originally handled by DirectSound 3D
- if (g_nancy->getGameType() >= 3 && chan.effectData) {
+ if (g_nancy->getGameType() >= 3 && chan.effectData &&
+ (chan.playCommands & ~kPlaySequential) & (kPlaySequentialFrameAnchor | kPlayRandomPosition | kPlayMoveLinear)) {
+
const Math::Vector3d &listenerPos = NancySceneState.getSceneSummary().listenerPosition;
float dist = listenerPos.getDistanceTo(chan.position);
float volume;
More information about the Scummvm-git-logs
mailing list