pub struct Spec {
pub channels: u16,
pub channel_mask: u32,
pub sample_rate: u32,
pub bits_per_sample: u16,
pub sample_format: SampleFormat,
}
Expand description
- The spec info for a generic audio file.
Fields§
§channels: u16
- Num channels
channel_mask: u32
- The channel mask indicates the position of the speakers.
sample_rate: u32
- The sample rate. How many audio frames are to be played in a second.
bits_per_sample: u16
- For PCM, this indicates how many bits is for a sample.
sample_format: SampleFormat
- The roughly described sample format
Implementations§
Source§impl Spec
impl Spec
pub fn new() -> Self
Sourcepub fn get_sample_type(&self) -> WaveSampleType
pub fn get_sample_type(&self) -> WaveSampleType
- Get the concrete sample type
Sourcepub fn guess_channel_mask(&self) -> Result<u32, AudioError>
pub fn guess_channel_mask(&self) -> Result<u32, AudioError>
- Guess the channel mask
Sourcepub fn channel_mask_to_speaker_positions(&self) -> Vec<u32>
pub fn channel_mask_to_speaker_positions(&self) -> Vec<u32>
- Break down a channel mask to the speaker positions.
Sourcepub fn channel_mask_to_speaker_positions_descs(&self) -> Vec<&'static str>
pub fn channel_mask_to_speaker_positions_descs(&self) -> Vec<&'static str>
- Break down a channel mask to the speaker position description strings.
Sourcepub fn verify_for_pcm(&self) -> Result<(), AudioError>
pub fn verify_for_pcm(&self) -> Result<(), AudioError>
- Check if this spec is good for encoding PCM format.
Sourcepub fn is_channel_mask_valid(&self) -> bool
pub fn is_channel_mask_valid(&self) -> bool
- Check if the channel mask matches the channel number.
Trait Implementations§
impl Copy for Spec
Auto Trait Implementations§
impl Freeze for Spec
impl RefUnwindSafe for Spec
impl Send for Spec
impl Sync for Spec
impl Unpin for Spec
impl UnwindSafe for Spec
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