pub struct CpalBackend { /* private fields */ }Expand description
Real audio backend using cpal.
Implementations§
Source§impl CpalBackend
impl CpalBackend
Sourcepub fn new(_desired_sample_rate: u32, _desired_buffer_size: u32) -> Result<Self>
pub fn new(_desired_sample_rate: u32, _desired_buffer_size: u32) -> Result<Self>
Create a new cpal backend. Does NOT start the stream yet.
Sourcepub fn start<F>(&mut self, callback: F) -> Result<()>
pub fn start<F>(&mut self, callback: F) -> Result<()>
Start the audio stream, calling callback for each buffer.
The callback receives an interleaved f32 buffer: [L, R, L, R, …]
pub fn stop(&mut self)
pub fn sample_rate(&self) -> u32
pub fn channels(&self) -> u16
Trait Implementations§
Source§impl Drop for CpalBackend
impl Drop for CpalBackend
Auto Trait Implementations§
impl !RefUnwindSafe for CpalBackend
impl !Send for CpalBackend
impl !Sync for CpalBackend
impl !UnwindSafe for CpalBackend
impl Freeze for CpalBackend
impl Unpin for CpalBackend
impl UnsafeUnpin for CpalBackend
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