Skip to main content

AudioFrame

Struct AudioFrame 

Source
pub struct AudioFrame { /* private fields */ }

Implementations§

Source§

impl AudioFrame

Source

pub fn builder() -> AudioFrameBuilder

Create a builder for configuring an audio frame

Source

pub fn sample_rate(&self) -> i32

Get the sample rate in Hz.

Source

pub fn num_channels(&self) -> i32

Get the number of audio channels.

Source

pub fn num_samples(&self) -> i32

Get the number of samples per channel.

Source

pub fn timecode(&self) -> i64

Get the timecode.

A value of zero is passed through to the SDK as its default timestamp behavior.

Source

pub fn timestamp(&self) -> i64

Get the timestamp.

A value of zero is passed through to the SDK as its default timestamp behavior.

Source

pub fn format(&self) -> AudioFormat

Get the audio format.

Source

pub fn channel_stride_in_bytes(&self) -> i32

Get the channel stride in bytes.

Source

pub fn data(&self) -> &[f32]

Get audio data as 32-bit floats

Source

pub fn data_mut(&mut self) -> &mut [f32]

Get mutable audio sample data without changing the validated layout.

Source

pub fn replace_data(&mut self, data: Vec<f32>) -> Result<()>

Replace the owned audio data while preserving the validated layout.

§Errors

Returns Error::InvalidFrame if data is not exactly the validated sample count.

Source

pub fn metadata(&self) -> Option<&str>

Get frame metadata as UTF-8 text, if present.

Source

pub fn set_metadata<S: Into<String>>( &mut self, metadata: Option<S>, ) -> Result<()>

Replace frame metadata.

§Errors

Returns Error::InvalidCString if metadata contains an interior NUL byte, or Error::InvalidFrame if the emitted C string would exceed the metadata size cap.

Source

pub fn channel_data(&self, channel: usize) -> Option<Vec<f32>>

Get audio data for a specific channel

Data is always stored in planar format internally. If AudioLayout::Interleaved was specified at build time, the data was converted to planar during construction.

Trait Implementations§

Source§

impl Debug for AudioFrame

Source§

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

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

impl Default for AudioFrame

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for AudioFrame

Source§

fn drop(&mut self)

Executes the destructor for this type. 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 = 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.