pub struct SelectParam {
pub decimate: u32,
pub channels: Vec<u16>,
}Expand description
The parameter of a select/1 offer and answer (docs/roadmap.md, step 6).
Wire encoding (lowercase hex, no separator):
- 8 hex digits:
decimateasu32big-endian (>= 1;1= full rate) - 4 hex digits:
channels.len()asu16big-endian (0= all channels) 4 * channels.len()hex digits: each 0-based channel index asu16big-endian
Fields§
§decimate: u32Integer rate decimation factor (1 keeps the full rate, 16 reduces
4000 Hz to 250 Hz).
channels: Vec<u16>Ordered 0-based channel indices to keep. Empty means every channel.
Implementations§
Source§impl SelectParam
impl SelectParam
Sourcepub fn channels(channels: Vec<u16>) -> SelectParam
pub fn channels(channels: Vec<u16>) -> SelectParam
Select a subset of channels at full rate.
Sourcepub fn decimate(factor: u32) -> SelectParam
pub fn decimate(factor: u32) -> SelectParam
Decimate all channels by factor (clamped to >= 1).
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
True when this parameter actually narrows channels or reduces rate.
Sourcepub fn output_channels(&self, source_channels: usize) -> usize
pub fn output_channels(&self, source_channels: usize) -> usize
Effective channel count for a source stream with source_channels.
Sourcepub fn output_srate(&self, source_srate: f64) -> f64
pub fn output_srate(&self, source_srate: f64) -> f64
Effective sample rate for a source stream with source_srate.
Sourcepub fn parse(param: &str) -> Option<SelectParam>
pub fn parse(param: &str) -> Option<SelectParam>
Read a select/1 parameter from its lowercase hexadecimal string.
Trait Implementations§
Source§impl Clone for SelectParam
impl Clone for SelectParam
Source§fn clone(&self) -> SelectParam
fn clone(&self) -> SelectParam
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SelectParam
impl Debug for SelectParam
impl Eq for SelectParam
Source§impl PartialEq for SelectParam
impl PartialEq for SelectParam
impl StructuralPartialEq for SelectParam
Auto Trait Implementations§
impl Forget for SelectParam
impl Freeze for SelectParam
impl Move for SelectParam
impl RefUnwindSafe for SelectParam
impl Send for SelectParam
impl Sync for SelectParam
impl Unpin for SelectParam
impl UnsafeUnpin for SelectParam
impl UnwindSafe for SelectParam
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