[−][src]Struct spectrusty_audio::host::cpal::AudioHandle
The struct for producing and controlling the audio playback.
It embeds the interconnected pair of carousel's AudioFrameProducer with the
AudioFrameConsumer directly exposing the producer
to the user. The consumer lives in the
cpal audio thread and is responsible for filling up the audio output buffer with sample data
sent from the producer
.
The T
parameter should be one of the [sample primitives][cpal::Sample].
Fields
sample_rate: u32
The audio sample frequency of the output stream.
channels: u8
The number of audio channels in the output stream.
producer: AudioFrameProducer<T>
The audio sample producer, interconnected with an audio consumer living in the audio thread.
Implementations
impl<T: Sample + AudioSample> AudioHandle<T>
[src]
pub fn play(&self) -> Result<(), AudioHandleError>
[src]
Starts playback of the audio device.
pub fn pause(&self) -> Result<(), AudioHandleError>
[src]
Pauses playback of the audio device.
pub fn close(self)
[src]
Closes audio playback and frees underlying resources.
pub fn create_with_device_and_config(
device: &Device,
config: &StreamConfig,
frame_duration_nanos: u32,
latency: usize
) -> Result<Self, AudioHandleError>
[src]
device: &Device,
config: &StreamConfig,
frame_duration_nanos: u32,
latency: usize
) -> Result<Self, AudioHandleError>
Creates an instance of the AudioHandle from the provided cpal device
with the
desired audio parameters.
config
specifies the desired audio parameters.frame_duration_nanos
is the duration in nanoseconds of the standard emulation frame.latency
is the audio latency passed to the create_carousel.
Auto Trait Implementations
impl<T> !RefUnwindSafe for AudioHandle<T>
impl<T> !Send for AudioHandle<T>
impl<T> !Sync for AudioHandle<T>
impl<T> Unpin for AudioHandle<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for AudioHandle<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<S, T> IntoSample<S> for T where
S: FromSample<T>,
[src]
S: FromSample<T>,
fn into_sample(self) -> S
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,