Struct audio_device::alsa::Configurator[][src]

pub struct Configurator<'a, T> { /* fields omitted */ }
This is supported on crate feature alsa only.

A simple Pcm stream configuration.

Examples

use audio_device::alsa;

let mut pcm = alsa::Pcm::open_default(alsa::Stream::Playback)?;

let config = pcm.configure::<f32>()
    .rate(48000)
    .channels(5)
    .install()?;

dbg!(config);

Implementations

impl<'a, T> Configurator<'a, T> where
    T: Sample
[src]

pub fn access(self, access: Access) -> Self[src]

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);

pub fn format(self, format: Format) -> Result<Self>[src]

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);

pub fn latency(self, latency: Duration) -> Self[src]

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);

pub fn channels(self, channels: c_uint) -> Self[src]

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);

pub fn rate(self, rate: c_uint) -> Self[src]

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);

pub fn install(self) -> Result<Config>[src]

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> 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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.