Skip to main content

AudioBlockProvider

Trait AudioBlockProvider 

Source
pub trait AudioBlockProvider {
    // Required method
    fn block(
        &self,
        source: &SourceId,
        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, 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 start before start_sample and end after the request. Where the source has no audio, before its first sample or after its last, the provider either holds zeros there or says so with AudioSpan::starts_source and AudioSpan::ends_source, which spares allocating silence. A provider that cannot yet account for the whole request returns None, or a span that does not cover it: the mixer then reports the source missing instead of mixing the gap as silence and calling the block complete.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§