Trait cybergrape::saf::Binauraliser

source ·
pub trait Binauraliser {
    // Required method
    fn process_frame(
        &mut self,
        buffers: &[(BufferMetadata, &[f32])],
    ) -> (Vec<f32>, Vec<f32>);

    // Provided method
    fn process(
        &mut self,
        buffers: &[(BufferMetadata, &[f32])],
    ) -> (Vec<f32>, Vec<f32>) { ... }
}
Expand description

A Binauraliser is anything that can take an array of sound buffers, paired with their associated metadata, and return a pair of freshly allocated buffers representing the mixed stereo audio.

Required Methods§

source

fn process_frame( &mut self, buffers: &[(BufferMetadata, &[f32])], ) -> (Vec<f32>, Vec<f32>)

Takes a slice of audio data tuples for each sound source. Each tuple contains 128 frames of float sound data and a BufferMetadata, which encodes the sound source’s location, range, and gain over that frame period.

Returns a pair of vectors containing the mixed binaural audio.

Invariant: All input buffers must be the same length, of 128

Provided Methods§

source

fn process( &mut self, buffers: &[(BufferMetadata, &[f32])], ) -> (Vec<f32>, Vec<f32>)

Takes a slice of audio data tuples for each sound source. Each tuple contains float sound data and a BufferMetadata, which encodes the sound source’s location, range, and gain over that frame period.

Implementors§