Struct spa_io_rate_match

Source
#[repr(C)]
pub struct spa_io_rate_match { pub delay: u32, pub size: u32, pub rate: f64, pub flags: u32, pub delay_frac: i32, pub padding: [u32; 6], }
Expand description

Rate matching.

It is usually set on the nodes that process resampled data, by the component (audioadapter) that handles resampling between graph and node rates. The \a flags and \a rate fields may be modified by the node.

The node can request a correction to the resampling rate in its process(), by setting \ref SPA_IO_RATE_MATCH_ACTIVE on \a flags, and setting \a rate to the desired rate correction. Usually the rate is obtained from DLL or other adaptive mechanism that e.g. drives the node buffer fill level toward a specific value.

When resampling to (graph->node) direction, the number of samples produced by the resampler varies on each cycle, as the rates are not commensurate.

When resampling to (node->graph) direction, the number of samples consumed by the resampler varies. Node output ports in process() should produce \a size number of samples to match what the resampler needs to produce one graph quantum of output samples.

Resampling filters introduce processing delay, given by \a delay and \a delay_frac, in samples at node rate. The delay varies on each cycle e.g. when resampling between noncommensurate rates.

The first sample output (graph->node) or consumed (node->graph) by the resampler is offset by \a delay + \a delay_frac / 1e9 node samples relative to the nominal graph cycle start position:

\code{.unparsed} first_resampled_sample_nsec = first_original_sample_nsec

  • (rate_match->delay * SPA_NSEC_PER_SEC + rate_match->delay_frac) / node_rate \endcode

Fields§

§delay: u32

< resampling delay, in samples at node rate

§size: u32

< requested input size for resampler

§rate: f64

< rate for resampler (set by node)

§flags: u32

< extra flags (set by node)

§delay_frac: i32

< resampling delay fractional part, in units of nanosamples (1/10^9 sample) at node rate

§padding: [u32; 6]

Trait Implementations§

Source§

impl Clone for spa_io_rate_match

Source§

fn clone(&self) -> spa_io_rate_match

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for spa_io_rate_match

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for spa_io_rate_match

Source§

fn eq(&self, other: &spa_io_rate_match) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for spa_io_rate_match

Source§

impl StructuralPartialEq for spa_io_rate_match

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.