Add host-facing AquaSynth patch compiler
This commit is contained in:
parent
2461821907
commit
90649b3de2
9 changed files with 90 additions and 32 deletions
|
|
@ -17,7 +17,7 @@ public sealed class NativeFaustRuntimeTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void NativeFaustRendererRendersAudiblePatchWhenToolchainIsAvailable()
|
||||
public void NativeFaustPatchCompilerRendersAudiblePatchWhenToolchainIsAvailable()
|
||||
{
|
||||
const string script = """
|
||||
voice
|
||||
|
|
@ -29,8 +29,8 @@ public sealed class NativeFaustRuntimeTests
|
|||
decay=0.12
|
||||
""";
|
||||
|
||||
using var session = new AquaSynthRenderSession();
|
||||
if (!session.TryRenderScript("native_smoke", script, 1.0f, out var samples, out var error))
|
||||
using var compiler = new AquaSynthPatchCompiler();
|
||||
if (!compiler.TryCompileScript(new AquaSynthCompileIdentity("native_smoke", "native_smoke", script), out var patch, out var error))
|
||||
{
|
||||
if (error?.Contains("Faust toolchain not found", StringComparison.OrdinalIgnoreCase) == true ||
|
||||
error?.Contains("Faust DLL not found", StringComparison.OrdinalIgnoreCase) == true)
|
||||
|
|
@ -41,8 +41,12 @@ public sealed class NativeFaustRuntimeTests
|
|||
Assert.Fail($"AquaSynth native Faust render failed: {error}");
|
||||
}
|
||||
|
||||
Assert.True(samples.Length > 2048, $"Rendered too few samples: {samples.Length}.");
|
||||
Assert.Contains(samples, sample => MathF.Abs(sample) > 0.001f);
|
||||
Assert.InRange(samples.Max(sample => MathF.Abs(sample)), 0.001f, 1.0f);
|
||||
using (patch)
|
||||
{
|
||||
var samples = patch!.Render(1.0f);
|
||||
Assert.True(samples.Length > 2048, $"Rendered too few samples: {samples.Length}.");
|
||||
Assert.Contains(samples, sample => MathF.Abs(sample) > 0.001f);
|
||||
Assert.InRange(samples.Max(sample => MathF.Abs(sample)), 0.001f, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue