Give Mimir its own empty scene runtime
This commit is contained in:
parent
0574629914
commit
78914030b1
5 changed files with 57 additions and 33 deletions
|
|
@ -8,12 +8,12 @@
|
|||
"storageLayout": "single-native-rolling-buffer-with-typed-views"
|
||||
},
|
||||
"viableStreamApp": {
|
||||
"owner": "Aquarium",
|
||||
"owner": "Mimir",
|
||||
"solution": "Mimir.slnx",
|
||||
"appProject": "src/Mimir.App/Mimir.App.csproj",
|
||||
"runtimeProject": "src/Mimir.Runtime/Mimir.Runtime.csproj",
|
||||
"windowingRenderingLibrary": "Aquarium.Engine",
|
||||
"d3d12Bridge": "Aquarium.Engine",
|
||||
"windowingRenderingLibrary": "Fensalir",
|
||||
"d3d12Bridge": "Fensalir",
|
||||
"defaultReservoirSeconds": 5.0,
|
||||
"runtimeState": "in-memory-localcast-runtime",
|
||||
"syncBuffers": {
|
||||
|
|
@ -35,9 +35,9 @@
|
|||
},
|
||||
"authorities": {
|
||||
"configurationCalibrationLaunchStatus": "Mimir",
|
||||
"denseVisualFusion": "Aquarium",
|
||||
"gpuMaterialAndBrushReconciliation": "Aquarium",
|
||||
"spoutPublication": "Aquarium",
|
||||
"denseVisualFusion": "Fensalir",
|
||||
"gpuMaterialAndBrushReconciliation": "Fensalir",
|
||||
"spoutPublication": "Fensalir",
|
||||
"hotAudioDsp": "Faust",
|
||||
"obsBroadcastControls": "OBS"
|
||||
},
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
"video": {
|
||||
"target": "Spout2",
|
||||
"senderName": "Mimir Point Cloud",
|
||||
"owner": "Aquarium"
|
||||
"owner": "Fensalir"
|
||||
},
|
||||
"audio": {
|
||||
"owner": "Faust",
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
"Mimir.Runtime",
|
||||
"native-driver-workers",
|
||||
"native-reservoir",
|
||||
"Aquarium.Engine",
|
||||
"Fensalir",
|
||||
"Faust"
|
||||
],
|
||||
"neverInCompatibilityEdges": [
|
||||
|
|
|
|||
|
|
@ -89,17 +89,16 @@ The first cut should be deliberately boring:
|
|||
|
||||
- `src/Mimir.App` launches Fensalir and points it at the Mimir runtime
|
||||
assembly.
|
||||
- `src/Mimir.Runtime` implements the Fensalir client runtime factory and uses
|
||||
Fensalir's LocalCast runtime until Mimir-specific ingest workers replace the
|
||||
remaining diagnostic source.
|
||||
- `src/Mimir.Runtime` implements the Fensalir client runtime factory. Mimir owns
|
||||
its scene state; Fensalir is the host/window/D3D12 bridge, not an embedded demo
|
||||
runtime.
|
||||
|
||||
## Synchronization Runtime
|
||||
|
||||
`Mimir.Runtime` now owns the first synchronization spine:
|
||||
|
||||
- `MimirRuntime` is the Fensalir client runtime. It wraps the current
|
||||
Fensalir `LocalCastRuntime` visual path and adds a Mimir-owned synchronization
|
||||
hub.
|
||||
- `MimirRuntime` is the Fensalir client runtime. It starts from an empty Mimir
|
||||
scene and adds a Mimir-owned synchronization hub.
|
||||
- `MimirSynchronizationHub` owns stream source polling and appends samples into
|
||||
bounded buffers.
|
||||
- `MimirRollingStreamBuffer` owns one stream's short history and evicts samples
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Fensalir\src\Aquarium.Engine.Contracts\Aquarium.Engine.Contracts.csproj" />
|
||||
<ProjectReference Include="..\..\..\Fensalir\src\Aquarium.Fensalir\Aquarium.Fensalir.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ using Aquarium.Engine.Audio;
|
|||
using Aquarium.Engine.Input;
|
||||
using Aquarium.Engine.Render;
|
||||
using Aquarium.Engine.Ui;
|
||||
using Aquarium.Fensalir;
|
||||
using Mimir.Runtime.Synchronization;
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Mimir.Runtime;
|
||||
|
||||
|
|
@ -16,9 +16,9 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
private const double CalibrationStartSeconds = 0.5;
|
||||
private const int CalibrationBatchSegments = 120;
|
||||
private const int HybridWatermarkIntervalSegments = 4;
|
||||
private readonly IAquariumRuntime visualRuntime;
|
||||
private readonly MimirSynchronizationHub synchronization;
|
||||
private readonly AquariumUiDocument ui;
|
||||
private readonly AquariumAudioDocument audio = new();
|
||||
private readonly MimirAudioSynchronizationSettings audioSyncSettings;
|
||||
private readonly float telemetryIntervalSeconds;
|
||||
private readonly float audioSyncUpdateIntervalSeconds;
|
||||
|
|
@ -55,7 +55,6 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
IEnumerable<IMimirStreamSource> streamSources)
|
||||
{
|
||||
Options = options;
|
||||
visualRuntime = new FensalirRuntimeFactory().Create(options);
|
||||
synchronization = new MimirSynchronizationHub(settings);
|
||||
audioSyncSettings = settings.Audio;
|
||||
telemetryIntervalSeconds = ParseTelemetryIntervalSeconds();
|
||||
|
|
@ -74,21 +73,26 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
|
||||
public AquariumRuntimeOptions Options { get; }
|
||||
|
||||
public AquariumFrame Frame => visualRuntime.Frame;
|
||||
public AquariumFrame Frame => new(
|
||||
new ViewFrame(Vector2.Zero, 24.0f),
|
||||
new Vector3(0.0f, -10.0f, 7.0f),
|
||||
runtimeSeconds,
|
||||
Vector2.Zero,
|
||||
new AquariumSceneState
|
||||
{
|
||||
TraceHeightFieldSurface = false,
|
||||
UseStarfieldBackground = false,
|
||||
});
|
||||
|
||||
public GraphicsSettings GraphicsSettings
|
||||
{
|
||||
get => visualRuntime.GraphicsSettings;
|
||||
set => visualRuntime.GraphicsSettings = value;
|
||||
}
|
||||
public GraphicsSettings GraphicsSettings { get; set; } = GraphicsSettings.Default;
|
||||
|
||||
public AquariumRenderPlan RenderPlan => visualRuntime.RenderPlan;
|
||||
public AquariumRenderPlan RenderPlan { get; } = CreateRenderPlan();
|
||||
|
||||
public AquariumUiDocument Ui => ui;
|
||||
|
||||
public AquariumAudioDocument Audio => visualRuntime.Audio;
|
||||
public AquariumAudioDocument Audio => audio;
|
||||
|
||||
public AquariumSynthDocument Synth => visualRuntime.Synth;
|
||||
public AquariumSynthDocument Synth => AquariumSynthDocument.Empty;
|
||||
|
||||
public void RegisterStreamSource(IMimirStreamSource source)
|
||||
{
|
||||
|
|
@ -98,7 +102,7 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
public void Start()
|
||||
{
|
||||
Console.WriteLine($"Mimir runtime sync buffers: {synchronization.Summary()} @ {synchronization.Settings.BufferDuration.TotalSeconds:0.###}s audioSync={audioSyncSettings.Mode} reference={audioSyncSettings.ReferenceSourceId}");
|
||||
visualRuntime.Start();
|
||||
Console.WriteLine("Mimir empty scene runtime booted.");
|
||||
}
|
||||
|
||||
public void Update(float deltaSeconds, InputState input)
|
||||
|
|
@ -108,23 +112,20 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
lastPollCount = synchronization.PollSources();
|
||||
UpdateAudioSynchronization();
|
||||
EmitTelemetry();
|
||||
visualRuntime.Update(deltaSeconds, input);
|
||||
}
|
||||
|
||||
public AquariumFrame ComposeFrame(AquariumFrame frame, AquariumFrameInput input)
|
||||
{
|
||||
return visualRuntime.ComposeFrame(frame, input);
|
||||
return frame;
|
||||
}
|
||||
|
||||
public void FlushState()
|
||||
{
|
||||
visualRuntime.FlushState();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
synchronization.Dispose();
|
||||
visualRuntime.Dispose();
|
||||
}
|
||||
|
||||
private AquariumUiDocument CreateUi()
|
||||
|
|
@ -146,6 +147,18 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
});
|
||||
}
|
||||
|
||||
private static AquariumRenderPlan CreateRenderPlan()
|
||||
{
|
||||
var app = new AquariumApp();
|
||||
var scene = app.RenderTargets.Hdr("scene");
|
||||
app.Cameras.Perspective("main");
|
||||
app.Graph.Pass("scene").Fullscreen();
|
||||
app.Features.Presentation(scene.Color);
|
||||
app.Features.DirectWriteOverlay();
|
||||
app.Debug.View("Scene", scene.Color);
|
||||
return app.Plan;
|
||||
}
|
||||
|
||||
private void QueueCalibrationTimeline()
|
||||
{
|
||||
if (!ShouldEmitCalibrationTimeline())
|
||||
|
|
@ -182,7 +195,7 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
UseChirpBinTimeline(audioSyncSettings.Mode),
|
||||
synchronization.ChirpBinEmissionPlan,
|
||||
out var peak);
|
||||
visualRuntime.Audio.EnqueuePcm16Base64(
|
||||
audio.EnqueuePcm16Base64(
|
||||
batch,
|
||||
MimirChirpletTimeline.SampleRate,
|
||||
channels: 1,
|
||||
|
|
@ -324,6 +337,11 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
|
||||
private bool ShouldEmitCalibrationTimeline()
|
||||
{
|
||||
if (!HasReferenceAudioBuffer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return audioSyncSettings.Mode switch
|
||||
{
|
||||
MimirAudioSyncMode.ChirpOnly => true,
|
||||
|
|
@ -333,6 +351,13 @@ public sealed class MimirRuntime : IAquariumRuntime
|
|||
};
|
||||
}
|
||||
|
||||
private bool HasReferenceAudioBuffer()
|
||||
{
|
||||
return synchronization.Buffers.Buffers.Any(buffer =>
|
||||
buffer.Descriptor.Kind == MimirStreamKind.Audio &&
|
||||
string.Equals(buffer.Descriptor.SourceId, audioSyncSettings.ReferenceSourceId, StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
private string DescribeAudioSyncMode()
|
||||
{
|
||||
return audioSyncSettings.Mode switch
|
||||
|
|
|
|||
|
|
@ -77,3 +77,4 @@
|
|||
{"ts": "2026-05-23T21:41:47+01:00", "type": "implementation", "status": "ok", "note": "Implemented the in-process Focusrite ASIO runtime source. native/asio_capture owns the ASIO COM driver/callback buffers and MimirAsioStreamSource drains 192 kHz Float32 blocks into Mimir.Runtime buffers for asio-ch0..asio-ch3 without stdout/base64 transport. The chirp-bin calibration model is now per output/mic path and the active decoder uses learned symbol weights, phase-coherence weights, group-delay correction, and joint global delay/bin-shift hypotheses."}
|
||||
{"ts": "2026-05-23T21:41:53+01:00", "type": "verification", "status": "ok", "note": "Verified the in-process ASIO runtime ingest and active decoder after the native ASIO cut. dotnet build Mimir.slnx and cmake --build native/asio_capture/build --config Release passed cleanly. BufferSmoke with config/mimir-runtime.asio.example.json ingested 12,196 sample-bearing blocks in two seconds at 192 kHz, with 2,048 buffered 192-frame Float32 blocks on each asio-ch0..asio-ch3 channel. The standalone 192 kHz chirp-bin receiver recovered a 96,000-sample delay with 0.000001 sample error, and calibrated ASIO artifact analysis recovered asio-ch2->asio-ch3 at 0.000 us with 0.812 confidence."}
|
||||
{"ts": "2026-05-23T21:43:33+01:00", "type": "verification", "status": "ok", "note": "Reran the in-process ASIO ingest after native cleanup changes. BufferSmoke with config/mimir-runtime.asio.example.json ingested 12,204 sample-bearing blocks in two seconds at 192 kHz and retained 2,048 192-frame Float32 blocks for each asio-ch0..asio-ch3 buffer. This remains an ingest proof only because BufferSmoke does not emit calibration audio in that run."}
|
||||
{"ts": "2026-05-23T22:45:11+01:00", "type": "implementation", "status": "ok", "note": "Separated Mimir's app runtime from Fensalir's demo runtime. MimirRuntime no longer references Aquarium.Fensalir or delegates Frame/RenderPlan/Audio/Synth/Update/ComposeFrame to FensalirRuntime. It owns an empty scene with heightfield tracing and starfield disabled, its own audio/UI/render-plan documents, and only emits calibration audio when the configured reference audio buffer exists. Headless Mimir.App boots with 'Mimir empty scene runtime booted' and no Fensalir splash reconstruction/fractal scene in Mimir source."}
|
||||
|
|
|
|||
Loading…
Reference in a new issue