Struct ambient_api_core::prelude::audio::SpatialAudioPlayer
source · pub struct SpatialAudioPlayer {
pub player: EntityId,
}
Available on crate feature
client
only.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() -> Self
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
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