pub struct PlayerDevice<B: Backend> { /* private fields */ }Expand description
Implementations§
Source§impl<B: Backend> PlayerDevice<B>
impl<B: Backend> PlayerDevice<B>
Sourcepub const fn backend_mut(&mut self) -> &mut B
pub const fn backend_mut(&mut self) -> &mut B
The backend, for Player::load.
Sourcepub fn set_player(&mut self, player: Player<B>)
pub fn set_player(&mut self, player: Player<B>)
The game has loaded: player plays from now on.
Trait Implementations§
Source§impl<B: Backend> Audio for PlayerDevice<B>
impl<B: Backend> Audio for PlayerDevice<B>
Source§fn music_playing(&self, now: Millis) -> Option<(&str, f64)>
fn music_playing(&self, now: Millis) -> Option<(&str, f64)>
The music sounding at
now: its cue and the seconds since it really
started (once its file had loaded), or None in silence: nothing
asked for, a track still loading or whose file failed. Of two
tracks sounding (a crossfade), the newest: the old one until the
new one has loaded.Source§fn voice_playing(&self, now: Millis) -> Option<&str>
fn voice_playing(&self, now: Millis) -> Option<&str>
The voice clip sounding at
now, by its file
(SoundRequest::Voice), or asked for and still loading: None
once it has ended, and for a clip stopped, replaced, whose file
failed or that loaded too late to be played. A clip held by
suspend still sounds. None by default, for a
device that plays no voices.Source§fn play(&mut self, frame: &AudioFrame<'_>, now: Millis)
fn play(&mut self, frame: &AudioFrame<'_>, now: Millis)
Plays one frame’s
frame of audio at now: the volumes first, then
the requests and the music commands in order. It also checks on
what is still loading, so it is called every frame, with nothing to
play too.Source§fn stop_all(&mut self)
fn stop_all(&mut self)
Stops the music, the voice and the sounds started with a handle:
the game has quit.
Source§fn suspend(&mut self)
fn suspend(&mut self)
Holds everything sounding (the sounds started with a handle, the
voice and the music) while the system suspends the game
(
SystemEvent::Suspend); sound
cues played once finish. Pauses, or mutes where the backend can’t
pause. A second call does nothing. Read moreSource§fn resume(&mut self)
fn resume(&mut self)
Brings back what
suspend held, and leaves a
SoundRequest::PauseSounds pause in place. A call while not
suspended does nothing.Auto Trait Implementations§
impl<B> Freeze for PlayerDevice<B>
impl<B> RefUnwindSafe for PlayerDevice<B>where
B: RefUnwindSafe,
<B as Backend>::Loading: RefUnwindSafe,
<B as Backend>::Playing: RefUnwindSafe,
<B as Backend>::Sound: RefUnwindSafe,
impl<B> Send for PlayerDevice<B>
impl<B> Sync for PlayerDevice<B>
impl<B> Unpin for PlayerDevice<B>
impl<B> UnsafeUnpin for PlayerDevice<B>
impl<B> UnwindSafe for PlayerDevice<B>where
B: UnwindSafe,
<B as Backend>::Sound: RefUnwindSafe,
<B as Backend>::Playing: RefUnwindSafe + UnwindSafe,
<B as Backend>::Loading: RefUnwindSafe + UnwindSafe,
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