pub struct AudioFrame { /* private fields */ }Implementations§
Source§impl AudioFrame
impl AudioFrame
Sourcepub fn builder() -> AudioFrameBuilder
pub fn builder() -> AudioFrameBuilder
Create a builder for configuring an audio frame
Sourcepub fn sample_rate(&self) -> i32
pub fn sample_rate(&self) -> i32
Get the sample rate in Hz.
Sourcepub fn num_channels(&self) -> i32
pub fn num_channels(&self) -> i32
Get the number of audio channels.
Sourcepub fn num_samples(&self) -> i32
pub fn num_samples(&self) -> i32
Get the number of samples per channel.
Sourcepub fn timecode(&self) -> i64
pub fn timecode(&self) -> i64
Get the timecode.
A value of zero is passed through to the SDK as its default timestamp behavior.
Sourcepub fn timestamp(&self) -> i64
pub fn timestamp(&self) -> i64
Get the timestamp.
A value of zero is passed through to the SDK as its default timestamp behavior.
Sourcepub fn format(&self) -> AudioFormat
pub fn format(&self) -> AudioFormat
Get the audio format.
Sourcepub fn channel_stride_in_bytes(&self) -> i32
pub fn channel_stride_in_bytes(&self) -> i32
Get the channel stride in bytes.
Sourcepub fn data_mut(&mut self) -> &mut [f32]
pub fn data_mut(&mut self) -> &mut [f32]
Get mutable audio sample data without changing the validated layout.
Sourcepub fn replace_data(&mut self, data: Vec<f32>) -> Result<()>
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.
Sourcepub fn set_metadata<S: Into<String>>(
&mut self,
metadata: Option<S>,
) -> Result<()>
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.