Skip to content

feat(akroasis-core): cpal output backend, format negotiation, resampler#39

Merged
forkwright merged 2 commits intomainfrom
p1-06/output
Mar 11, 2026
Merged

feat(akroasis-core): cpal output backend, format negotiation, resampler#39
forkwright merged 2 commits intomainfrom
p1-06/output

Conversation

@forkwright
Copy link
Owner

Summary

  • output/mod.rs: Extended OutputParams with needs_resample, source_sample_rate, and quality_tier fields so format negotiation results flow through to the backend
  • output/format.rs: negotiate_format() implementing the full decision tree (sample rate selection, bit depth preference, exclusive mode, quality tier propagation); quantize()/quantize_into() for f64→i16/i24/i32/f32 byte conversion
  • output/resample.rs: Resampler wrapping rubato 1.0 Async sinc (BlackmanHarris2 window, 256-tap, oversampling=256) with pre-allocated interleaved adapter buffers; process_interleaved() is allocation-free after construction
  • output/cpal.rs: CpalOutputBackend — device enumeration, capabilities query (probes common sample rates within each SupportedStreamConfigRange), build_output_stream_raw format dispatch (f32 > i32 > i16 preference), pre-allocated RT callback buffer with underrun silence fill and counter; start/pause/close via cpal StreamTrait
  • lib.rs: Re-exports Quantization and Resampler

Test plan

  • cargo check — clean
  • cargo test — 47 passed, 1 ignored (RT/hardware integration), 0 failed
  • cargo clippy -- -D warnings — clean
  • Hardware-dependent tests (available_devices, device_capabilities, stream open) are #[ignore]-gated, require a real audio device

Implements P1-06. Blocks P1-07 (gapless) and P1-08 (engine).

🤖 Generated with Claude Code

Claude (Verda) added 2 commits March 11, 2026 22:11
Implements P1-06 output layer:

- output/mod.rs: extend OutputParams with needs_resample, source_sample_rate,
  quality_tier fields for format negotiation results
- output/format.rs: negotiate_format() decision tree (sample rate, bit depth,
  exclusive mode, quality tier); quantize() and quantize_into() for f64→i16/i24/i32/f32
- output/resample.rs: Resampler wrapping rubato 1.0 Async sinc (BlackmanHarris2,
  256-tap, oversampling=256); pre-allocated interleaved buffers, allocation-free
  process_interleaved() after construction
- output/cpal.rs: CpalOutputBackend — device enumeration, capabilities query,
  stream creation with raw format dispatch (f32/i32/i16), pre-allocated RT
  callback buffer, underrun silence fill; start/pause/close via StreamTrait
- lib.rs: re-export Quantization and Resampler

47 tests passing, 1 ignored (integration). cargo clippy clean.
@forkwright forkwright merged commit 1fc3e61 into main Mar 11, 2026
2 checks passed
@forkwright forkwright deleted the p1-06/output branch March 11, 2026 22:28
This was referenced Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant