Skip to main content

AudioBlockProvider

Trait AudioBlockProvider 

Source
pub trait AudioBlockProvider {
    // Required method
    fn block(
        &self,
        source: &SourceId,
        stream: Option<u32>,
        start_sample: i64,
        frames: usize,
    ) -> Option<AudioSpan<'_>>;
}
Expand description

Retrieves project-rate planar audio without exposing its backing cache.

Required Methods§

Source

fn block( &self, source: &SourceId, stream: Option<u32>, start_sample: i64, frames: usize, ) -> Option<AudioSpan<'_>>

Returns source samples [start_sample, start_sample + frames) at the project rate, as a span that covers all of them.

The block may extend past the request. Outside the source’s audio the provider either holds zeros or sets AudioSpan::starts_source / AudioSpan::ends_source. A provider that cannot yet cover the request returns None or a non-covering span, and the mixer reports the source missing rather than mixing silence.

stream counts over the source’s audio streams in container order; None is the stream the host plays by default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§