Restore Goddard leveling and Scooter positional pitch processing
This commit is contained in:
1 parent
74be19eb15
commit
fccc0b9d1b
24 files changed
+967
-8
No files matched your search
@@ -0,0 +1,27 @@
|
||||
using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using GamePort.Game;
|
||||
|
||||
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-frequency-reference.json")));
|
||||
int count=0;
|
||||
foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray())
|
||||
{
|
||||
var i=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
|
||||
var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
|
||||
float history=i[2];int frequency=ScooterAudio.PositionalFrequency((int)i[0],i[1],ref history);
|
||||
Check(frequency==(int)o[0]&&history==o[1],$"Copied original position case{count}: {frequency}/{history} != {o[0]}/{o[1]}");count++;
|
||||
}
|
||||
Check(count==11,"complete native positional cases");
|
||||
Console.WriteLine("PASS eleven copied-original positional frequency observations, including zero-distance and signed history");
|
||||
Check(ScooterAudio.EngineFrequency(11025,1485)==50885,"recovered maximum-speed engine command preserved");
|
||||
Check(ScooterAudio.EngineFrequency(11025,-594)==7000,"engine-only reverse floor");
|
||||
var audio=new ScooterAudio();
|
||||
int adjusted=audio.Frequency(11025,1485,Vector3.Zero,new(0,0,800));
|
||||
Check(adjusted==50285&&audio.History==600,"listener correction follows nominal engine command");
|
||||
Check(audio.Frequency(11025,1485,Vector3.Zero,new(0,0,800))==50735&&audio.History==150,"history is last correction rather than distance");
|
||||
audio.Reset();Check(audio.History==0,"new channel clears history");
|
||||
Check(audio.Frequency(11025,-594,Vector3.Zero,new(0,0,500))==6625,"positional correction follows7000 engine floor, not a second7000 clamp");
|
||||
Check(audio.Frequency(11025,1485,Vector3.Zero,Vector3.Zero)==6625&&audio.History==375,"zero distance retains preceding device frequency/history");
|
||||
Console.WriteLine("PASS engine command, source position adjustment, channel reset and reverse ordering");
|
||||
|
||||
static void Check(bool condition,string name){if(!condition)throw new Exception(name);}
|
||||
Reference in new issue
Block a user