Mimir/docs/native-rebuild-plan.md

71 lines
2.8 KiB
Markdown
Raw Normal View History

2026-05-21 18:48:47 +01:00
# Native Rebuild Plan
2026-05-23 18:12:31 +01:00
This is the live cut line: Mimir is a direct-driver, native-buffer, Fensalir
2026-05-21 18:48:47 +01:00
hosted stream machine.
## Objective
2026-05-21 18:48:47 +01:00
Make the room available in OBS as synchronized program video plus separately
controllable audio while preserving ownership:
2026-05-21 18:48:47 +01:00
- Mimir owns configuration, calibration truth, runtime contracts, launch,
status, and persistence.
- Mimir.Runtime owns in-memory stream buffers and runtime synchronization.
- Native capture workers own device reads and append typed sample handles.
2026-05-23 18:12:31 +01:00
- Fensalir owns GPU fusion, rendering, D3D12 interop, UI, and Spout2 output.
2026-05-21 18:48:47 +01:00
- Faust/native DSP owns hot audio alignment, suppression, separation, stems, and
spatial bed generation.
- OBS owns broadcast controls.
## Runtime State Model
```mermaid
flowchart TD
2026-05-21 18:48:47 +01:00
C["direct camera drivers"] --> R["Mimir.Runtime buffers"]
A["audio / loopback drivers"] --> R
N["network feed producers"] --> R
2026-05-23 18:12:31 +01:00
R --> Q["Fensalir UI + GPU fusion"]
R --> F["Faust/native DSP"]
2026-05-21 18:48:47 +01:00
Q --> S["Spout2/program video"]
F --> P["program stems + spatial bed"]
S --> O["OBS"]
P --> O
```
2026-05-21 18:48:47 +01:00
The app-level runtime initializes one rolling buffer per configured audio or
video stream, defaulting to five seconds. The lower native reservoir keeps the
2026-05-23 18:12:31 +01:00
single-edge typed-handle invariant for Fensalir/Faust integration.
2026-05-21 18:48:47 +01:00
Payload memory belongs to the producing domain. The reservoir and runtime own
timing, identity, ordering, retention, and lookup. They do not pretend to own
camera driver buffers, GPU textures, or DSP audio memory.
2026-05-19 11:04:00 +01:00
## Authoritative Boundaries
2026-05-21 18:48:47 +01:00
- Config/calibration crosses into runtime as measured truth plus profile
version.
- Capture drivers cross into runtime by appending typed samples.
2026-05-23 18:12:31 +01:00
- Fensalir consumes current visual/audio timing state and publishes the program
2026-05-21 18:48:47 +01:00
video surface.
- Faust/native DSP consumes audio/phase/event handles and publishes stems.
- OBS receives final program surfaces. It does not own synchronization.
## Impossible By Construction
2026-05-21 18:48:47 +01:00
- A sample older than the rolling window is visible to live consumers.
- A process bridge becomes the six-camera local capture foundation.
- File polling becomes the native runtime API.
- OBS broadcasts raw unsynchronized sources as the synchronized program.
- Two modules own the reservoir edge.
## Migration Order
2026-05-21 18:48:47 +01:00
1. Keep the C# app/runtime as the public Mimir surface.
2. Implement Leap stereo IR direct ingest first and measure sustained cadence.
3. Add the remaining local camera drivers through the same source seam.
4. Add native audio capture workers and feed aligned blocks to Faust/native DSP.
2026-05-23 18:12:31 +01:00
5. Bind Fensalir UI to stream health, buffer depth, source timestamps, settings,
2026-05-21 18:48:47 +01:00
and output management.
2026-05-23 18:12:31 +01:00
6. Move GPU fusion and Spout2 publication fully into Fensalir.
2026-05-21 18:48:47 +01:00
7. Keep FFmpeg/SRT scripts only as bridge utilities until direct program output
makes them unnecessary.