Struct ambient_api::prelude::audio::AudioPlayer
source · pub struct AudioPlayer {
pub entity: EntityId,
}
Expand description
Play the audio file at the given URL.
Fields§
§entity: EntityId
The entity that represents the audio player
Implementations§
source§impl AudioPlayer
impl AudioPlayer
sourcepub fn new() -> AudioPlayer
pub fn new() -> AudioPlayer
Create new audio player from URL
sourcepub fn set_looping(&self, val: bool)
pub fn set_looping(&self, val: bool)
Set the sound looping or not
sourcepub fn add_one_pole_lpf(&self, rolloff_freq: f32)
pub fn add_one_pole_lpf(&self, rolloff_freq: f32)
Add a simple onepole lowpass filter to the sound with one param: roll off frequency
sourcepub fn set_amplitude(&self, amp: f32)
pub fn set_amplitude(&self, amp: f32)
Set the amp/volume of the sound 0.0 is 0%, 1.0 is 100%
sourcepub fn set_panning(&self, pan: f32)
pub fn set_panning(&self, pan: f32)
Set the panning of the sound -1.0 is 100% left, 1.0 is 100% right.
Trait Implementations§
source§impl Clone for AudioPlayer
impl Clone for AudioPlayer
source§fn clone(&self) -> AudioPlayer
fn clone(&self) -> AudioPlayer
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for AudioPlayer
impl Debug for AudioPlayer
source§impl Default for AudioPlayer
impl Default for AudioPlayer
source§fn default() -> AudioPlayer
fn default() -> AudioPlayer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for AudioPlayer
impl Send for AudioPlayer
impl Sync for AudioPlayer
impl Unpin for AudioPlayer
impl UnwindSafe for AudioPlayer
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> Downcast for T
impl<T> Downcast for T
source§impl<T> ElementComponentName for T
impl<T> ElementComponentName for T
source§fn element_component_name(&self) -> &'static str
fn element_component_name(&self) -> &'static str
Returns the name of the type implementing ElementComponent.