pub struct CpalAudioSource { /* private fields */ }Expand description
Production AudioSource backed by a cpal input stream.
Opens the default input device (or the named device matching --device),
builds a stream at the device’s default config, and feeds the f32-coerced
samples through a lock-free SPSC ring buffer to the consumer side. The
cpal callback runs on cpal’s own audio thread and must never block;
resampling/idle detection/writing all happen on the consumer side.
Implementations§
Source§impl CpalAudioSource
impl CpalAudioSource
Sourcepub fn new(device_name: Option<&str>) -> Result<Self>
pub fn new(device_name: Option<&str>) -> Result<Self>
Opens the default input device (or the device matching
device_name, if provided) and starts a stream at its native rate
and channel count.
device_name matching is exact (case-sensitive) against
Device::name() — cpal reports platform-native names which differ
across macOS/Linux/Windows, so users get an error listing every
detected device when no match is found.
Trait Implementations§
Source§impl AudioSource for CpalAudioSource
impl AudioSource for CpalAudioSource
Auto Trait Implementations§
impl !Freeze for CpalAudioSource
impl !RefUnwindSafe for CpalAudioSource
impl Send for CpalAudioSource
impl !Sync for CpalAudioSource
impl Unpin for CpalAudioSource
impl UnsafeUnpin for CpalAudioSource
impl !UnwindSafe for CpalAudioSource
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more