Audio: restore the dropped ExecuteWatchers poll -- polled audio watchers were ALL dead (task #50)
User: "when I start moving all the sounds fade away, no footsteps." Diagnosis chain (all empirical, BT_AUDIO_SPATIAL/BT_ATTRBIND_LOG traces): - The audio head DOES track the mech (listener-relative positioning verified while driving) -- not a spatial bug. - The idle sounds correctly STOP on leaving the standing state; the MOVING sounds never started because every POLLED audio watcher was dead: the reconstructed Mech::PerformAndWatch replaced the engine performance but dropped the ExecuteWatchers() step from the engine tail (Simulation:: PerformAndWatch = Perform -> ExecuteWatchers -> WriteSimulationUpdate). Only PUSHED StateIndicator watchers (SetState->Execute) ever fired -- which is exactly why state sounds worked but footsteps/motion-scaled audio didn't. FIX: poll ExecuteWatchers() (AreWatchersDelayed-gated) before the update write. Immediately unlocks the polled family: MissileLoaded01/LaserLoaded01 ready dings, ProgramButton01, motion scales (PlayNote 15 -> 30 per run). - FootStep (0x1e) backed REAL: was the inert attrPad (an AudioLogicalTrigger polls it -- threshold-crossing pulse per foot plant). New footStep member, pulsed by SetBodyAnimation on entering any locomotion clip 1..0x17 (runtime stride alternation MEASURED as body states 12<->13 -- the enum-name numbering does not match runtime clip ids), decayed by IntegrateMotion (~1/3 s). - Footstep volume is speed-scaled (AudioMotionScale on LocalVelocity): at standstill the transient start computes volume 0 and the renderer drops it (LowAudioVolumeThreshold) -- so footfalls are audible at real walking speed. Diagnostics kept (BT_AUDIO_SPATIAL): spatial dist/vol per source, CLIPPED/DROP/ START at the request gate, vol=0 factor breakdown, scale->0 sends, trigger notifications, watcher poll-rate probe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ea8555480e
commit
744ef8cc16
@@ -711,7 +711,7 @@ const Mech::IndexEntry
|
||||
ATTRIBUTE_ENTRY(Mech, MaxRunSpeed, reverseStrideLength), // 0x1b (existing @0x34c = run/top speed)
|
||||
ATTRIBUTE_ENTRY(Mech, EyepointRotation, eyepointRotation), // 0x1c (real member -- the eye reads it per frame)
|
||||
ATTRIBUTE_ENTRY(Mech, TargetReticle, targetReticle), // 0x1d (real Reticle struct -- task #36)
|
||||
ATTRIBUTE_ENTRY(Mech, FootStep, attrPad), // 0x1e
|
||||
ATTRIBUTE_ENTRY(Mech, FootStep, footStep), // 0x1e real pulse (AudioLogicalTrigger; one rising edge per foot plant)
|
||||
ATTRIBUTE_ENTRY(Mech, AnimationState, animationState), // 0x1f real StateIndicator (audio state-watcher binds + AddAudioWatcher)
|
||||
ATTRIBUTE_ENTRY(Mech, ReplicantAnimationState, replicantAnimationState), // 0x20 real StateIndicator
|
||||
ATTRIBUTE_ENTRY(Mech, LinearSpeed, linearSpeed), // 0x21 (live forward speed)
|
||||
@@ -923,6 +923,8 @@ Mech::Mech(
|
||||
collisionState = StateIndicator(4); // CollisionStateCount
|
||||
collisionState.SetState(0); // NoCollisionState
|
||||
collisionTemporaryState = 0;
|
||||
footStep = 0; // FootStep pulse (audio trigger)
|
||||
footStepDecay = 0;
|
||||
radarRange = 1000.0f; // radar display scale (SetTargetRange is stubbed;
|
||||
// 1km default zoom so contacts within ~500m show on
|
||||
// the radar, vs the config maximum_range=4000 edge)
|
||||
|
||||
@@ -841,6 +841,14 @@ protected:
|
||||
// scrape sounds). Driven from ProcessCollision via collisionTemporaryState:
|
||||
// NoCollision(0)/InitialHit(1)/Slide(2)/Rest(3) (RP VTV CollisionStateCount).
|
||||
StateIndicator collisionState;
|
||||
// 0x1e FootStep -- audio binds an AudioLogicalTrigger (threshold-crossing
|
||||
// with hysteresis: rise past threshold -> play the step, fall back -> re-arm).
|
||||
// Backed by a real pulse: SetBodyAnimation raises it 1 on entering a cyclic
|
||||
// stride clip (each walk/run/reverse alternation == one foot plant) and the
|
||||
// per-frame motion tick decays it back to 0 a few frames later, giving one
|
||||
// clean rising edge per step. [T2]
|
||||
int footStep; // the Logical the trigger polls (1 = contact)
|
||||
int footStepDecay; // frames until the pulse clears
|
||||
// Radar/map gauge attributes (binary @0x404/0x408/0x40c/0x3f8). The map
|
||||
// widget reads position/angle as POINTERS into the mech's live origin, so
|
||||
// radarLinearPosition/radarAngularPosition point at localOrigin.{linear,
|
||||
|
||||
@@ -249,6 +249,22 @@ void
|
||||
animationState.SetState(state);
|
||||
replicantAnimationState.SetState(state);
|
||||
}
|
||||
|
||||
// FootStep pulse: every locomotion-clip transition is one foot plant (the
|
||||
// stride R<->L alternation -- MEASURED at runtime: forward walking alternates
|
||||
// body states 12<->13, so the enum-name numbering above does NOT match the
|
||||
// runtime clip ids; key on the locomotion RANGE instead). Clips 1..0x17 are
|
||||
// the gait cycle (stand-to-walk through gimp); 0 = standing, >= 0x18 = falls/
|
||||
// knockdown/death (those get collision/fall audio, not a step). Raise the
|
||||
// Logical the FootStep AudioLogicalTrigger polls; IntegrateMotion decays it
|
||||
// back to 0 a few frames later so each step is a clean rising edge. [T2]
|
||||
if (state >= 1 && state <= 0x17)
|
||||
{
|
||||
footStep = 1;
|
||||
footStepDecay = 20; // ~1/3s: outlives the watcher poll cadence (still < stride period)
|
||||
if (getenv("BT_AUDIO_LOG")) { static int s_fs=0; if (s_fs++<40)
|
||||
DEBUG_STREAM << "[audio] footstep pulse (clip " << state << ") addr=" << (void*)&footStep << "\n" << std::flush; }
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -292,6 +292,11 @@ Logical
|
||||
// Choose this frame's forward-cycle slew rate.
|
||||
forwardCycleRate = airborneSelect ? airborneCycleRate : groundCycleRate; // 0x344<-0x5bc/0x5b8
|
||||
|
||||
// FootStep pulse decay (see SetBodyAnimation): clear the contact flag a few
|
||||
// frames after the plant so the AudioLogicalTrigger re-arms for the next step.
|
||||
if (footStepDecay > 0 && --footStepDecay == 0)
|
||||
footStep = 0;
|
||||
|
||||
if (IsDisabled()) // FUN_0049fb54
|
||||
{
|
||||
ReconQuatIdentity(&angularAccum, &kIdentityQuat); // was raw this+0x298 (stomped projectedVelocity)
|
||||
@@ -5193,6 +5198,16 @@ void
|
||||
// writer re-dispatches SetBodyAnimation on the WRITER -- the real-clock crash
|
||||
// rode this path with legAnimationState still 0xCDCDCDCD). Discard replicant
|
||||
// marks instead.
|
||||
// WATCHER POLL (engine Simulation::PerformAndWatch tail, SIMULATE.cpp:460):
|
||||
// the engine path ends Perform() -> ExecuteWatchers() -> WriteSimulationUpdate().
|
||||
// This reconstruction replaced the whole performance but DROPPED the
|
||||
// ExecuteWatchers() step, so the entity-level POLLED audio watchers
|
||||
// (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 (!AreWatchersDelayed())
|
||||
ExecuteWatchers();
|
||||
|
||||
if (GetInstance() != ReplicantInstance)
|
||||
WriteSimulationUpdate(update_stream);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user