pub struct VirtualHead {
pub position: Position3D,
pub orientation: Orientation3D,
pub ear_spacing: f32,
pub head_radius: f32,
}Expand description
Virtual head for binaural audio capture.
Fields§
§position: Position3DCenter position of the head (between ears)
orientation: Orientation3DHead orientation (yaw, pitch, roll)
ear_spacing: f32Distance between ears (default: 0.17m)
head_radius: f32Head radius for shadowing calculations (default: 0.0875m)
Implementations§
Source§impl VirtualHead
impl VirtualHead
Sourcepub fn new(position: Position3D) -> Self
pub fn new(position: Position3D) -> Self
Create a new virtual head at the given position.
Sourcepub fn with_ear_spacing(self, spacing: f32) -> Self
pub fn with_ear_spacing(self, spacing: f32) -> Self
Create a virtual head with custom ear spacing.
Sourcepub fn with_orientation(self, orientation: Orientation3D) -> Self
pub fn with_orientation(self, orientation: Orientation3D) -> Self
Set head orientation.
Sourcepub fn set_position(&mut self, pos: Position3D)
pub fn set_position(&mut self, pos: Position3D)
Move the head to a new position.
Sourcepub fn set_orientation(&mut self, orientation: Orientation3D)
pub fn set_orientation(&mut self, orientation: Orientation3D)
Rotate the head.
Sourcepub fn left_ear_position(&self) -> Position3D
pub fn left_ear_position(&self) -> Position3D
Get the position of the left ear.
Sourcepub fn right_ear_position(&self) -> Position3D
pub fn right_ear_position(&self) -> Position3D
Get the position of the right ear.
Sourcepub fn angle_to_source(&self, source: Position3D) -> (f32, f32)
pub fn angle_to_source(&self, source: Position3D) -> (f32, f32)
Calculate the angle to a sound source relative to the head’s forward direction.
Sourcepub fn calculate_itd(&self, source: Position3D, speed_of_sound: f32) -> f32
pub fn calculate_itd(&self, source: Position3D, speed_of_sound: f32) -> f32
Calculate ITD (Interaural Time Difference) for a source position.
Returns the time difference in seconds (positive = right ear leads).
Sourcepub fn calculate_ild(&self, source: Position3D) -> (f32, f32)
pub fn calculate_ild(&self, source: Position3D) -> (f32, f32)
Calculate ILD (Interaural Level Difference) for a source.
Returns the amplitude ratio (left/right) based on head shadow.
Trait Implementations§
Source§impl Clone for VirtualHead
impl Clone for VirtualHead
Source§fn clone(&self) -> VirtualHead
fn clone(&self) -> VirtualHead
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VirtualHead
impl Debug for VirtualHead
Auto Trait Implementations§
impl Freeze for VirtualHead
impl RefUnwindSafe for VirtualHead
impl Send for VirtualHead
impl Sync for VirtualHead
impl Unpin for VirtualHead
impl UnwindSafe for VirtualHead
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more