pub struct AudioFrame {
pub data: Bytes,
pub sample_rate: u32,
pub channels: u8,
pub duration_ms: u32,
}Available on crate feature
audio only.Expand description
The canonical audio buffer — raw PCM-16 LE samples with metadata.
All adk-audio components produce and consume AudioFrame values,
eliminating format negotiation between pipeline stages.
§Example
use adk_audio::AudioFrame;
let silence = AudioFrame::silence(16000, 1, 100);
assert_eq!(silence.sample_rate, 16000);
assert_eq!(silence.channels, 1);
assert_eq!(silence.duration_ms, 100);Fields§
§data: BytesRaw PCM-16 LE sample data.
sample_rate: u32Sample rate in Hz (e.g. 16000, 24000, 44100, 48000).
channels: u8Number of channels (1 = mono, 2 = stereo).
duration_ms: u32Duration in milliseconds, computed from data length.
Implementations§
Source§impl AudioFrame
impl AudioFrame
Trait Implementations§
Source§impl Clone for AudioFrame
impl Clone for AudioFrame
Source§fn clone(&self) -> AudioFrame
fn clone(&self) -> AudioFrame
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AudioFrame
impl Debug for AudioFrame
Source§impl PartialEq for AudioFrame
impl PartialEq for AudioFrame
Source§fn eq(&self, other: &AudioFrame) -> bool
fn eq(&self, other: &AudioFrame) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for AudioFrame
Auto Trait Implementations§
impl !Freeze for AudioFrame
impl RefUnwindSafe for AudioFrame
impl Send for AudioFrame
impl Sync for AudioFrame
impl Unpin for AudioFrame
impl UnsafeUnpin for AudioFrame
impl UnwindSafe for AudioFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more