Struct ggez::audio::SpatialSource
source · pub struct SpatialSource { /* private fields */ }
Expand description
A source of audio data located in space relative to a listener’s ears. Will stop playing when dropped.
Implementations§
source§impl SpatialSource
impl SpatialSource
sourcepub fn new<P: AsRef<Path>>(
fs: &impl Has<Filesystem>,
audio: &impl Has<AudioContext>,
path: P
) -> GameResult<Self>
pub fn new<P: AsRef<Path>>( fs: &impl Has<Filesystem>, audio: &impl Has<AudioContext>, path: P ) -> GameResult<Self>
Create a new SpatialSource
from the given file.
sourcepub fn from_data(
audio: &impl Has<AudioContext>,
data: SoundData
) -> GameResult<Self>
pub fn from_data( audio: &impl Has<AudioContext>, data: SoundData ) -> GameResult<Self>
Creates a new SpatialSource
using the given SoundData
object.
Trait Implementations§
source§impl Debug for SpatialSource
impl Debug for SpatialSource
source§impl SoundSource for SpatialSource
impl SoundSource for SpatialSource
source§fn play_later(&self) -> GameResult
fn play_later(&self) -> GameResult
Plays the SpatialSource
; waits until done if the sound is currently playing.
source§fn play_detached(&mut self, audio: &impl Has<AudioContext>) -> GameResult
fn play_detached(&mut self, audio: &impl Has<AudioContext>) -> GameResult
Play source “in the background”; cannot be stopped
source§fn set_repeat(&mut self, repeat: bool)
fn set_repeat(&mut self, repeat: bool)
Sets the source to repeat playback infinitely on next
play()
source§fn set_fade_in(&mut self, dur: Duration)
fn set_fade_in(&mut self, dur: Duration)
Sets the fade-in time of the source
source§fn set_start(&mut self, dur: Duration)
fn set_start(&mut self, dur: Duration)
Sets the time from which playback begins, skipping audio up to that point. Read more
source§fn stop(&mut self, audio: &impl Has<AudioContext>) -> GameResult
fn stop(&mut self, audio: &impl Has<AudioContext>) -> GameResult
Stops playback
source§fn stopped(&self) -> bool
fn stopped(&self) -> bool
Returns whether or not the source is stopped
– that is, has no more data to play.
source§fn set_volume(&mut self, value: f32)
fn set_volume(&mut self, value: f32)
Sets the current volume.
source§fn playing(&self) -> bool
fn playing(&self) -> bool
Get whether or not the source is playing (ie, not paused
and not stopped).
source§fn set_query_interval(&mut self, t: Duration)
fn set_query_interval(&mut self, t: Duration)
Set the update interval of the internal sample counter. Read more
source§fn play(&mut self, audio: &impl Has<AudioContext>) -> GameResult
fn play(&mut self, audio: &impl Has<AudioContext>) -> GameResult
Plays the audio source; restarts the sound if currently playing
Auto Trait Implementations§
impl RefUnwindSafe for SpatialSource
impl Send for SpatialSource
impl Sync for SpatialSource
impl Unpin for SpatialSource
impl UnwindSafe for SpatialSource
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
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
source§impl<T> HasMut<T> for T
impl<T> HasMut<T> for T
source§fn retrieve_mut(&mut self) -> &mut T
fn retrieve_mut(&mut self) -> &mut T
Method to retrieve the context type as mutable.