pub struct CpalOutput { /* private fields */ }Available on crate feature
cpal-output only.Expand description
Audio output device impl using cpal.
Implementations§
Source§impl CpalOutput
impl CpalOutput
pub fn open() -> Result<Self, Error>
pub fn open_with_host(hostid: AudioHostId) -> Result<Self, Error>
Trait Implementations§
Source§impl OutputDevice for CpalOutput
impl OutputDevice for CpalOutput
Source§fn channel_count(&self) -> usize
fn channel_count(&self) -> usize
Returns the output buffer channel count (e.g., 1 for mono, 2 for stereo).
Source§fn sample_rate(&self) -> u32
fn sample_rate(&self) -> u32
Returns the output sample rate in Hz.
Source§fn sample_position(&self) -> u64
fn sample_position(&self) -> u64
Returns the current playhead position in samples (not frames).
Tracks the total number of samples output since device creation.
Source§fn set_volume(&mut self, volume: f32)
fn set_volume(&mut self, volume: f32)
Sets the output volume.
Source§fn is_suspended(&self) -> bool
fn is_suspended(&self) -> bool
Returns
true if audio output is suspended by the system.
Only relevant for web audio backends; always returns false for desktop backends.Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
Returns
true if audio is currently playing (not paused).Auto Trait Implementations§
impl Freeze for CpalOutput
impl !RefUnwindSafe for CpalOutput
impl Send for CpalOutput
impl Sync for CpalOutput
impl Unpin for CpalOutput
impl UnsafeUnpin for CpalOutput
impl !UnwindSafe for CpalOutput
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