pub struct ProcessorConfig {
pub sample_rate: u32,
pub block_size: usize,
pub variable_block_size: bool,
}Expand description
Audio processing configuration passed to Processor::initialize,
Vad::initialize and
Collector::initialize.
Use ProcessorConfig::optimal as a starting point, then adjust fields
to match your stream layout.
Fields§
§sample_rate: u32Sample rate in Hz (8000 - 192000).
block_size: usizeNumber of samples passed to each Processor::process,
Vad::process or
Collector::buffer call (the maximum, if
variable_block_size is true).
Note that using a non-optimal block size increases latency.
variable_block_size: boolIf true, permits shorter calls at the cost of added delay.
Calls larger than block_size are always rejected.
Implementations§
Source§impl ProcessorConfig
impl ProcessorConfig
Sourcepub fn optimal(model: &Model<'_>) -> Self
pub fn optimal(model: &Model<'_>) -> Self
Returns a ProcessorConfig pre-filled with the model’s optimal sample rate and block size.
variable_block_size will be set to false. Enable variable block sizes
by using the builder pattern.
let config = ProcessorConfig::optimal(&model).with_variable_block_size(true);If you need to configure a non-optimal sample rate or block size,
construct the ProcessorConfig struct directly. For example:
let config = ProcessorConfig {
sample_rate: 44100,
block_size: model.optimal_block_size(44100),
variable_block_size: true,
};Sourcepub fn with_variable_block_size(self, variable_block_size: bool) -> Self
pub fn with_variable_block_size(self, variable_block_size: bool) -> Self
Enables or disables variable block size support.
When enabled, permits processing calls shorter than block_size at the cost of
added latency.
§Arguments
variable_block_size-trueto enable variable block sizes,falsefor fixed size
Trait Implementations§
Source§impl Clone for ProcessorConfig
impl Clone for ProcessorConfig
Source§fn clone(&self) -> ProcessorConfig
fn clone(&self) -> ProcessorConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProcessorConfig
impl Debug for ProcessorConfig
impl Eq for ProcessorConfig
Source§impl Hash for ProcessorConfig
impl Hash for ProcessorConfig
Source§impl PartialEq for ProcessorConfig
impl PartialEq for ProcessorConfig
impl StructuralPartialEq for ProcessorConfig
Auto Trait Implementations§
impl Freeze for ProcessorConfig
impl RefUnwindSafe for ProcessorConfig
impl Send for ProcessorConfig
impl Sync for ProcessorConfig
impl Unpin for ProcessorConfig
impl UnsafeUnpin for ProcessorConfig
impl UnwindSafe for ProcessorConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more