Struct ambient_api::prelude::audio::SpatialAudioPlayer
source · pub struct SpatialAudioPlayer {
pub player: EntityId,
}
Expand description
play spatial audio
Fields§
§player: EntityId
the entity that represents the spatial audio player
Implementations§
source§impl SpatialAudioPlayer
impl SpatialAudioPlayer
pub fn new() -> SpatialAudioPlayer
pub fn set_listener(&self, listener: EntityId)
pub fn set_emitter(&self, emitter: EntityId)
pub fn set_amplitude(&self, amp: f32)
pub fn set_looping(&self, val: bool)
pub fn play_sound_on_entity(&self, url: impl Into<String>, emitter: EntityId)
source§impl SpatialAudioPlayer
impl SpatialAudioPlayer
sourcepub fn oneshot(
position: Vec3,
url: impl Into<String>
) -> Option<SpatialAudioPlayer>
pub fn oneshot( position: Vec3, url: impl Into<String> ) -> Option<SpatialAudioPlayer>
Plays a sound at the given position. Note that the returned SpatialAudioPlayer
will be removed after 60 seconds.
If no camera is available as a listener, no player will be created.
Trait Implementations§
source§impl Clone for SpatialAudioPlayer
impl Clone for SpatialAudioPlayer
source§fn clone(&self) -> SpatialAudioPlayer
fn clone(&self) -> SpatialAudioPlayer
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 SpatialAudioPlayer
impl Debug for SpatialAudioPlayer
source§impl Default for SpatialAudioPlayer
impl Default for SpatialAudioPlayer
source§fn default() -> SpatialAudioPlayer
fn default() -> SpatialAudioPlayer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for SpatialAudioPlayer
impl Send for SpatialAudioPlayer
impl Sync for SpatialAudioPlayer
impl Unpin for SpatialAudioPlayer
impl UnwindSafe for SpatialAudioPlayer
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.