pub struct WaveFormat {
pub wave_fmt: WAVEFORMATEXTENSIBLE,
}Expand description
Struct wrapping a WAVEFORMATEXTENSIBLE format descriptor.
Fields§
§wave_fmt: WAVEFORMATEXTENSIBLEImplementations§
Source§impl WaveFormat
impl WaveFormat
Sourcepub fn parse(waveformatex: &WAVEFORMATEX) -> Result<Self, WasapiError>
pub fn parse(waveformatex: &WAVEFORMATEX) -> Result<Self, WasapiError>
Parse a WAVEFORMATEX structure and return a WaveFormat instance. If the underlying structure is a WAVEFORMATEXTENSIBLE, as specified by wFormatTag, then use as-is. If not, assume it is only a WAVEFORMATEX structure.
Sourcepub fn new(
storebits: usize,
validbits: usize,
sample_type: &SampleType,
samplerate: usize,
channels: usize,
channel_mask: Option<u32>,
) -> Self
pub fn new( storebits: usize, validbits: usize, sample_type: &SampleType, samplerate: usize, channels: usize, channel_mask: Option<u32>, ) -> Self
Build a WAVEFORMATEXTENSIBLE struct for the given parameters.
channel_mask is optional. If a mask is provided, it will be used. If not, a default mask will be created.
This can be used to work around quirks for some device drivers.
If the default is not accepted, try again using a zero mask, Some(0).
Sourcepub fn from_waveformatex(wavefmt: WAVEFORMATEX) -> Result<Self, WasapiError>
pub fn from_waveformatex(wavefmt: WAVEFORMATEX) -> Result<Self, WasapiError>
Create from a WAVEFORMATEX structure
Sourcepub fn to_waveformatex(&self) -> Result<Self, WasapiError>
pub fn to_waveformatex(&self) -> Result<Self, WasapiError>
Return a copy in the simpler WAVEFORMATEX format.
Sourcepub fn as_waveformatex_ref(&self) -> &WAVEFORMATEX
pub fn as_waveformatex_ref(&self) -> &WAVEFORMATEX
get a reference of type &WAVEFORMATEX, used internally
Sourcepub fn get_blockalign(&self) -> u32
pub fn get_blockalign(&self) -> u32
Read nBlockAlign.
Sourcepub fn get_avgbytespersec(&self) -> u32
pub fn get_avgbytespersec(&self) -> u32
Read nAvgBytesPerSec.
Sourcepub fn get_bitspersample(&self) -> u16
pub fn get_bitspersample(&self) -> u16
Read wBitsPerSample.
Sourcepub fn get_validbitspersample(&self) -> u16
pub fn get_validbitspersample(&self) -> u16
Read wValidBitsPerSample.
Sourcepub fn get_samplespersec(&self) -> u32
pub fn get_samplespersec(&self) -> u32
Read nSamplesPerSec.
Sourcepub fn get_nchannels(&self) -> u16
pub fn get_nchannels(&self) -> u16
Read nChannels.
Sourcepub fn get_dwchannelmask(&self) -> u32
pub fn get_dwchannelmask(&self) -> u32
Read dwChannelMask.
Sourcepub fn get_subformat(&self) -> Result<SampleType, WasapiError>
pub fn get_subformat(&self) -> Result<SampleType, WasapiError>
Read SubFormat.
Trait Implementations§
Source§impl Clone for WaveFormat
impl Clone for WaveFormat
Source§fn clone(&self) -> WaveFormat
fn clone(&self) -> WaveFormat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more