INNER CODE UNIT · Rust
init_df
Rikorose/DeepFilterNet · ladspa/src/lib.rs:173
fn init_df(channels: usize) -> (usize, usize) {
unsafe {
if let Some(m) = MODEL.as_ref() {
if m.ch == channels {
return (m.sr, m.hop_size);
}
}
}
let df_params = DfParams::default();
let r_params = RuntimeParams::default_with_ch(channels);
let df = DfTract::new(df_params, &r_params).expect("Could not initialize DeepFilter runtime");
let (sr, frame_size) = (df.sr, df.hop_size);
unsafe { MODEL = Some(df) };
(sr, frame_size)
}
fn get_new_df(channels: usize) -> impl Fn(&PluginDescriptor, u64) -> DfPlugin {