pub struct Configurator<'a, T> { /* private fields */ }Available on crate feature
alsa only.Expand description
Implementations§
Source§impl<'a, T> Configurator<'a, T>where
T: Sample,
impl<'a, T> Configurator<'a, T>where
T: Sample,
Sourcepub fn access(self, access: Access) -> Self
pub fn access(self, access: Access) -> Self
Configure the stream access to use.
§Examples
use audio_device::alsa;
let mut pcm = alsa::Pcm::open_default(alsa::Stream::Playback)?;
let config = pcm.configure::<f32>()
.access(alsa::Access::MmapInterleaved)
.install()?;
dbg!(config);Sourcepub fn format(self, format: Format) -> Result<Self>
pub fn format(self, format: Format) -> Result<Self>
Configure the stream format to use.
This will check that the format is appropriate to use by the current sample. Inappropriate formats will be signalled with Error::FormatMismatch.
§Examples
use audio_device::alsa;
let mut pcm = alsa::Pcm::open_default(alsa::Stream::Playback)?;
let config = pcm.configure::<f32>()
.format(alsa::Format::FloatLE)?
.install()?;
dbg!(config);Sourcepub fn latency(self, latency: Duration) -> Self
pub fn latency(self, latency: Duration) -> Self
Configure the stream latency to use.
Will never accept a latency higher than 2**32. Anything larger will be floored to it.
§Examples
use audio_device::alsa;
let mut pcm = alsa::Pcm::open_default(alsa::Stream::Playback)?;
let config = pcm.configure::<f32>()
.latency(std::time::Duration::from_micros(500))
.install()?;
dbg!(config);Sourcepub fn channels(self, channels: c_uint) -> Self
pub fn channels(self, channels: c_uint) -> Self
Configure the number of channels to use.
§Examples
use audio_device::alsa;
let mut pcm = alsa::Pcm::open_default(alsa::Stream::Playback)?;
let config = pcm.configure::<f32>()
.channels(5)
.install()?;
dbg!(config);Sourcepub fn rate(self, rate: c_uint) -> Self
pub fn rate(self, rate: c_uint) -> Self
Configure the sample rate to use.
§Examples
use audio_device::alsa;
let mut pcm = alsa::Pcm::open_default(alsa::Stream::Playback)?;
let config = pcm.configure::<f32>()
.rate(48000)
.install()?;
dbg!(config);Sourcepub fn install(self) -> Result<Config>
pub fn install(self) -> Result<Config>
Install the current configuration and return the one which is used by the underlying PCM.
§Examples
use audio_device::alsa;
let mut pcm = alsa::Pcm::open_default(alsa::Stream::Playback)?;
let config = pcm.configure::<f32>()
.channels(2)
.rate(48000)
.install()?;
dbg!(config);Auto Trait Implementations§
impl<'a, T> Freeze for Configurator<'a, T>
impl<'a, T> RefUnwindSafe for Configurator<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Configurator<'a, T>where
T: Send,
impl<'a, T> !Sync for Configurator<'a, T>
impl<'a, T> Unpin for Configurator<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for Configurator<'a, T>
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