[−][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 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}; 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: (0.0, 0.0, 1.0), prev_sample_vector: (0.0, 0.0, 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);
Auto Trait Implementations
impl !RefUnwindSafe for HrtfProcessor
impl Send for HrtfProcessor
impl Sync for HrtfProcessor
impl Unpin for HrtfProcessor
impl !UnwindSafe for HrtfProcessor
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, 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,