diff --git a/engine/MUNGA_L4/L4AUDRND.cpp b/engine/MUNGA_L4/L4AUDRND.cpp index a1b5a71..87c589a 100644 --- a/engine/MUNGA_L4/L4AUDRND.cpp +++ b/engine/MUNGA_L4/L4AUDRND.cpp @@ -1307,6 +1307,25 @@ Logical //Do we have enough? int requested = source_request->count; + // SOURCE-POOL CENSUS (field 2026-07-23: "audio cutting in and out toward + // the end of the match"). OpenAL's mixing capacity is finite; sources + // release only at entity teardown, so long matches accumulate looping + // occupants (wreck burn/smoke) until transients lose the voice fight. + // Track generated/deleted/failed and print a 30s health line + EVERY + // acquisition failure (rare + the smoking gun). + extern long gBTAudioSourcesLive, gBTAudioAcquireFails; + { + static unsigned long s_censusAt = 0; + unsigned long now_ms = GetTickCount(); + if (now_ms - s_censusAt > 30000) + { + s_censusAt = now_ms; + DEBUG_STREAM << "[audio] source census: live=" << gBTAudioSourcesLive + << " acquireFails=" << gBTAudioAcquireFails + << std::endl << std::flush; + } + } + // Gitea #12: hard cap at the SourceSet capacity so alGenSources can never // write past sources[] (the death-crash heap overflow). count is set from // the streamed voiceCount and is normally already clamped in the @@ -1323,6 +1342,8 @@ Logical if (!alIsSource(source_request->sources[i])) { alGenSources(1, source_request->sources + i); + if (alIsSource(source_request->sources[i])) + ++gBTAudioSourcesLive; } } @@ -1334,6 +1355,12 @@ Logical if (failed) { + ++gBTAudioAcquireFails; + DEBUG_STREAM << "[audio] ACQUIRE FAILED (requested=" << requested + << " live=" << gBTAudioSourcesLive + << " fails=" << gBTAudioAcquireFails + << ") -- the pool is exhausted; expect dropouts" + << std::endl << std::flush; return False; } @@ -1413,10 +1440,16 @@ Logical return True;*/ } +long gBTAudioSourcesLive = 0; +long gBTAudioAcquireFails = 0; + void L4AudioRenderer::ReleaseSourceSet(SourceSet &sourceSet) { + extern long gBTAudioSourcesLive; for (int i = 0; i < sourceSet.count; i++) { + if (alIsSource(sourceSet.sources[i])) + --gBTAudioSourcesLive; ALenum state; alGetSourcei(sourceSet.sources[i], AL_SOURCE_STATE, &state); diff --git a/game/reconstructed/projweap.cpp b/game/reconstructed/projweap.cpp index 8b6964d..dfa62aa 100644 --- a/game/reconstructed/projweap.cpp +++ b/game/reconstructed/projweap.cpp @@ -714,8 +714,7 @@ void DEBUG_STREAM << "[weap] " << GetName() << " JAMMED (T=" << currentTemperature << "/" << failureTemperature << " heatAlarm=" << (int)heatAlarm.GetLevel() - << ") -- permanent until mission end -" << std::flush; + << ") -- permanent until mission end\n" << std::flush; weaponAlarm.SetLevel(JammedState); // @4bbf34 -> 5 } else