Audio: fix stuck MissileLoading loop -- ProjectileWeapon never reached a ready state (task #50)
The runaway loop the user heard was MissileLoading01: the ProjectileWeapon (SRM/ballistic) state machine set Firing(0)/Loading(3)/Jammed(5)/NoAmmo(7) but NEVER a ready/Loaded level, so at idle the launcher parked in Loading(3) forever. Its WeaponState audio (weaponAlarm, now StateIndicator-firing) therefore looped MissileLoading indefinitely -- the loop stops only when the alarm LEAVES the loading state. (The laser sibling was fine: the Emitter DOES reach Loaded when its charge tops off, so LaserACharge stopped.) Fix: in ProjectileWeaponSimulation's default (idle/ready) branch, drive the state from readiness -- Loaded(2, charge + ammo up = silent ready) once ReadyToFire, else Loading(3, reloading). SetLevel fires audio only on a real change, so this yields the natural Firing -> Loading(reload) -> Loaded(ready) cycle and the MissileLoading loop now stops when the launcher finishes reloading. Verified: weapon cycles Loading(3, recoil>0)->Loaded(2, recoil<=0); the only remaining continuous loop is EnginePower (correct). Fire path unchanged. Also: master volume default kept; richer BT_AUDIO_LOG StopNote/SetupPatch traces. 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
01261d72f3
commit
ea8555480e
@@ -205,7 +205,7 @@ void PatchLevelOfDetail::PlayNote(SourceSet sourceSet)
|
||||
|
||||
void PatchLevelOfDetail::StopNote(SourceSet sourceSet)
|
||||
{
|
||||
{ static int s_s=0; if (getenv("BT_AUDIO_LOG") && s_s++<30) DEBUG_STREAM << "[audio] StopNote count=" << sourceSet.count << " src0=" << (sourceSet.count>0?sourceSet.sources[0]:0) << "\n" << std::flush; }
|
||||
if (getenv("BT_AUDIO_LOG")) { static int s_s=0; if (s_s++<400) { DEBUG_STREAM << "[audio] StopNote"; for (int _i=0;_i<sourceSet.count;_i++) DEBUG_STREAM << " src=" << sourceSet.sources[_i]; DEBUG_STREAM << "\n" << std::flush; } }
|
||||
if (sourceSet.count >0 && sourceSet.sources != NULL)
|
||||
{
|
||||
alSourceStopv(sourceSet.count, sourceSet.sources);
|
||||
|
||||
Reference in New Issue
Block a user