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
impl AudioConverter
Sourcepub fn new(ndi: &Ndi) -> Result<Self>
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.
Sourcepub fn to_interleaved_i16(
&self,
source: &(impl AudioSource + ?Sized),
destination: &mut [i16],
reference_level: AudioReferenceLevel,
) -> Result<usize>
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.
Sourcepub fn from_interleaved_i16(
&self,
source: &InterleavedAudioI16<'_>,
) -> Result<AudioFrame>
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.
Sourcepub fn from_interleaved_i16_into(
&self,
source: &InterleavedAudioI16<'_>,
destination: &mut AudioFrame,
) -> Result<()>
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.
Sourcepub fn to_interleaved_i32(
&self,
source: &(impl AudioSource + ?Sized),
destination: &mut [i32],
reference_level: AudioReferenceLevel,
) -> Result<usize>
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.
Sourcepub fn from_interleaved_i32(
&self,
source: &InterleavedAudioI32<'_>,
) -> Result<AudioFrame>
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.
Sourcepub fn from_interleaved_i32_into(
&self,
source: &InterleavedAudioI32<'_>,
destination: &mut AudioFrame,
) -> Result<()>
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.
Sourcepub fn to_interleaved_f32(
&self,
source: &(impl AudioSource + ?Sized),
destination: &mut [f32],
) -> Result<usize>
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.
Sourcepub fn from_interleaved_f32(
&self,
source: &InterleavedAudioF32<'_>,
) -> Result<AudioFrame>
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.
Sourcepub fn from_interleaved_f32_into(
&self,
source: &InterleavedAudioF32<'_>,
destination: &mut AudioFrame,
) -> Result<()>
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.