#[non_exhaustive]pub enum Model {
WaveNet(Box<WaveNet>),
Lstm(Lstm),
Slimmable(Slimmable),
}Expand description
A runnable NAM model of any supported architecture.
Build with Model::from_nam; then call Model::process_buffer on the audio
thread. #[non_exhaustive] so future architectures don’t break downstream
matches.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
WaveNet(Box<WaveNet>)
A WaveNet model. Boxed so the enum’s variants are similarly sized (a WaveNet
carries many pre-allocated scratch buffers); the indirection is one pointer
hop off the build path, not the per-sample hot loop.
Lstm(Lstm)
An LSTM model.
Slimmable(Slimmable)
A width-selectable container of submodels.
Implementations§
Source§impl Model
impl Model
Sourcepub fn from_nam(model: &NamModel) -> Result<Self, Error>
pub fn from_nam(model: &NamModel) -> Result<Self, Error>
Build the runtime matching model.architecture. All allocation happens here.
Sourcepub fn process_buffer(&mut self, io: &mut [f32])
pub fn process_buffer(&mut self, io: &mut [f32])
Process a buffer of mono samples in place. Allocation-free.
Sourcepub fn process_sample(&mut self, x: f32) -> f32
pub fn process_sample(&mut self, x: f32) -> f32
Process a single mono sample. Allocation-free.
Sourcepub fn receptive_field(&self) -> usize
pub fn receptive_field(&self) -> usize
The model’s processing latency in samples.
For WaveNet this is the receptive field: the first this-many output samples
of a fresh (or freshly reset) model are a startup transient
computed against zero history. A host can report it as plugin latency and/or
discard that many leading samples. LSTM has no warmup, so this is 0.
Sourcepub fn as_slimmable(&self) -> Option<&Slimmable>
pub fn as_slimmable(&self) -> Option<&Slimmable>
The width-selectable container, if this model is one. Use it to drive the
slim dial (Slimmable::select / Slimmable::set_slim_size); plain
WaveNet/LSTM models return None.
Sourcepub fn as_slimmable_mut(&mut self) -> Option<&mut Slimmable>
pub fn as_slimmable_mut(&mut self) -> Option<&mut Slimmable>
Mutable variant of Model::as_slimmable, for setting the active submodel.