pub struct AudioGenerator {
pub config: AudioConfig,
pub materials: Vec<AudioMaterial>,
pub events: Vec<AudioEvent>,
}Expand description
Audio event generator
Fields§
§config: AudioConfigConfiguration
materials: Vec<AudioMaterial>Per-body material (indexed by body ID)
events: Vec<AudioEvent>Generated audio events this frame
Implementations§
Source§impl AudioGenerator
impl AudioGenerator
Sourcepub fn new(num_bodies: usize, config: AudioConfig) -> Self
pub fn new(num_bodies: usize, config: AudioConfig) -> Self
Create a new audio generator for N bodies
Sourcepub fn set_material(&mut self, body_idx: usize, material: AudioMaterial)
pub fn set_material(&mut self, body_idx: usize, material: AudioMaterial)
Set material for a body
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Clear events for new frame
Sourcepub fn process_contact(
&mut self,
body_a: usize,
body_b: usize,
contact: &Contact,
relative_velocity: Vec3Fix,
is_new_contact: bool,
)
pub fn process_contact( &mut self, body_a: usize, body_b: usize, contact: &Contact, relative_velocity: Vec3Fix, is_new_contact: bool, )
Process a collision contact and generate audio event
Sourcepub fn get_events(&self) -> &[AudioEvent]
pub fn get_events(&self) -> &[AudioEvent]
Get all audio events for this frame
Auto Trait Implementations§
impl Freeze for AudioGenerator
impl RefUnwindSafe for AudioGenerator
impl Send for AudioGenerator
impl Sync for AudioGenerator
impl Unpin for AudioGenerator
impl UnsafeUnpin for AudioGenerator
impl UnwindSafe for AudioGenerator
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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