Struct BinauralDecoderBlock

Source
pub struct BinauralDecoderBlock<S>
where S: Sample,
{ /* private fields */ }
Expand description

Decodes multi-channel audio to stereo for headphone listening.

Supports ambisonic B-format (1st, 2nd, 3rd order) and can be configured to use either lightweight matrix decoding or full HRTF convolution.

§Supported Input Formats

  • Ambisonics: FOA (4 ch), SOA (9 ch), TOA (16 ch)
  • Surround: 5.1 (6 ch), 7.1 (8 ch)

§Output

Always stereo (2 channels): Left, Right

§Example

use bbx_dsp::blocks::effectors::binaural_decoder::{BinauralDecoderBlock, BinauralStrategy};

// Create HRTF decoder (default)
let hrtf_decoder = BinauralDecoderBlock::<f32>::new(1);

// Create lightweight matrix decoder
let matrix_decoder = BinauralDecoderBlock::<f32>::with_strategy(1, BinauralStrategy::Matrix);

Implementations§

Source§

impl<S> BinauralDecoderBlock<S>
where S: Sample,

Source

pub fn new(order: usize) -> BinauralDecoderBlock<S>

Create a new binaural decoder for ambisonics with the default strategy (HRTF).

§Arguments
  • order - Ambisonic order (1, 2, or 3)
§Panics

Panics if order is not 1, 2, or 3.

Source

pub fn with_strategy( order: usize, strategy: BinauralStrategy, ) -> BinauralDecoderBlock<S>

Create a new binaural decoder for ambisonics with a specific strategy.

§Arguments
  • order - Ambisonic order (1, 2, or 3)
  • strategy - The decoding strategy to use
§Panics

Panics if order is not 1, 2, or 3.

Source

pub fn new_surround( channel_count: usize, strategy: BinauralStrategy, ) -> BinauralDecoderBlock<S>

Create a new binaural decoder for surround sound.

§Arguments
  • channel_count - Number of input channels (6 for 5.1, 8 for 7.1)
  • strategy - The decoding strategy to use
§Panics

Panics if channel_count is not 6 or 8.

Source

pub fn order(&self) -> usize

Returns the ambisonic order (for ambisonic inputs).

Returns 0 for surround inputs.

Source

pub fn strategy(&self) -> BinauralStrategy

Returns the current decoding strategy.

Source

pub fn reset(&mut self)

Reset the HRTF convolver state (clears convolution buffers).

Trait Implementations§

Source§

impl<S> Block<S> for BinauralDecoderBlock<S>
where S: Sample,

Source§

fn process( &mut self, inputs: &[&[S]], outputs: &mut [&mut [S]], _modulation_values: &[S], _context: &DspContext, )

Process audio through this block. Read more
Source§

fn input_count(&self) -> usize

Returns the number of input ports this block accepts.
Source§

fn output_count(&self) -> usize

Returns the number of output ports this block produces.
Source§

fn modulation_outputs(&self) -> &[ModulationOutput]

Returns the modulation outputs this block provides. Read more
Source§

fn channel_config(&self) -> ChannelConfig

Returns how this block handles multi-channel audio. Read more
Source§

fn set_smoothing(&mut self, _sample_rate: f64, _ramp_time_ms: f64)

Configure smoothing time for parameter changes. Read more
Source§

impl<S> From<BinauralDecoderBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: BinauralDecoderBlock<S>) -> BlockType<S>

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.