From ba3040ea0973b39d48dd25359a286118dc07b7d9 Mon Sep 17 00:00:00 2001 From: arcattack Date: Wed, 15 Jul 2026 23:16:27 -0500 Subject: [PATCH] Audio: footstep-chain diagnostics -- every link verified except the final trigger fire (task #50) Instrumentation (all BT_AUDIO_LOG/BT_AUDIO_SPATIAL-gated): mech watcher-poll probe (delayed flag + socket count via new Simulation::DebugAudioWatcherCount), per-sim audio-socket size in ExecuteWatchers, trigger notifications (val>0), watcher poll-rate/change probes, footstep pulse address trace. VERIFIED working: FootStep binds to the real member (pulse addr == bound ptr, same run); pulses fire per stride (40/run); the watcher registers on the mech (audioWatchers=20 after audio-object creation); the mech's poll runs (delayed=0, simFlags=0x1110); Logical == int (STYLE.H:132) matches the member type. The idle<->moving engine crossfade (AudioMotionScale on LocalVelocity through the restored watcher poll) is CONFIRMED audible in play. REMAINING: the FootFall transient still doesn't reach SetupPatch -- next probe is the trigger's streamed threshold/inverse config and the speed-scaled transient volume at the renderer drop gate (LowAudioVolumeThreshold=0.3). Co-Authored-By: Claude Opus 4.8 (1M context) --- engine/MUNGA/AUDWTHR.h | 2 +- engine/MUNGA/SIMULATE.cpp | 11 +++++++++++ engine/MUNGA/SIMULATE.h | 3 +++ game/reconstructed/mech4.cpp | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/engine/MUNGA/AUDWTHR.h b/engine/MUNGA/AUDWTHR.h index a57e59f..6e5974c 100644 --- a/engine/MUNGA/AUDWTHR.h +++ b/engine/MUNGA/AUDWTHR.h @@ -358,7 +358,7 @@ template void Check_Pointer(attribute_ptr); Scalar current_value = ExtractInterestingValue(attribute_ptr); - if (getenv("BT_AUDIO_SPATIAL")) { static int s_tg=0; if (s_tg++<80) + if (getenv("BT_AUDIO_SPATIAL") && current_value > 0.0f) { static int s_tg=0; if (s_tg++<120) DEBUG_STREAM << "[trigger] attrPtr=" << (void*)attributePointer << " val=" << current_value << " thresh=" << attributeValueThreshold << " armed=" << (int)!triggerOn << "\n" << std::flush; } diff --git a/engine/MUNGA/SIMULATE.cpp b/engine/MUNGA/SIMULATE.cpp index 33fe5c7..0d7d1ef 100644 --- a/engine/MUNGA/SIMULATE.cpp +++ b/engine/MUNGA/SIMULATE.cpp @@ -1,3 +1,4 @@ +#include #include "munga.h" #pragma hdrstop @@ -486,6 +487,14 @@ void //############################################################################# // Watcher Support // +int + Simulation::DebugAudioWatcherCount() +{ + SChainIteratorOf iterator(audioWatcherSocket); + return (int)iterator.GetSize(); +} + + void Simulation::ExecuteWatchers() { @@ -496,6 +505,8 @@ void // Audio { SChainIteratorOf iterator(audioWatcherSocket); + if (getenv("BT_AUDIO_SPATIAL")) { static int s_ec=0; if ((s_ec++ % 600)==0) + DEBUG_STREAM << "[watchpoll] sim=" << (void*)this << " audioSocket size=" << iterator.GetSize() << "\n" << std::flush; } while ((watcher = iterator.ReadAndNext()) != NULL) { watcher->Execute(); diff --git a/engine/MUNGA/SIMULATE.h b/engine/MUNGA/SIMULATE.h index ab8acf5..314fcdf 100644 --- a/engine/MUNGA/SIMULATE.h +++ b/engine/MUNGA/SIMULATE.h @@ -247,6 +247,9 @@ public: void ExecuteWatchers(); + int // DEBUG (BT_AUDIO_LOG): how many audio watchers are registered on this sim + DebugAudioWatcherCount(); + private: SChainOf audioWatcherSocket; diff --git a/game/reconstructed/mech4.cpp b/game/reconstructed/mech4.cpp index 6dbc8ec..925fc93 100644 --- a/game/reconstructed/mech4.cpp +++ b/game/reconstructed/mech4.cpp @@ -5205,6 +5205,10 @@ void // (AudioLogicalTrigger FootStep, AudioMotionScale/Trigger LocalVelocity, ...) // never executed -- only the PUSHED StateIndicator watchers fired. That's // why footsteps/motion-scaled sounds were silent while state sounds worked. [T0] + if (getenv("BT_AUDIO_LOG")) { static int s_wd=0; if ((s_wd++ % 300)==0) + DEBUG_STREAM << "[audio] mech watcher poll: delayed=" << (int)AreWatchersDelayed() << " audioWatchers=" << DebugAudioWatcherCount() + << " simFlags=0x" << std::hex << (unsigned)simulationFlags << std::dec + << "\n" << std::flush; } if (!AreWatchersDelayed()) ExecuteWatchers();