SoftwareParametersMut

Struct SoftwareParametersMut 

Source
pub struct SoftwareParametersMut<'a> { /* private fields */ }
Available on crate feature alsa only.
Expand description

Collection of mutable software parameters being configured for a Pcm handle.

See Pcm::software_parameters_mut.

Implementations§

Source§

impl<'a> SoftwareParametersMut<'a>

Source

pub fn install(self) -> Result<()>

Install PCM software configuration defined by params.

§Examples
use audio_device::alsa;

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

sw.set_timestamp_mode(alsa::Timestamp::Enable)?;
sw.install()?;
Source

pub fn set_timestamp_mode(&mut self, timestamp_mode: Timestamp) -> Result<()>

Set timestamp mode inside a software configuration container.

§Examples
use audio_device::alsa;

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

sw.set_timestamp_mode(alsa::Timestamp::Enable)?;
Source

pub fn set_timestamp_type( &mut self, timestamp_type: TimestampType, ) -> Result<()>

Set timestamp type inside a software configuration container.

§Examples
use audio_device::alsa;

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

sw.set_timestamp_type(alsa::TimestampType::Monotonic)?;
Source

pub fn set_available_min(&mut self, available_min: c_ulong) -> Result<()>

Set avail min inside a software configuration container.

This is similar to setting an OSS wakeup point. The valid values for ‘val’ are determined by the specific hardware. Most PC sound cards can only accept power of 2 frame counts (i.e. 512, 1024, 2048). You cannot use this as a high resolution timer - it is limited to how often the sound card hardware raises an interrupt.

§Examples
use audio_device::alsa;

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

sw.set_available_min(1000)?;
Source

pub fn set_period_event(&mut self, period_event: c_int) -> Result<()>

Set period event inside a software configuration container.

An poll (select) wakeup event is raised if enabled.

§Examples
use audio_device::alsa;

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

sw.set_period_event(0)?;
Source

pub fn set_start_threshold(&mut self, start_threshold: c_ulong) -> Result<()>

Set start threshold inside a software configuration container.

§Examples
use audio_device::alsa;

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

sw.set_start_threshold(0)?;
Source

pub fn set_stop_threshold(&mut self, stop_threshold: c_ulong) -> Result<()>

Set stop threshold inside a software configuration container.

§Examples
use audio_device::alsa;

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

sw.set_stop_threshold(0)?;
Source

pub fn set_silence_threshold( &mut self, silence_threshold: c_ulong, ) -> Result<()>

Set silence threshold inside a software configuration container.

§Examples
use audio_device::alsa;

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

sw.set_silence_threshold(0)?;
Source

pub fn set_silence_size(&mut self, silence_size: c_ulong) -> Result<()>

Set silence size inside a software configuration container.

A portion of playback buffer is overwritten with silence when playback underrun is nearer than silence threshold (see snd_pcm_sw_params_set_silence_threshold)

The special case is when silence size value is equal or greater than boundary. The unused portion of the ring buffer (initial written samples are untouched) is filled with silence at start. Later, only just processed sample area is filled with silence. Note: silence_threshold must be set to zero.

§Examples
use audio_device::alsa;

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

sw.set_silence_size(0)?;

Methods from Deref<Target = SoftwareParameters>§

Source

pub fn boundary(&self) -> Result<c_ulong>

Get boundary for ring pointers from a software configuration container.

§Examples
use audio_device::alsa;

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

let boundary = sw.boundary()?;
dbg!(boundary);
Source

pub fn timestamp_mode(&self) -> Result<Timestamp>

Get timestamp mode from a software configuration container.

§Examples
use audio_device::alsa;

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

let timestamp_mode = sw.timestamp_mode()?;
dbg!(timestamp_mode);
Source

pub fn timestamp_type(&self) -> Result<TimestampType>

Get timestamp type from a software configuration container.

§Examples
use audio_device::alsa;

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

let value = sw.timestamp_type()?;
dbg!(value);
Source

pub fn available_min(&self) -> Result<c_ulong>

Get avail min from a software configuration container.

§Examples
use audio_device::alsa;

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

let available_min = sw.available_min()?;
dbg!(available_min);
Source

pub fn period_event(&self) -> Result<c_int>

Get period event from a software configuration container.

§Examples
use audio_device::alsa;

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

let value = sw.period_event()?;
Source

pub fn start_threshold(&self) -> Result<c_ulong>

Get start threshold from a software configuration container.

§Examples
use audio_device::alsa;

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

let value = sw.start_threshold()?;
Source

pub fn stop_threshold(&self) -> Result<c_ulong>

Get stop threshold from a software configuration container.

§Examples
use audio_device::alsa;

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

let value = sw.stop_threshold()?;
Source

pub fn silence_threshold(&self) -> Result<c_ulong>

Get silence threshold from a software configuration container.

A portion of playback buffer is overwritten with silence (see set_silence_size) when playback underrun is nearer than silence threshold.

§Examples
use audio_device::alsa;

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

let value = sw.silence_threshold()?;
Source

pub fn silence_size(&self) -> Result<c_ulong>

Get silence size from a software configuration container.

§Examples
use audio_device::alsa;

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

let value = sw.silence_size()?;

Trait Implementations§

Source§

impl Deref for SoftwareParametersMut<'_>

Source§

type Target = SoftwareParameters

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.