Skip to main content

AudioConverter

Struct AudioConverter 

Source
pub struct AudioConverter { /* private fields */ }
Expand description

Native audio conversion operations, resolved together from one live runtime.

Construction fails if any current v3 conversion helper is missing. Methods take caller-owned output storage for reuse. For a runtime-free floating-point conversion, use AudioFrame::from_interleaved.

Implementations§

Source§

impl AudioConverter

Source

pub fn new(ndi: &Ndi) -> Result<Self>

Resolve the complete current conversion group before exposing operations.

§Errors

Returns Error::UnsupportedCapability when the runtime does not provide the complete native audio-conversion group.

Source

pub fn to_interleaved_i16( &self, source: &(impl AudioSource + ?Sized), destination: &mut [i16], reference_level: AudioReferenceLevel, ) -> Result<usize>

Convert FLTP samples into the active prefix of reusable interleaved storage. Returns the number of elements written; excess destination elements are untouched. Integer output can clip depending on the explicit reference level. On native failure the active prefix may be partially modified. Accepts every AudioSource, preserving the original channel stride without allocating or first copying captured samples into owned FLTP.

Source

pub fn from_interleaved_i16( &self, source: &InterleavedAudioI16<'_>, ) -> Result<AudioFrame>

Allocate a tightly packed FLTP frame with the source timecode. Interleaved headers have no metadata or timestamp; those output fields use the ordinary AudioFrame defaults.

Source

pub fn from_interleaved_i16_into( &self, source: &InterleavedAudioI16<'_>, destination: &mut AudioFrame, ) -> Result<()>

Replace samples in an existing FLTP frame with matching dimensions and sample rate. Its timecode, metadata and timestamp remain unchanged. On native failure sample storage may be partially modified.

Source

pub fn to_interleaved_i32( &self, source: &(impl AudioSource + ?Sized), destination: &mut [i32], reference_level: AudioReferenceLevel, ) -> Result<usize>

Convert FLTP samples into the active prefix of reusable interleaved storage. Returns the number of elements written; excess destination elements are untouched. Integer output can clip depending on the explicit reference level. On native failure the active prefix may be partially modified. Accepts every AudioSource, preserving the original channel stride without allocating or first copying captured samples into owned FLTP.

Source

pub fn from_interleaved_i32( &self, source: &InterleavedAudioI32<'_>, ) -> Result<AudioFrame>

Allocate a tightly packed FLTP frame with the source timecode. Interleaved headers have no metadata or timestamp; those output fields use the ordinary AudioFrame defaults.

Source

pub fn from_interleaved_i32_into( &self, source: &InterleavedAudioI32<'_>, destination: &mut AudioFrame, ) -> Result<()>

Replace samples in an existing FLTP frame with matching dimensions and sample rate. Its timecode, metadata and timestamp remain unchanged. On native failure sample storage may be partially modified.

Source

pub fn to_interleaved_f32( &self, source: &(impl AudioSource + ?Sized), destination: &mut [f32], ) -> Result<usize>

Convert FLTP samples into the active prefix of reusable interleaved storage. Returns the number of elements written; excess destination elements are untouched. Integer output can clip depending on the explicit reference level. On native failure the active prefix may be partially modified. Accepts every AudioSource, preserving the original channel stride without allocating or first copying captured samples into owned FLTP.

Source

pub fn from_interleaved_f32( &self, source: &InterleavedAudioF32<'_>, ) -> Result<AudioFrame>

Allocate a tightly packed FLTP frame with the source timecode. Interleaved headers have no metadata or timestamp; those output fields use the ordinary AudioFrame defaults.

Source

pub fn from_interleaved_f32_into( &self, source: &InterleavedAudioF32<'_>, destination: &mut AudioFrame, ) -> Result<()>

Replace samples in an existing FLTP frame with matching dimensions and sample rate. Its timecode, metadata and timestamp remain unchanged. On native failure sample storage may be partially modified.

Trait Implementations§

Source§

impl Debug for AudioConverter

Source§

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

Formats the value using the given formatter. Read more

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.