pub struct Wave { /* private fields */ }
Expand description
Wave, audio wave data
Implementations§
Source§impl Wave
impl Wave
Sourcepub fn frame_count(&self) -> u32
pub fn frame_count(&self) -> u32
Total number of frames (considering channels)
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Frequency (samples per second)
Sourcepub fn sample_size(&self) -> u32
pub fn sample_size(&self) -> u32
Bit depth (bits per sample): 8, 16, 32 (24 not supported)
Sourcepub fn from_memory(file_data: &[u8], format: AudioFormat) -> Option<Self>
pub fn from_memory(file_data: &[u8], format: AudioFormat) -> Option<Self>
Load wave from memory buffer
Sourcepub fn export(&self, file_name: &str) -> bool
pub fn export(&self, file_name: &str) -> bool
Export wave data to file, returns true on success
Sourcepub fn export_as_code(&self, file_name: &str) -> bool
pub fn export_as_code(&self, file_name: &str) -> bool
Export wave sample data to code (.h), returns true on success
Sourcepub fn crop(&mut self, init_sample: u32, final_sample: u32)
pub fn crop(&mut self, init_sample: u32, final_sample: u32)
Crop a wave to defined samples range
Sourcepub fn convert_to_format(
&mut self,
sample_rate: u32,
sample_size: u32,
channels: u32,
)
pub fn convert_to_format( &mut self, sample_rate: u32, sample_size: u32, channels: u32, )
Convert wave data to desired format
Sourcepub fn load_samples(&self) -> Vec<f32>
pub fn load_samples(&self) -> Vec<f32>
Load samples data from wave as a 32bit float data array
Sourcepub fn as_raw(&self) -> &Wave
pub fn as_raw(&self) -> &Wave
Get the ‘raw’ ffi type Take caution when cloning so it doesn’t outlive the original
Sourcepub fn as_raw_mut(&mut self) -> &mut Wave
pub fn as_raw_mut(&mut self) -> &mut Wave
Get the ‘raw’ ffi type Take caution when cloning so it doesn’t outlive the original
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Wave
impl RefUnwindSafe for Wave
impl !Send for Wave
impl !Sync for Wave
impl Unpin for Wave
impl UnwindSafe for Wave
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