Skip to main content

StaticModel

Enum StaticModel 

Source
pub enum StaticModel {
Show 23 variants WavenetStandard(Box<WaveNetModel<16, 3, 8>>), WavenetLite(Box<WaveNetModel<12, 3, 6>>), WavenetFeather(Box<WaveNetModel<8, 3, 4>>), WavenetNano(Box<WaveNetModel<4, 3, 2>>), WavenetA2Full(Box<WaveNetA2<8>>), WavenetA2Lite(Box<WaveNetA2<3>>), WavenetA2Dyn(Box<WaveNetA2Dyn>), WavenetA2Cascade(Box<WaveNetA2Cascade>), WavenetDyn(Box<WaveNetModelDyn>), Lstm1x3(Box<Lstm1x3>), Lstm1x8(Box<Lstm1x8>), Lstm1x12(Box<Lstm1x12>), Lstm1x16(Box<Lstm1x16>), Lstm1x24(Box<Lstm1x24>), Lstm2x8(Box<Lstm2x8>), Lstm2x12(Box<Lstm2x12>), Lstm2x16(Box<Lstm2x16>), Lstm1x40(Box<Lstm1x40>), Lstm2x24(Box<Lstm2x24>), LstmDyn(Box<LstmModelDyn>), Container(Box<ContainerModel>), Linear(Box<LinearModel>), ConvNet(Box<ConvNetModel>),
}
Expand description

Wrapper enum for trained model variants. Enables static dispatch of DSP calls to the concrete variant, avoiding vtable overhead.

Named StaticModel because all variants are compile-time-fixed geometries. The legacy “Dynamic” mode (arbitrary geometry at runtime) has been retired.

Variants§

§

WavenetStandard(Box<WaveNetModel<16, 3, 8>>)

WaveNet Standard (16 channels, kernel 3, dilation 8).

§

WavenetLite(Box<WaveNetModel<12, 3, 6>>)

WaveNet Lite (12 channels, kernel 3, dilation 6).

§

WavenetFeather(Box<WaveNetModel<8, 3, 4>>)

WaveNet Feather (8 channels, kernel 3, dilation 4).

§

WavenetNano(Box<WaveNetModel<4, 3, 2>>)

WaveNet Nano (4 channels, kernel 3, dilation 2).

§

WavenetA2Full(Box<WaveNetA2<8>>)

WaveNet A2 Full (8 channels, real inference).

§

WavenetA2Lite(Box<WaveNetA2<3>>)

WaveNet A2 Lite (3 channels, real inference).

§

WavenetA2Dyn(Box<WaveNetA2Dyn>)

WaveNet A2 Dynamic (runtime-dimensioned, full topology spectrum).

§

WavenetA2Cascade(Box<WaveNetA2Cascade>)

WaveNet A2 Cascade (multi-array chain of Dynamic engines).

§

WavenetDyn(Box<WaveNetModelDyn>)

WaveNet Dynamic (runtime-dimensioned, free geometry).

§

Lstm1x3(Box<Lstm1x3>)

LSTM 1 Layer × 3 hidden units.

§

Lstm1x8(Box<Lstm1x8>)

LSTM 1 Layer × 8 hidden units.

§

Lstm1x12(Box<Lstm1x12>)

LSTM 1 Layer × 12 hidden units.

§

Lstm1x16(Box<Lstm1x16>)

LSTM 1 Layer × 16 hidden units.

§

Lstm1x24(Box<Lstm1x24>)

LSTM 1 Layer × 24 hidden units.

§

Lstm2x8(Box<Lstm2x8>)

LSTM 2 Layers × 8 hidden units.

§

Lstm2x12(Box<Lstm2x12>)

LSTM 2 Layers × 12 hidden units.

§

Lstm2x16(Box<Lstm2x16>)

LSTM 2 Layers × 16 hidden units.

§

Lstm1x40(Box<Lstm1x40>)

LSTM 1 Layer × 40 hidden units.

§

Lstm2x24(Box<Lstm2x24>)

LSTM 2 Layers × 24 hidden units.

§

LstmDyn(Box<LstmModelDyn>)

LSTM Dynamic — runtime-dimensioned, free geometry (F7 fallback).

§

Container(Box<ContainerModel>)

SlimmableContainer — bundle of submodels selected by quality threshold.

§

Linear(Box<LinearModel>)

Linear — FIR-based model (dot product of input history with weights + bias).

§

ConvNet(Box<ConvNetModel>)

ConvNet feed-forward model (F4).

Implementations§

Source§

impl StaticModel

Source

