[−][src]Struct hrtf::HrtfProcessor
See module docs.
Implementations
impl HrtfProcessor
[src]
pub fn new(
hrir_sphere: HrirSphere,
interpolation_steps: usize,
block_len: usize
) -> Self
[src]
hrir_sphere: HrirSphere,
interpolation_steps: usize,
block_len: usize
) -> Self
Creates new HRTF processor using specified HRTF sphere. See module docs for more info.
interpolation_steps
is the amount of slices to cut source to.
block_len
is the length of each slice.
pub fn hrtf_sphere(&self) -> &HrtfSphere
[src]
Returns shared reference to current hrtf sphere.
pub fn process_samples<T: InterleavedSamples>(
&mut self,
context: HrtfContext<'_, '_, '_, T>
)
[src]
&mut self,
context: HrtfContext<'_, '_, '_, T>
)
Processes given input samples and sums processed signal with output buffer. This method designed
to be used in a loop, it requires some info from previous frame. Check HrtfContext
for more info.
Example
use hrtf::{HrirSphere, HrtfContext, HrtfProcessor, Vec3}; let hrir_sphere = HrirSphere::from_file("your_file", 44100).unwrap(); let mut processor = HrtfProcessor::new(hrir_sphere, 8, 128); let source = vec![0; 1024]; // Fill with something useful. let mut output = vec![(0.0, 0.0); 1024]; let mut prev_left_samples = vec![]; let mut prev_right_samples = vec![]; let context = HrtfContext { source: &source, output: &mut output, new_sample_vector: Vec3{x: 0.0, y: 0.0, z: 1.0}, prev_sample_vector: Vec3{x:0.0,y: 0.0, z: 1.0}, prev_left_samples: &mut prev_left_samples, prev_right_samples: &mut prev_right_samples, // For simplicity, keep gain at 1.0 so there will be no interpolation. new_distance_gain: 1.0, prev_distance_gain: 1.0 }; processor.process_samples(context);
Trait Implementations
impl Clone for HrtfProcessor
[src]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for HrtfProcessor
[src]
Auto Trait Implementations
impl !RefUnwindSafe for HrtfProcessor
[src]
impl Send for HrtfProcessor
[src]
impl Sync for HrtfProcessor
[src]
impl Unpin for HrtfProcessor
[src]
impl !UnwindSafe for HrtfProcessor
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,