Skip to main content

nam_rs/loader/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 Fábio Henrique de Lima Silva (fhl.bsb@gmail.com) All rights reserved.
3
4//! Loading module for the NAM ecosystem.
5//!
6//! Contains parsers for .nam (JSON) and .namb (binary) formats.
7//! The entire loading process occurs **outside** the RT thread to
8//! avoid any unwanted allocation during audio processing.
9
10pub mod build;
11pub mod dispatcher;
12/// Struct, constants, and Debug impl for `LoadedModelPair`.
13pub mod loaded_model_pair;
14pub mod nam_json;
15pub mod namb;
16pub mod namb_encoder;
17pub mod transpose;
18
19pub use build::load_and_build_model;
20pub use loaded_model_pair::*;
21
22#[cfg(test)]
23#[path = "loader_malformed_test.rs"]
24mod loader_malformed_test;
25
26/// Controls loading behaviour and model initialization.
27///
28/// Produced by the main/UI thread and consumed by the loader before passing
29/// the ready-to-render model pair to the RT thread.
30#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
31pub struct LoadOptions {
32    /// `None`  → use default (prewarm runs normally).
33    /// `Some(false)` → skip the initial prewarm pass (fast preview / preset browsing).
34    /// `Some(true)`  → force prewarm on (explicit override).
35    pub prewarm: Option<bool>,
36}