pub struct AudioPlayer { /* private fields */ }Expand description
Incremental decoded PCM playback through the default output device.
Implementations§
Source§impl AudioPlayer
impl AudioPlayer
Sourcepub fn open(runtime: &Runtime, config: AudioPlayerConfig) -> Result<Self>
pub fn open(runtime: &Runtime, config: AudioPlayerConfig) -> Result<Self>
Open the source and default output device with decoding initially paused.
§Errors
Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Sourcepub fn new_from_uri(runtime: &Runtime, uri: impl AsRef<Path>) -> Result<Self>
pub fn new_from_uri(runtime: &Runtime, uri: impl AsRef<Path>) -> Result<Self>
Open a URI using the default playback configuration.
Sourcepub fn seek(&mut self, timestamp_us: u64) -> Result<()>
pub fn seek(&mut self, timestamp_us: u64) -> Result<()>
Seek to a timestamp in microseconds and wait for decoder acknowledgement.
pub fn set_loop(&self, enabled: bool)
pub fn set_muted(&self, muted: bool) -> Result<()>
Sourcepub fn close(&mut self) -> Result<()>
pub fn close(&mut self) -> Result<()>
Stop decoding and release the device at an explicit result-bearing boundary.
pub const fn is_open(&self) -> bool
pub fn is_playing(&self) -> bool
pub fn is_eos(&self) -> bool
pub fn is_muted(&self) -> bool
pub const fn sample_rate(&self) -> u32
pub const fn channel_count(&self) -> u32
pub const fn duration_us(&self) -> u64
pub fn position_us(&self) -> u64
pub fn underrun_frame_count(&self) -> u64
pub fn device_error_count(&self) -> u64
Trait Implementations§
Source§impl Drop for AudioPlayer
impl Drop for AudioPlayer
Auto Trait Implementations§
impl !RefUnwindSafe for AudioPlayer
impl !Send for AudioPlayer
impl !Sync for AudioPlayer
impl !UnwindSafe for AudioPlayer
impl Forget for AudioPlayer
impl Freeze for AudioPlayer
impl Move for AudioPlayer
impl Unpin for AudioPlayer
impl UnsafeUnpin for AudioPlayer
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