pub struct Device { /* private fields */ }Expand description
The multi-channel output (rodio).
Implementations§
Source§impl Device
impl Device
Sourcepub fn play(
&mut self,
sound: &Sound,
params: PlayParams,
) -> Result<Option<Channel>, String>
pub fn play( &mut self, sound: &Sound, params: PlayParams, ) -> Result<Option<Channel>, String>
Device::Play: start sound on the first free channel. Ok(None) when all 64 are
busy (the original returns null); Err when there is no audio output.
Sourcepub fn update(&mut self) -> Vec<Channel>
pub fn update(&mut self) -> Vec<Channel>
Device::Update: free the channels that finished, returning them (the end
callbacks).
Sourcepub fn is_playing(&self, c: Channel) -> bool
pub fn is_playing(&self, c: Channel) -> bool
Whether the channel is still allocated and has not finished.
Sourcepub fn is_active(&self, c: Channel) -> bool
pub fn is_active(&self, c: Channel) -> bool
Whether the channel is allocated and has not finished, paused or not.
Sourcepub fn position(&self, c: Channel) -> Duration
pub fn position(&self, c: Channel) -> Duration
Position in the sound (wrapped for looping channels).
Sourcepub fn seek(&mut self, c: Channel, position: Duration) -> Result<(), String>
pub fn seek(&mut self, c: Channel, position: Duration) -> Result<(), String>
Move a channel to a position in its sound.
Sourcepub fn set_volume(&mut self, c: Channel, volume: f32)
pub fn set_volume(&mut self, c: Channel, volume: f32)
Device::SetChannelVolume.
Sourcepub fn set_pitch(&mut self, c: Channel, semitones: f32)
pub fn set_pitch(&mut self, c: Channel, semitones: f32)
Change a channel’s pitch, in semitones.
Sourcepub fn set_looping(&mut self, c: Channel, looping: bool)
pub fn set_looping(&mut self, c: Channel, looping: bool)
Change whether a channel loops.
Sourcepub fn set_master_volume(&mut self, volume: f32)
pub fn set_master_volume(&mut self, volume: f32)
Scales every channel.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Device
impl !UnwindSafe for Device
impl Freeze for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl UnsafeUnpin for Device
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