pub struct AudioEncoder {
pub sample_rate: u32,
pub channels: u16,
pub bit_depth: u16,
}Expand description
Audio encoder/decoder
Fields§
§sample_rate: u32§channels: u16§bit_depth: u16Implementations§
Source§impl AudioEncoder
impl AudioEncoder
Sourcepub fn with_settings(sample_rate: u32, channels: u16, bit_depth: u16) -> Self
pub fn with_settings(sample_rate: u32, channels: u16, bit_depth: u16) -> Self
Create with custom settings
Sourcepub fn decode(&self, base64: &str) -> Result<Vec<u8>, DecodeError>
pub fn decode(&self, base64: &str) -> Result<Vec<u8>, DecodeError>
Decode base64 to audio bytes
Sourcepub fn from_float32(&self, samples: &[f32]) -> Vec<u8> ⓘ
pub fn from_float32(&self, samples: &[f32]) -> Vec<u8> ⓘ
Convert f32 samples to bytes for transmission
Sourcepub fn to_float32(&self, bytes: &[u8]) -> Vec<f32>
pub fn to_float32(&self, bytes: &[u8]) -> Vec<f32>
Convert received bytes to f32 samples
Trait Implementations§
Source§impl Clone for AudioEncoder
impl Clone for AudioEncoder
Source§fn clone(&self) -> AudioEncoder
fn clone(&self) -> AudioEncoder
Returns a duplicate of the value. Read more
1.0.0 · 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 AudioEncoder
impl Debug for AudioEncoder
Auto Trait Implementations§
impl Freeze for AudioEncoder
impl RefUnwindSafe for AudioEncoder
impl Send for AudioEncoder
impl Sync for AudioEncoder
impl Unpin for AudioEncoder
impl UnwindSafe for AudioEncoder
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