Struct rustpotter_wasm::RustpotterJSBuilder
source · [−]pub struct RustpotterJSBuilder { /* private fields */ }
Implementations
sourceimpl RustpotterJSBuilder
impl RustpotterJSBuilder
pub fn new() -> Self
sourcepub fn setThreshold(&mut self, value: f32)
pub fn setThreshold(&mut self, value: f32)
Configures the detector threshold, is the min score (in range 0. to 1.) that some of the wakeword templates should obtain to trigger a detection.
Defaults to 0.5, wakeword defined value takes prevalence if present.
sourcepub fn setAveragedThreshold(&mut self, value: f32)
pub fn setAveragedThreshold(&mut self, value: f32)
Configures the detector threshold,
is the min score (in range 0. to 1.) that
the averaged wakeword template should obtain to allow
to continue with the detection. This way it can prevent to
run the comparison of the current frame against each of the wakeword templates.
If set to 0. this functionality is disabled.
Defaults to half of the configured threshold, wakeword defined value takes prevalence if present.
sourcepub fn setBitsPerSample(&mut self, value: u16)
pub fn setBitsPerSample(&mut self, value: u16)
Configures the detector expected bit per sample for the audio chunks to process.
Defaults to 16; Allowed values: 8, 16, 24, 32
sourcepub fn setSampleRate(&mut self, value: usize)
pub fn setSampleRate(&mut self, value: usize)
Configures the detector expected sample rate for the audio chunks to process.
Defaults to 16000
sourcepub fn setSampleFormat(&mut self, value: SampleFormat)
pub fn setSampleFormat(&mut self, value: SampleFormat)
Configures the detector expected sample format for the audio chunks to process.
Defaults to int
sourcepub fn setChannels(&mut self, value: u16)
pub fn setChannels(&mut self, value: u16)
Configures the detector expected number of channels for the audio chunks to process. Rustpotter will only use data for first channel.
Defaults to 1
sourcepub fn setComparatorBandSize(&mut self, value: usize)
pub fn setComparatorBandSize(&mut self, value: usize)
Configures the band-size for the comparator used to match the samples.
Defaults to 6
sourcepub fn setComparatorRef(&mut self, value: f32)
pub fn setComparatorRef(&mut self, value: f32)
Configures the reference for the comparator used to match the samples.
Defaults to 0.22
sourcepub fn setEagerMode(&mut self, value: bool)
pub fn setEagerMode(&mut self, value: bool)
Enables eager mode. Terminate the detection as son as one result is above the score, instead of wait to see if the next frame has a higher score.
Recommended for real usage.
Defaults to false.
sourcepub fn setSingleThread(&mut self, value: bool)
pub fn setSingleThread(&mut self, value: bool)
Unless enabled the comparison against multiple wakewords run in separate threads.
Defaults to false.
Only applies when more than a wakeword is loaded.
sourcepub fn build(&self) -> RustpotterJS
pub fn build(&self) -> RustpotterJS
construct the wakeword detector
Trait Implementations
sourceimpl From<RustpotterJSBuilder> for JsValue
impl From<RustpotterJSBuilder> for JsValue
sourcefn from(value: RustpotterJSBuilder) -> Self
fn from(value: RustpotterJSBuilder) -> Self
Converts to this type from the input type.
sourceimpl FromWasmAbi for RustpotterJSBuilder
impl FromWasmAbi for RustpotterJSBuilder
sourceimpl IntoWasmAbi for RustpotterJSBuilder
impl IntoWasmAbi for RustpotterJSBuilder
sourceimpl RefFromWasmAbi for RustpotterJSBuilder
impl RefFromWasmAbi for RustpotterJSBuilder
type Anchor = Ref<'static, RustpotterJSBuilder>
type Anchor = Ref<'static, RustpotterJSBuilder>
The type that holds the reference to Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous. Read more
sourceunsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
Recover a Self::Anchor
from Self::Abi
. Read more
sourceimpl RefMutFromWasmAbi for RustpotterJSBuilder
impl RefMutFromWasmAbi for RustpotterJSBuilder
type Anchor = RefMut<'static, RustpotterJSBuilder>
type Anchor = RefMut<'static, RustpotterJSBuilder>
Same as RefFromWasmAbi::Anchor
sourceunsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
Same as RefFromWasmAbi::ref_from_abi
sourceimpl WasmDescribe for RustpotterJSBuilder
impl WasmDescribe for RustpotterJSBuilder
Auto Trait Implementations
impl RefUnwindSafe for RustpotterJSBuilder
impl Send for RustpotterJSBuilder
impl Sync for RustpotterJSBuilder
impl Unpin for RustpotterJSBuilder
impl UnwindSafe for RustpotterJSBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi
sourcefn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
. Read more