1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! RT-safe audio resampling (rubato-based).
//!
//! This crate defines the resampling layer — the [`Resampler`] trait is the
//! **only processing interface that may be called directly from the real-time
//! (RT) audio thread**. Codecs, DSP primitives, and graph nodes all perform
//! sample-rate conversion through this trait.
//!
//! # Data layout — planar flat
//!
//! Input and output are flat `&[f32]` buffers in **planar** layout:
//! `[ch0_frames..., ch1_frames...]`. This matches the layout of
//! [`audio_core_bsd::AudioFrame::samples`], so an `AudioFrame` can be passed to
//! a `Resampler` directly with no extra copy or rearrangement. The channel
//! count is fixed when the implementation is constructed.
//!
//! # Real-time safety boundary — CRITICAL
//!
//! Only [`Resampler::process_into_buffer`] may be called from the RT thread. On
//! this path, heap allocation / locking / panicking / system calls are all
//! forbidden (same principle as the `audio-core-bsd` `AudioNode` RT contract).
//! Every buffer must be pre-allocated when the implementation is constructed.
//!
//! [`Resampler::set_rate`] rebuilds the inner resampler to change the ratio and
//! **therefore allocates**. It must be called only from a configuration/worker
//! thread — never the RT thread, and only between audio cycles. The RT-alloc=0
//! guarantee applies only to `process_into_buffer` (the fixed-ratio path).
//!
//! # Implementation status (0.2.0)
//!
//! This crate provides the public API ([`Resampler`] trait / [`ResampleError`])
//! and the rubato 4.0-backed standard implementation [`RubatoResampler`].
//! [`RubatoResampler`] implements a zero-copy, allocation-free RT processing
//! path at a fixed input ratio (`FixedSync::Input`).
pub use ;
pub use Resampler;
pub use RubatoResampler;