Struct hrtf::HrirSphere
source · pub struct HrirSphere { /* private fields */ }
Expand description
HRIR (Head-Related Impulse Response) spheres is a 3d mesh whose points contains impulse responses for left and right ears. It is used for interpolation of impulse responses.
Implementations§
source§impl HrirSphere
impl HrirSphere
sourcepub fn from_file<P: AsRef<Path>>(
path: P,
device_sample_rate: u32
) -> Result<Self, HrtfError>
pub fn from_file<P: AsRef<Path>>( path: P, device_sample_rate: u32 ) -> Result<Self, HrtfError>
Tries to load a sphere from a file.
sourcepub fn new<R: Read>(
reader: R,
device_sample_rate: u32
) -> Result<Self, HrtfError>
pub fn new<R: Read>( reader: R, device_sample_rate: u32 ) -> Result<Self, HrtfError>
Loads HRIR sphere from given source.
Coordinate system
Hrtf spheres made in right-handed coordinate system. This fact can give weird positioning issues if your application uses left-handed coordinate system. However this can be fixed very easily: iterate over every point and invert X coordinate of it.
Sample rate
HRIR spheres from this base recorded in 44100 Hz sample rate. If your output device uses different sample rate, you have to resample initial set of .wav files and regenerate HRIR spheres. There could
sourcepub fn transform(&mut self, matrix: &[f32; 16])
pub fn transform(&mut self, matrix: &[f32; 16])
Applies specified transform to each point in sphere. Can be used to rotate or scale sphere. Transform shouldn’t have translation part, otherwise result of bilinear sampling is undefined.
sourcepub fn points_mut(&mut self) -> &mut [HrirPoint]
pub fn points_mut(&mut self) -> &mut [HrirPoint]
Returns mutable reference to sphere points array.
Trait Implementations§
source§impl Clone for HrirSphere
impl Clone for HrirSphere
source§fn clone(&self) -> HrirSphere
fn clone(&self) -> HrirSphere
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more