pub struct AudioData {
pub samples: Vec<f32>,
pub sample_rate: u32,
pub channels: u16,
}Expand description
Core audio data container for WAV-based DSP workflows.
Stores interleaved 32-bit float samples with associated sample rate and channel count.
Optimized for in-memory processing and compatibility with signal_processing operations.
§Fields
samples: Interleavedf32sample buffer (e.g.,[L1, R1, L2, R2...]for stereo)sample_rate: Samples per second (Hz)channels: Number of channels (1 = mono, 2 = stereo)
Fields§
§samples: Vec<f32>§sample_rate: u32§channels: u16Implementations§
Source§impl AudioData
impl AudioData
Sourcepub fn new(samples: Vec<f32>, sample_rate: u32, channels: u16) -> Self
pub fn new(samples: Vec<f32>, sample_rate: u32, channels: u16) -> Self
Constructs an AudioData instance from raw components.
§Parameters
samples: Interleavedf32sample buffersample_rate: Sample rate in Hzchannels: Channel count
§Returns
Initialized AudioData instance
§Example
use crate::core::AudioData;
let audio = AudioData::new(
vec![0.5, -0.3, 0.8], // 3 mono samples
44100, // 44.1 kHz
1 // Mono
);
assert_eq!(audio.samples.len(), 3);
assert_eq!(audio.sample_rate, 44100);
assert_eq!(audio.channels, 1);Trait Implementations§
Auto Trait Implementations§
impl Freeze for AudioData
impl RefUnwindSafe for AudioData
impl Send for AudioData
impl Sync for AudioData
impl Unpin for AudioData
impl UnwindSafe for AudioData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more