Voice 4: fluxer-audio devices, capture and playback mixer #65

Closed
opened 2026-11-11 12:17:32 +00:00 by charles · 0 comments
Owner

Files:

  • Create: crates/fluxer-audio/src/{host.rs,host_cpal.rs,host_null.rs,capture.rs,mixer.rs,engine.rs}
  • Modify: workspace Cargo.toml (cpal, ringbuf), CI workflow only if a system package is missing
  • Test: crates/fluxer-audio/tests/{mixer.rs,engine.rs}

Interfaces:

  • Produces: trait AudioHost (enumerate devices, open input/output streams with callbacks, default-device change notifications); CpalHost, NullHost::new() -> (NullHost, NullControl) (NullControl::{advance(Duration), feed_input(&[i16]), take_output() -> Vec<i16>, unplug_input()}); DeviceInfo { id: String, name: String, is_default: bool }; Mixer with set_gain(SourceId, f32), push(SourceId, Frame), remove(SourceId), per-source queue capped at 120 ms; AudioEngine::start(host: Arc<dyn AudioHost>, events: mpsc::Sender<EngineEvent>) -> AudioEngine with set_input_device, set_output_device, start_capture(ChainConfig) -> mpsc::Receiver<Frame>, stop_capture, set_chain_config, push_remote(identity: &str, Frame), remove_remote, set_gain, devices(), start_mic_test/stop_mic_test (loop capture to output); EngineEvent::{Devices, DeviceLost { input }, LocalLevel { rms, gate_open }, RemoteLevels(Vec<(String, f32)>), Error} at ≤20 Hz.

  • Step 1: Write failing tests (all on NullHost): mixer_sums_sources_with_gain_and_soft_clips, mixer_drops_backlog_beyond_120ms, capture_delivers_10ms_frames_through_chain, unplugging_input_falls_back_to_default_and_reports_device_lost, remote_levels_reported_per_identity, mic_test_loops_input_to_output, callbacks_do_not_allocate (a counting global allocator in the test binary asserts zero allocations inside the null host's callback invocation after warm-up).

  • Step 2–5: FAIL → implement → PASS → commit feat(audio): device hosts, capture and playback mixer.

Plan: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/plans/2026-11-11-voice.md
Spec: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/specs/2026-11-11-fluxer-native-voice-design.md

**Files:** - Create: `crates/fluxer-audio/src/{host.rs,host_cpal.rs,host_null.rs,capture.rs,mixer.rs,engine.rs}` - Modify: workspace `Cargo.toml` (`cpal`, `ringbuf`), CI workflow only if a system package is missing - Test: `crates/fluxer-audio/tests/{mixer.rs,engine.rs}` **Interfaces:** - Produces: `trait AudioHost` (enumerate devices, open input/output streams with callbacks, default-device change notifications); `CpalHost`, `NullHost::new() -> (NullHost, NullControl)` (`NullControl::{advance(Duration), feed_input(&[i16]), take_output() -> Vec<i16>, unplug_input()}`); `DeviceInfo { id: String, name: String, is_default: bool }`; `Mixer` with `set_gain(SourceId, f32)`, `push(SourceId, Frame)`, `remove(SourceId)`, per-source queue capped at 120 ms; `AudioEngine::start(host: Arc<dyn AudioHost>, events: mpsc::Sender<EngineEvent>) -> AudioEngine` with `set_input_device`, `set_output_device`, `start_capture(ChainConfig) -> mpsc::Receiver<Frame>`, `stop_capture`, `set_chain_config`, `push_remote(identity: &str, Frame)`, `remove_remote`, `set_gain`, `devices()`, `start_mic_test`/`stop_mic_test` (loop capture to output); `EngineEvent::{Devices, DeviceLost { input }, LocalLevel { rms, gate_open }, RemoteLevels(Vec<(String, f32)>), Error}` at ≤20 Hz. - [ ] **Step 1: Write failing tests** (all on `NullHost`): `mixer_sums_sources_with_gain_and_soft_clips`, `mixer_drops_backlog_beyond_120ms`, `capture_delivers_10ms_frames_through_chain`, `unplugging_input_falls_back_to_default_and_reports_device_lost`, `remote_levels_reported_per_identity`, `mic_test_loops_input_to_output`, `callbacks_do_not_allocate` (a counting global allocator in the test binary asserts zero allocations inside the null host's callback invocation after warm-up). - [ ] **Step 2–5:** FAIL → implement → PASS → commit `feat(audio): device hosts, capture and playback mixer`. Plan: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/plans/2026-11-11-voice.md Spec: https://git.forked.io/charles/fluxer-native/src/branch/main/docs/superpowers/specs/2026-11-11-fluxer-native-voice-design.md
charles added this to the Voice milestone 2026-11-11 12:17:32 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#65
No description provided.