audio-resample-bsd 0.2.1

RT-safe audio resampling crate (rubato-based) — the only processing interface callable directly from the real-time audio thread
Documentation
//! 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`).

#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(missing_docs)]
#![warn(clippy::all, clippy::pedantic)]

pub mod error;
pub mod resampler;
pub mod rubato_impl;

pub use error::{ResampleError, Result};
pub use resampler::Resampler;
pub use rubato_impl::RubatoResampler;