Struct awedio::backends::CpalBackend
source · pub struct CpalBackend { /* private fields */ }
Expand description
A backend that uses cpal to output to devices.
This backend does not currently update the output device if the default output device of the host changes.
Implementations§
source§impl CpalBackend
impl CpalBackend
sourcepub fn with_defaults() -> Option<CpalBackend>
pub fn with_defaults() -> Option<CpalBackend>
Create a new CpalBackend with defaults for all fields.
Returns None if a default device or config could not be obtained.
sourcepub fn with_default_host_and_device(
channel_count: u16,
sample_rate: u32,
buffer_size: CpalBufferSize,
) -> Option<CpalBackend>
pub fn with_default_host_and_device( channel_count: u16, sample_rate: u32, buffer_size: CpalBufferSize, ) -> Option<CpalBackend>
Create a new backend.
Returns None if an output device is not found
sourcepub fn new(
channel_count: u16,
sample_rate: u32,
buffer_size: CpalBufferSize,
device: Device,
sample_format: SampleFormat,
) -> CpalBackend
pub fn new( channel_count: u16, sample_rate: u32, buffer_size: CpalBufferSize, device: Device, sample_format: SampleFormat, ) -> CpalBackend
Create a new CpalBackend specifying all fields.
source§impl CpalBackend
impl CpalBackend
sourcepub fn start<E>(
&mut self,
error_callback: E,
) -> Result<Manager, CpalBackendError>
pub fn start<E>( &mut self, error_callback: E, ) -> Result<Manager, CpalBackendError>
Start a cpal output stream and connect it to the returned Manager.
Only a single stream is supported at a time per CpalBackend object.
Cpal stream errors will be reported by calling error_callback
.
Auto Trait Implementations§
impl Freeze for CpalBackend
impl !RefUnwindSafe for CpalBackend
impl !Send for CpalBackend
impl !Sync for CpalBackend
impl Unpin for CpalBackend
impl !UnwindSafe 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