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
@@ -174,6 +174,10 @@ void
|
||||
|
||||
if (audio_source->IsAudioSourceClipped(GetAudioHead()))
|
||||
{
|
||||
if (getenv("BT_AUDIO_SPATIAL")) { static int s_cl=0; if (s_cl++<40)
|
||||
DEBUG_STREAM << "[spatial] CLIPPED src=" << (void*)audio_source
|
||||
<< " headPos=(" << GetAudioHead()->GetHeadEntity()->localOrigin.linearPosition.x
|
||||
<< "," << GetAudioHead()->GetHeadEntity()->localOrigin.linearPosition.z << ")\n" << std::flush; }
|
||||
//
|
||||
// If it is a transient source then ignore request
|
||||
//
|
||||
@@ -181,7 +185,7 @@ void
|
||||
{
|
||||
#ifdef LAB_ONLY
|
||||
sourceClippedCount++;
|
||||
#endif
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
audio_source_priority = audio_source->GetAudioSourcePriority();
|
||||
@@ -191,6 +195,11 @@ void
|
||||
{
|
||||
audio_source_priority = audio_source->GetAudioSourcePriority();
|
||||
audio_source_volume_scale = audio_source->CalculateSourceVolumeScale();
|
||||
if (getenv("BT_AUDIO_SPATIAL")) { static int s_vs=0; if ((s_vs++ % 120)==0)
|
||||
DEBUG_STREAM << "[spatial] request src=" << (void*)audio_source
|
||||
<< " vol=" << audio_source_volume_scale
|
||||
<< " headPos=(" << GetAudioHead()->GetHeadEntity()->localOrigin.linearPosition.x
|
||||
<< "," << GetAudioHead()->GetHeadEntity()->localOrigin.linearPosition.z << ")\n" << std::flush; }
|
||||
}
|
||||
|
||||
//
|
||||
@@ -205,11 +214,19 @@ void
|
||||
audio_source_volume_scale < LowAudioVolumeThreshold
|
||||
)
|
||||
{
|
||||
if (getenv("BT_AUDIO_SPATIAL")) { static int s_dr=0; if (s_dr++<40)
|
||||
DEBUG_STREAM << "[spatial] DROP transient start src=" << (void*)audio_source
|
||||
<< " vol=" << audio_source_volume_scale
|
||||
<< " (below threshold " << LowAudioVolumeThreshold << ")\n" << std::flush; }
|
||||
#ifdef LAB_ONLY
|
||||
sourceClippedCount++;
|
||||
#endif
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (getenv("BT_AUDIO_SPATIAL") && message->controlID == StartAudioControlID) {
|
||||
static int s_st=0; if (s_st++<40)
|
||||
DEBUG_STREAM << "[spatial] START request src=" << (void*)audio_source
|
||||
<< " vol=" << audio_source_volume_scale << "\n" << std::flush; }
|
||||
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <cstdlib>
|
||||
#include "munga.h"
|
||||
#pragma hdrstop
|
||||
|
||||
@@ -416,6 +417,12 @@ AudioControlValue
|
||||
volume_scale;
|
||||
|
||||
volume_scale = volumeScale * volumeMixScale * volumeCompressionScale;
|
||||
if (getenv("BT_AUDIO_SPATIAL") && volume_scale <= 0.0f) {
|
||||
static int s_z=0; if (s_z++<40)
|
||||
DEBUG_STREAM << "[spatial] vol=0 breakdown src=" << (void*)this
|
||||
<< " volumeScale=" << volumeScale
|
||||
<< " mixScale=" << volumeMixScale
|
||||
<< " compression=" << volumeCompressionScale << "\n" << std::flush; }
|
||||
Clamp(volume_scale, MinAudioVolume, MaxAudioVolume);
|
||||
return volume_scale;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <cstdlib>
|
||||
|
||||
#include "watcher.h"
|
||||
#include "audio.h"
|
||||
@@ -357,6 +358,10 @@ template <class T> 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)
|
||||
DEBUG_STREAM << "[trigger] attrPtr=" << (void*)attributePointer
|
||||
<< " val=" << current_value << " thresh=" << attributeValueThreshold
|
||||
<< " armed=" << (int)!triggerOn << "\n" << std::flush; }
|
||||
if (triggerOn)
|
||||
{
|
||||
if (
|
||||
@@ -625,6 +630,11 @@ template <class T> void
|
||||
|
||||
Check(&audioComponentSocket);
|
||||
Check(audioComponentSocket.GetCurrent());
|
||||
if (getenv("BT_AUDIO_SPATIAL") && control_value <= 0.0f) {
|
||||
static int s_sc=0; if (s_sc++<40)
|
||||
DEBUG_STREAM << "[spatial] scale->0 attrPtr=" << (void*)attributePointer
|
||||
<< " raw=" << current_value << " ctlID=" << (int)controlID
|
||||
<< " ctl=" << control_value << "\n" << std::flush; }
|
||||
audioComponentSocket.GetCurrent()->ReceiveControl(
|
||||
controlID,
|
||||
control_value
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <cstdlib>
|
||||
|
||||
#include "cmpnnt.h"
|
||||
#include "slot.h"
|
||||
@@ -262,8 +263,14 @@ template <class T> void
|
||||
Check(this);
|
||||
|
||||
Check_Pointer(attributePointer);
|
||||
if (getenv("BT_AUDIO_SPATIAL")) { // poll-rate probe: total watcher polls + change events
|
||||
static long s_polls=0; if ((++s_polls % 2000)==0)
|
||||
DEBUG_STREAM << "[watchpoll] total polls=" << s_polls << "\n" << std::flush;
|
||||
}
|
||||
if (!(currentValue == *(T*)attributePointer))
|
||||
{
|
||||
if (getenv("BT_AUDIO_SPATIAL")) { static int s_chg=0; if (s_chg++<60)
|
||||
DEBUG_STREAM << "[watchpoll] CHANGE attrPtr=" << (void*)attributePointer << "\n" << std::flush; }
|
||||
#if DEBUG_LEVEL>0
|
||||
if (dumpValue)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <cstdlib>
|
||||
#include "mungal4.h"
|
||||
#pragma hdrstop
|
||||
|
||||
@@ -1076,6 +1077,9 @@ void
|
||||
Check(audio_renderer);
|
||||
AudioHead *audio_head = audio_renderer->GetAudioHead();
|
||||
Check(audio_head);
|
||||
if (getenv("BT_AUDIO_SPATIAL")) { static int s_dp=0; if ((s_dp++ % 120)==0)
|
||||
DEBUG_STREAM << "[spatial] direct src=" << (channelSet.count>0?channelSet.sources[0]:0)
|
||||
<< " vol=" << volume_scale << "\n" << std::flush; }
|
||||
for (int i=0; i < channelSet.count; i++)
|
||||
{
|
||||
alSourcef(channelSet.sources[i],AL_MAX_DISTANCE,audio_location->getMaxDistance(audio_head));
|
||||
@@ -1408,6 +1412,12 @@ void
|
||||
double relativePitch = pow(2.0,pitch_offset/1200.0);
|
||||
Clamp(relativePitch,0.5,2.0);
|
||||
|
||||
if (getenv("BT_AUDIO_SPATIAL")) { static int s_sp=0; if ((s_sp++ % 120) == 0)
|
||||
DEBUG_STREAM << "[spatial] dyn src=" << (channelSet.count>0?channelSet.sources[0]:0)
|
||||
<< " head=(" << headPosition.x << "," << headPosition.z << ")"
|
||||
<< " loc=(" << locationPosition.x << "," << locationPosition.z << ")"
|
||||
<< " dist=" << posMag << " vol=" << volume_scale << "\n" << std::flush; }
|
||||
|
||||
for (int i=0; i < channelSet.count; i++)
|
||||
{
|
||||
alSource3f(channelSet.sources[i],AL_POSITION,pos.x,pos.y,pos.z);
|
||||
|
||||
Reference in New Issue
Block a user