Add native runtime producer spine

This commit is contained in:
Meta Vens 2026-05-19 07:54:58 +01:00
commit be6e68af9d
8 changed files with 357 additions and 19 deletions

View file

@ -7,6 +7,7 @@
- `config/perfect-machine.example.json` declares the contract shape for six cameras, six microphones, reservoir rings, native authorities, outputs, and the demotion of bridge scripts to tooling.
- `native/reservoir` is the first native Rust crate. It implements shared-edge five-second reservoir rings and proves that all rings expire against the newest sample, not private per-source clocks.
- `native/reservoir/include/localcast_reservoir.h` exposes the Aquarium/Faust C ABI: opaque reservoir create/destroy, sample-handle push, edge/window queries, ring counts, and latest sample lookup by sensor hash. Payload memory remains owned by Aquarium/GPU/Faust; the reservoir owns timing and retention.
- `LocalcastRuntime` now wraps the reservoir with typed native producer calls for camera frames/features, scene rays, surface/material claims, audio blocks, phase claims, events, and render packets. It also exposes native status with shared edge/window and ring counts, replacing the Python file-cache path as the intended live spine.
- Repo-local persistence machinery.
- First architecture map.
- Example config for one video source plus two audio sources.
@ -73,15 +74,17 @@
- Audio defaults to AAC inside MPEG-TS for compatibility; test Opus later only if there is a concrete reason.
- Desktop capture uses `gdigrab` first because it is broadly available. `ddagrab` is a candidate once the installed FFmpeg build is confirmed.
- The scripts assume Windows sender and OBS receiver on the same LAN.
- The Python live producers/renderers are compatibility diagnostics. They are no longer the intended runtime API.
## Next
1. Add the Aquarium-side binding that loads `localcast_reservoir` and maps GPU/audio buffer handles to `LocalcastSampleHandle`.
2. Move camera ingest into native capture workers that append `camera_frame` samples to the reservoir.
3. Move feature extraction, flow, cross-view matching, LOD reconciliation, and material fitting into Aquarium GPU compute.
4. Move mic alignment, voice separation, room suppression, Ambisonic/HOA spatialization, and stem generation into Faust/native DSP.
5. Replace the deadline Spout sink with Aquarium-owned Spout publication from the native render target.
6. Feed the neighbor Focusrite shotgun and neighbor loopback into the reservoir as live synchronized audio inputs.
7. Replace placeholder mic/speaker/camera geometry with measured `config/audio-field.json` and `config/sensor-fusion.json` coordinates.
8. Calibrate Leap as a geometric camera so Leap contributes direct 3D rays, not only timing evidence.
9. Keep the Python bridge only for calibration, contract tests, device discovery, status, and offline analysis.
1. Add the Aquarium-side binding that loads `localcast_reservoir`, creates `LocalcastRuntime`, and maps GPU/audio buffer handles to `LocalcastSampleHandle`.
2. Move camera ingest into native capture workers that call `localcast_runtime_push_camera_frame`.
3. Move mic/loopback ingest into native capture workers that call `localcast_runtime_push_audio_block`.
4. Move feature extraction, flow, cross-view matching, LOD reconciliation, and material fitting into Aquarium GPU compute.
5. Move mic alignment, voice separation, room suppression, Ambisonic/HOA spatialization, and stem generation into Faust/native DSP.
6. Replace the deadline Spout sink with Aquarium-owned Spout publication from the native render target.
7. Feed the neighbor Focusrite shotgun and neighbor loopback into the reservoir as live synchronized audio inputs.
8. Replace placeholder mic/speaker/camera geometry with measured `config/audio-field.json` and `config/sensor-fusion.json` coordinates.
9. Calibrate Leap as a geometric camera so Leap contributes direct 3D rays, not only timing evidence.
10. Keep the Python bridge only for calibration, contract tests, device discovery, status, and offline analysis.

View file

@ -15,13 +15,15 @@ The repo currently proves the contracts:
```mermaid
flowchart TD
A["sensor samples"] --> B["typed CultCache docs"]
B --> C["Python deadline producers"]
C --> D["deadline Spout texture"]
D --> E["OBS"]
A["camera/audio/phase/render producers"] --> B["LocalcastRuntime C ABI"]
B --> C["5s native reservoir"]
C --> D["Aquarium GPU + Faust DSP"]
D --> E["Spout/audio stems"]
E --> F["OBS"]
```
That was useful. It is not the final machine.
The old CultCache/Python/Spout path remains a compatibility diagnostic. It is
not the runtime API.
## Invariants
@ -83,6 +85,11 @@ Required rings:
The reservoir owns retention. Producers append. Optimizers refine. Renderers
sample. No stage owns a private history that can outlive the reservoir.
`LocalcastRuntime` is the first native owner above the raw reservoir. It exposes
typed producer calls for each ring so camera capture, audio capture, phase
estimation, material fitting, event detection, and render planning all append
into one shared five-second window without crossing a Python file cache.
## Visual Fusion
Camera fusion is feature matching across the reservoir, not a latest-frame
@ -165,6 +172,10 @@ in `native/reservoir/include/localcast_reservoir.h`:
- advance/query the shared edge and window start;
- query ring length;
- query the latest sample for a sensor hash.
- create/destroy an opaque `LocalcastRuntime`;
- append typed camera/audio/phase/event/render handles through producer calls;
- query a native runtime status struct with shared edge, window start, and ring
counts.
The ABI carries `payload_handle`, not payload bytes. Aquarium owns image,
feature, surface, material, and GPU memory interpretation. Faust/native DSP owns