Struct libpulse_binding::sample::Spec
source · Expand description
A sample format and attribute specification
Fields
format: FormatThe sample format.
rate: u32The sample rate. (e.g. 44100).
channels: u8Audio channels. (1 for mono, 2 for stereo, …).
Implementations
sourceimpl Spec
impl Spec
sourcepub fn init(&mut self)
pub fn init(&mut self)
Initialize the specified sample spec.
The sample spec will have a defined state but is_valid will fail for
it.
sourcepub fn equal_to(&self, to: &Self) -> bool
pub fn equal_to(&self, to: &Self) -> bool
Returns true when the two sample type specifications match
sourcepub fn bytes_per_second(&self) -> usize
pub fn bytes_per_second(&self) -> usize
Returns the amount of bytes that constitute playback of one second of audio, with the specified sample type.
sourcepub fn frame_size(&self) -> usize
pub fn frame_size(&self) -> usize
Returns the size of a frame
sourcepub fn sample_size(&self) -> usize
pub fn sample_size(&self) -> usize
Returns the size of a sample
sourcepub fn bytes_to_usec(&self, length: u64) -> MicroSeconds
pub fn bytes_to_usec(&self, length: u64) -> MicroSeconds
Calculate the time it would take to play a buffer of the specified size. The return value will always be rounded down for non-integral return values.
sourcepub fn usec_to_bytes(&self, t: MicroSeconds) -> usize
pub fn usec_to_bytes(&self, t: MicroSeconds) -> usize
Calculates the size of a buffer required, for playback duration of the time specified. The return value will always be rounded down for non-integral return values.