pub fn inject_rt_status(&mut self, rt_status: Arc<RtStatusFlags>)

Injects RtStatusFlags into the model so it can signal its state to the UI via atomic flags.

Source

pub fn process_scalar(&mut self, input: &[f32], output: &mut [f32])

Scalar processing path for LSTM models (exact tanh/sigmoid via libm).

Only available under #[cfg(test)] or #[cfg(feature = "testing")]. For non-LSTM models, delegates to process().

Source

pub fn set_effective_layers(&mut self, n: usize)

Sets the effective number of layers for soft-degrade. Only applies to WaveNet variants. LSTM handles reduction at the pipeline level.

Source

pub fn backup_buffer_starts(&self, starts: &mut [usize], offset: &mut usize)

Backs up WaveNet buffer starts. No-op for non-WaveNet models.

Source

pub fn restore_buffer_starts(&mut self, starts: &[usize], offset: &mut usize)

Restores WaveNet buffer starts. No-op for non-WaveNet models.

Source

pub fn set_slimmable_size( &mut self, val: f32, rt_status: Option<&RtStatusFlags>, )

Sets the slimmable quality level for SlimmableModel variants.

Only applies to Container. Other variants are a no-op.

rt_status — when on the RT hot-path, pass Some(&rt_status) so errors can be signaled atomically. Pass None in tests or off-RT contexts.

Source

pub fn slimmable_breakpoints(&self) -> Vec<f64>

Returns the slimmable quality breakpoints for this model.

Delegates to ContainerModel::slimmable_breakpoints() when this is a Container variant. Returns an empty vector for all other variants.

Source

pub fn layer_count(&self) -> usize

Returns the total number of layers for the model (0 for non-WaveNet). Used by the adaptive FSM to compute how many to keep.

Source

pub fn class_label(&self) -> String

Returns a human-readable classification label for this model variant.

Used by nondist_validation.rs to cross-check against the manifest’s expected_class field and detect dispatcher routing errors.

Source

pub fn is_lstm(&self) -> bool

Returns true if this is an LSTM model.

Source

pub fn is_wavenet(&self) -> bool

Returns true if this is a WaveNet model.

Source

pub fn supports_layer_skip(&self) -> bool

Returns true if this model supports layer skipping (WaveNet A1 variants only). A2 architectures use MirroredBuffer + layer_buffer_starts/head_write_pos and cannot safely participate in the double-pass crossfade mechanism.

Source

pub fn is_container(&self) -> bool

Returns true if this is a SlimmableContainer model.

Source

pub fn channels(&self) -> usize

Returns the number of channels inside the model.

Source

pub fn in_channels(&self) -> usize

Returns the number of input channels consumed by the model’s process().

  • WaveNet variants and LSTM: always 1 (single sample per frame).
  • ConvNet: in_channels from configuration (defaults to 1).
  • Container: delegates to active sub-model.
Source

pub fn receptive_field(&self) -> usize

Returns the receptive field size of the model (or 0 for LSTM/Container).

Source

pub fn num_output_channels(&self) -> usize

Returns the number of output channels produced by the model’s process().

Mirrors C++ DSP::NumOutputChannels():

  • WaveNet A1 without post-stack head: last array’s head_size (wave_net_output_channels)
  • LSTM: hidden_size
  • Linear: 1
  • Container: delegates to active sub-model

Trait Implementations§

Source§

impl NamModel for StaticModel

Source§

fn process(&mut self, input: &[f32], output: &mut [f32])

Invoked by the DSP RT-Thread to process acoustic sample blocks (Float32).
Source§

fn prewarm(&mut self, num_samples: usize)

“Heats up” the virtual tubes of the neural engine (prewarm).
Source§

fn prewarm_on_reset(&self) -> bool

Returns whether prewarm should be executed on reset(). Read more
Source§

fn set_prewarm_on_reset(&mut self, val: bool)

Sets whether prewarm should be executed on reset(). Read more
Source§

fn reset(&mut self, sample_rate: u32, max_buffer_size: usize) -> Result<()>

Resets the model’s internal state with a new sample rate and max buffer size. Read more
Source§

fn set_max_buffer_size(&mut self, max_buf: usize) -> Result<()>

Reallocates internal buffers to support the given maximum block size. Read more
Source§

fn prewarm_samples(&self) -> usize

Returns the number of samples needed to fully stabilize the model’s internal state (receptive field / recurrent memory depth). Read more
Source§

fn slimmable_breakpoints(&self) -> Vec<f64>

Returns the breakpoints at which slimmable quality transitions occur. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.