Struct hrtf::HrtfContext

source ·
pub struct HrtfContext<'a, 'b, 'c, T: InterleavedSamples> {
    pub source: &'a [T],
    pub output: &'b mut [(f32, f32)],
    pub new_sample_vector: Vec3,
    pub prev_sample_vector: Vec3,
    pub prev_left_samples: &'c mut Vec<f32>,
    pub prev_right_samples: &'c mut Vec<f32>,
    pub new_distance_gain: f32,
    pub prev_distance_gain: f32,
}
Expand description

Contains all input parameters for HRTF signal processing.

Fields§

§source: &'a [T]

Source of interleaved samples to be processed. HRTF works only with mono sources, so source must implement InterleavedSamples trait which must provide sample from left channel only. Source must have interpolation_steps * block_len length!

§output: &'b mut [(f32, f32)]

An output buffer to write processed samples to. It must be stereo buffer, processed samples will be mixed with samples in output buffer.

§new_sample_vector: Vec3

New sampling vector. It must be a vector from a sound source position to a listener. If your listener has orientation, then you should transform this vector into a listener space first.

§prev_sample_vector: Vec3

Sampling vector from previous frame.

§prev_left_samples: &'c mut Vec<f32>

Left channel samples from last frame. It is used for continuous convolution. It must point to unique buffer which associated with a single sound source.

§prev_right_samples: &'c mut Vec<f32>

Right channel samples from last frame. It is used for continuous convolution. It must point to unique buffer which associated with a single sound source.

§new_distance_gain: f32

New distance gain for given slice. It is used to interpolate gain so output signal will have smooth transition from frame to frame. It is very important for click-free processing.

§prev_distance_gain: f32

Distance gain from previous frame. It is used to interpolate gain so output signal will have smooth transition from frame to frame. It is very important for click-free processing.

Auto Trait Implementations§

§

impl<'a, 'b, 'c, T> RefUnwindSafe for HrtfContext<'a, 'b, 'c, T>where T: RefUnwindSafe,

§

impl<'a, 'b, 'c, T> Send for HrtfContext<'a, 'b, 'c, T>where T: Sync,

§

impl<'a, 'b, 'c, T> Sync for HrtfContext<'a, 'b, 'c, T>where T: Sync,

§

impl<'a, 'b, 'c, T> Unpin for HrtfContext<'a, 'b, 'c, T>

§

impl<'a, 'b, 'c, T> !UnwindSafe for HrtfContext<'a, 'b, 'c, T>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.