Cut 5d-1: Haven audio curation, WetMix PcmSynth, WalkerFootstepTracker & ArenaAudioSystem
This commit is contained in:
parent
9081d2bb5c
commit
7f811c3011
41 changed files with 3067 additions and 10 deletions
|
|
@ -1283,6 +1283,116 @@ public partial class Smoke : Node
|
|||
Check(remoteIface.LocalContender.Alive, "Expected loopback RemoteArenaSession LocalContender alive");
|
||||
}
|
||||
|
||||
// 14. Cut 5d-1: Headless AudioBank, voice-cap/priority/dedupe, and mass-scaled GRF footstep pitch falsification
|
||||
{
|
||||
var audio = _main.Audio;
|
||||
audio.EnsureInitialized();
|
||||
Check(audio.Bank.HavenClipCount == 25, $"Expected 25 curated Haven clips in ProceduralAudioBank, got {audio.Bank.HavenClipCount}");
|
||||
Check(audio.Bank.ProceduralClipCount == 18, $"Expected 18 procedural clips in ProceduralAudioBank, got {audio.Bank.ProceduralClipCount}");
|
||||
|
||||
audio.ClearAll();
|
||||
audio.ResetStatsForTest();
|
||||
var localC = _main.Session.LocalContender;
|
||||
Vector3 listener = new(localC.X, localC.Y, localC.Z);
|
||||
|
||||
var burstEvents = new List<ISimEvent>();
|
||||
// Local player shot first (priority 10)
|
||||
burstEvents.Add(new ShotFiredEvent
|
||||
{
|
||||
TracerId = 90001,
|
||||
IsSpectatorShooter = false,
|
||||
ShooterId = _main.Session.LocalContenderId,
|
||||
StartX = listener.X,
|
||||
StartY = listener.Y + 1f,
|
||||
StartZ = listener.Z,
|
||||
EndX = listener.X + 40f,
|
||||
EndY = listener.Y + 1f,
|
||||
EndZ = listener.Z,
|
||||
WeaponClass = (byte)WeaponVisualClass.KineticLight,
|
||||
WeaponId = "mg_762"
|
||||
});
|
||||
|
||||
// 5-pellet flak salvo from contender 1 -> must dedupe to 1 audio voice
|
||||
for (int p = 0; p < 5; p++)
|
||||
{
|
||||
burstEvents.Add(new ShotFiredEvent
|
||||
{
|
||||
TracerId = 90010 + p,
|
||||
IsSpectatorShooter = false,
|
||||
ShooterId = 1,
|
||||
StartX = listener.X + 18f,
|
||||
StartY = listener.Y + 1f,
|
||||
StartZ = listener.Z,
|
||||
EndX = listener.X,
|
||||
EndY = listener.Y + 1f,
|
||||
EndZ = listener.Z,
|
||||
WeaponClass = (byte)WeaponVisualClass.Explosive,
|
||||
WeaponId = "flak"
|
||||
});
|
||||
}
|
||||
|
||||
// 30 simultaneous distant AI shots (>150m, <240m) trying to saturate all 19 one-shot voices
|
||||
for (int a = 2; a < 32; a++)
|
||||
{
|
||||
burstEvents.Add(new ShotFiredEvent
|
||||
{
|
||||
TracerId = 90100 + a,
|
||||
IsSpectatorShooter = false,
|
||||
ShooterId = a,
|
||||
StartX = listener.X + 175f,
|
||||
StartY = listener.Y + 1f,
|
||||
StartZ = listener.Z + (a % 5),
|
||||
EndX = listener.X,
|
||||
EndY = listener.Y + 1f,
|
||||
EndZ = listener.Z,
|
||||
WeaponClass = (byte)WeaponVisualClass.Autocannon,
|
||||
WeaponId = "autocannon"
|
||||
});
|
||||
}
|
||||
|
||||
// 1 event beyond MaxAudioDistance (260m) -> must be culled (0 voices)
|
||||
burstEvents.Add(new ShotFiredEvent
|
||||
{
|
||||
TracerId = 90999,
|
||||
IsSpectatorShooter = false,
|
||||
ShooterId = 99,
|
||||
StartX = listener.X + 320f,
|
||||
StartY = listener.Y + 1f,
|
||||
StartZ = listener.Z,
|
||||
EndX = listener.X,
|
||||
EndY = listener.Y + 1f,
|
||||
EndZ = listener.Z,
|
||||
WeaponClass = (byte)WeaponVisualClass.Explosive,
|
||||
WeaponId = "recoilless"
|
||||
});
|
||||
|
||||
audio.ConsumeSimEvents(_main.Session, burstEvents, listener);
|
||||
Check(audio.Active3DVoiceCount <= ArenaAudioSystem.Total3DVoiceCount,
|
||||
$"Active 3D voices exceeded 24 cap: {audio.Active3DVoiceCount}");
|
||||
Check(audio.ActiveOneShotVoiceCount == ArenaAudioSystem.OneShotVoiceCount,
|
||||
$"Expected 19 saturated one-shot voices, got {audio.ActiveOneShotVoiceCount}");
|
||||
Check(audio.DedupedCount == 4,
|
||||
$"Expected 5-pellet flak salvo to dedupe 4 pellets, got DedupedCount={audio.DedupedCount}");
|
||||
Check(audio.RejectedDistanceCount == 1,
|
||||
$"Expected >260m event to be distance-culled, got RejectedDistanceCount={audio.RejectedDistanceCount}");
|
||||
Check(audio.HasActiveVoiceForSource(isLocalSource: true, sourceEntityId: _main.Session.LocalContenderId),
|
||||
"Expected local player priority-10 voice never to be stolen by distant AI shots");
|
||||
|
||||
// Footstep mass-scaled pitch verification: Bastion (4600 kg) pitch < Kestrel (1650 kg) pitch
|
||||
audio.ClearAll();
|
||||
var kestrelPulse = new FootstepPulse(true, 0, 0, "kestrel", Catalog.Kestrel.MassKg, 1.0f, new System.Numerics.Vector3(listener.X, listener.Y, listener.Z));
|
||||
audio.ConsumeFootsteps(new[] { kestrelPulse }, _main.Session.LocalContenderId, listener);
|
||||
float? kestrelPitch = audio.GetLastPitchForClipPrefix("footstep_");
|
||||
|
||||
var bastionPulse = new FootstepPulse(true, 1, 0, "bastion", Catalog.Bastion.MassKg, 1.0f, new System.Numerics.Vector3(listener.X + 10f, listener.Y, listener.Z));
|
||||
audio.ConsumeFootsteps(new[] { bastionPulse }, _main.Session.LocalContenderId, listener);
|
||||
float? bastionPitch = audio.GetLastPitchForClipPrefix("footstep_heavy_");
|
||||
|
||||
Check(kestrelPitch.HasValue && bastionPitch.HasValue && bastionPitch.Value < kestrelPitch.Value,
|
||||
$"Expected Bastion pitch ({bastionPitch}) < Kestrel pitch ({kestrelPitch})");
|
||||
GD.Print($"SMOKE INFO: Audio verified (haven={audio.Bank.HavenClipCount}, proc={audio.Bank.ProceduralClipCount}, dummy={audio.IsDummyAudio}, kestrelPitch={kestrelPitch:F3}, bastionPitch={bastionPitch:F3})");
|
||||
}
|
||||
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue