pub struct AlsaPlaybackBridge<P> { /* private fields */ }Expand description
Drives an audio graph processor from an ALSA playback callback.
Implementations§
Source§impl<P: Processor> AlsaPlaybackBridge<P>
impl<P: Processor> AlsaPlaybackBridge<P>
Sourcepub fn new(processor: P, spec: PcmSpec, max_block_frames: u32) -> Result<Self>
pub fn new(processor: P, spec: PcmSpec, max_block_frames: u32) -> Result<Self>
Builds a playback bridge, preparing processor for the given spec.
max_block_frames is the largest callback block the bridge will accept
and must be greater than zero. The processor is prepared with the spec’s
sample rate, channel count, and this block bound.
Sourcepub fn render_buffer(&mut self, frames: usize) -> Result<PcmBuffer>
pub fn render_buffer(&mut self, frames: usize) -> Result<PcmBuffer>
Renders frames of audio into a PcmBuffer in the spec’s format.
F32 output is returned directly; I16 output is converted from the rendered F32 samples.
Sourcepub fn render_interleaved_f32(&mut self, frames: usize) -> Result<Vec<f32>>
pub fn render_interleaved_f32(&mut self, frames: usize) -> Result<Vec<f32>>
Renders frames of audio and returns interleaved F32 samples.
Errors when frames exceeds the configured max_block_frames. The
processor runs over a single ProcessBlock with a playing transport;
the bridge’s sample position advances by frames.
Sourcepub fn sample_pos(&self) -> u64
pub fn sample_pos(&self) -> u64
Returns the running sample position across rendered blocks.