2022-05-29 21:42:45 +10:00
|
|
|
// Crossover: clean crossovers as a multi-out plugin
|
|
|
|
// Copyright (C) 2022 Robbert van der Helm
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2022-05-29 22:54:28 +10:00
|
|
|
#![cfg_attr(feature = "simd", feature(portable_simd))]
|
|
|
|
|
|
|
|
#[cfg(not(feature = "simd"))]
|
|
|
|
compile_error!("Compiling without SIMD support is currently not supported");
|
|
|
|
|
2022-06-07 09:06:21 +10:00
|
|
|
use crossover::fir::{FirCrossover, FirCrossoverType};
|
2022-05-30 00:21:36 +10:00
|
|
|
use crossover::iir::{IirCrossover, IirCrossoverType};
|
2022-05-29 21:42:45 +10:00
|
|
|
use nih_plug::prelude::*;
|
2022-05-30 00:57:39 +10:00
|
|
|
use std::sync::atomic::{AtomicBool, Ordering};
|
2022-05-29 21:42:45 +10:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2022-05-29 22:54:40 +10:00
|
|
|
mod crossover;
|
|
|
|
|
2022-06-08 04:32:27 +10:00
|
|
|
/// The number of channels this plugin supports. Hard capped at 2 for SIMD reasons.
|
|
|
|
pub const NUM_CHANNELS: u32 = 2;
|
|
|
|
|
2022-05-30 00:21:36 +10:00
|
|
|
/// The number of bands. Not used directly here, but this avoids hardcoding some constants in the
|
|
|
|
/// crossover implementations.
|
|
|
|
pub const NUM_BANDS: usize = 5;
|
|
|
|
|
2022-05-29 22:25:48 +10:00
|
|
|
const MIN_CROSSOVER_FREQUENCY: f32 = 40.0;
|
|
|
|
const MAX_CROSSOVER_FREQUENCY: f32 = 20_000.0;
|
|
|
|
|
2022-05-29 21:42:45 +10:00
|
|
|
struct Crossover {
|
|
|
|
params: Arc<CrossoverParams>,
|
2022-05-30 00:21:36 +10:00
|
|
|
|
|
|
|
buffer_config: BufferConfig,
|
|
|
|
|
|
|
|
/// Provides the LR24 crossover.
|
|
|
|
iir_crossover: IirCrossover,
|
2022-06-07 09:06:21 +10:00
|
|
|
/// Provides the linear-phase LR24 crossover.
|
|
|
|
fir_crossover: FirCrossover,
|
2022-05-30 00:57:39 +10:00
|
|
|
/// Set when the number of bands has changed and the filters must be updated.
|
|
|
|
should_update_filters: Arc<AtomicBool>,
|
2022-05-29 21:42:45 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Params)]
|
|
|
|
struct CrossoverParams {
|
2022-05-29 22:25:48 +10:00
|
|
|
/// The number of bands between 2 and 5
|
|
|
|
#[id = "bandcnt"]
|
|
|
|
pub num_bands: IntParam,
|
|
|
|
|
|
|
|
// We'll only provide frequency controls, as gain, panning, solo, mute etc. is all already
|
|
|
|
// provided by Bitwig's UI
|
|
|
|
#[id = "xov1fq"]
|
|
|
|
pub crossover_1_freq: FloatParam,
|
|
|
|
#[id = "xov2fq"]
|
|
|
|
pub crossover_2_freq: FloatParam,
|
|
|
|
#[id = "xov3fq"]
|
|
|
|
pub crossover_3_freq: FloatParam,
|
|
|
|
#[id = "xov4fq"]
|
|
|
|
pub crossover_4_freq: FloatParam,
|
2022-06-06 07:45:28 +10:00
|
|
|
|
|
|
|
// Having this parameter first or after the number of bands makes more sense, but this way the
|
|
|
|
// band control plus the four crossovers fits exactly in Bitwig's parameter list
|
|
|
|
#[id = "xovtyp"]
|
|
|
|
pub crossover_type: EnumParam<CrossoverType>,
|
|
|
|
}
|
|
|
|
|
2022-06-07 09:06:21 +10:00
|
|
|
// The `non_exhaustive` is to prevent adding cases for latency compensation when adding more types
|
|
|
|
// later
|
2022-06-06 07:45:28 +10:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Enum)]
|
2022-06-07 09:06:21 +10:00
|
|
|
#[non_exhaustive]
|
2022-06-06 07:45:28 +10:00
|
|
|
enum CrossoverType {
|
|
|
|
#[id = "lr24"]
|
|
|
|
#[name = "LR24"]
|
|
|
|
LinkwitzRiley24,
|
2022-06-07 09:06:21 +10:00
|
|
|
#[id = "lr24-lp"]
|
2022-06-08 04:32:55 +10:00
|
|
|
#[name = "LR24 (LP)"]
|
2022-06-07 09:06:21 +10:00
|
|
|
LinkwitzRiley24LinearPhase,
|
2022-05-29 21:42:45 +10:00
|
|
|
}
|
|
|
|
|
2022-05-30 00:57:39 +10:00
|
|
|
impl CrossoverParams {
|
|
|
|
fn new(should_update_filters: Arc<AtomicBool>) -> Self {
|
2022-05-29 22:25:48 +10:00
|
|
|
let crossover_range = FloatRange::Skewed {
|
|
|
|
min: MIN_CROSSOVER_FREQUENCY,
|
|
|
|
max: MAX_CROSSOVER_FREQUENCY,
|
|
|
|
factor: FloatRange::skew_factor(-1.0),
|
|
|
|
};
|
|
|
|
let crossover_smoothing_style = SmoothingStyle::Logarithmic(100.0);
|
|
|
|
let crossover_value_to_string = formatters::v2s_f32_hz_then_khz(0);
|
|
|
|
let crossover_string_to_value = formatters::s2v_f32_hz_then_khz();
|
|
|
|
|
|
|
|
Self {
|
2022-05-30 00:21:36 +10:00
|
|
|
num_bands: IntParam::new(
|
|
|
|
"Band Count",
|
|
|
|
2,
|
|
|
|
IntRange::Linear {
|
|
|
|
min: 2,
|
|
|
|
max: NUM_BANDS as i32,
|
|
|
|
},
|
2022-05-30 00:57:39 +10:00
|
|
|
)
|
2022-06-07 09:06:21 +10:00
|
|
|
.with_callback({
|
|
|
|
let should_update_filters = should_update_filters.clone();
|
|
|
|
|
|
|
|
Arc::new(move |_| should_update_filters.store(true, Ordering::Relaxed))
|
|
|
|
}),
|
2022-06-06 07:45:28 +10:00
|
|
|
|
2022-05-29 22:25:48 +10:00
|
|
|
// TODO: More sensible default frequencies
|
|
|
|
crossover_1_freq: FloatParam::new("Crossover 1", 200.0, crossover_range)
|
|
|
|
.with_smoother(crossover_smoothing_style)
|
|
|
|
.with_value_to_string(crossover_value_to_string.clone())
|
|
|
|
.with_string_to_value(crossover_string_to_value.clone()),
|
|
|
|
crossover_2_freq: FloatParam::new("Crossover 2", 1000.0, crossover_range)
|
|
|
|
.with_smoother(crossover_smoothing_style)
|
|
|
|
.with_value_to_string(crossover_value_to_string.clone())
|
|
|
|
.with_string_to_value(crossover_string_to_value.clone()),
|
|
|
|
crossover_3_freq: FloatParam::new("Crossover 3", 5000.0, crossover_range)
|
|
|
|
.with_smoother(crossover_smoothing_style)
|
|
|
|
.with_value_to_string(crossover_value_to_string.clone())
|
|
|
|
.with_string_to_value(crossover_string_to_value.clone()),
|
|
|
|
crossover_4_freq: FloatParam::new("Crossover 4", 10000.0, crossover_range)
|
|
|
|
.with_smoother(crossover_smoothing_style)
|
|
|
|
.with_value_to_string(crossover_value_to_string.clone())
|
|
|
|
.with_string_to_value(crossover_string_to_value.clone()),
|
2022-06-06 07:45:28 +10:00
|
|
|
|
2022-06-07 09:06:21 +10:00
|
|
|
crossover_type: EnumParam::new("Type", CrossoverType::LinkwitzRiley24).with_callback(
|
|
|
|
Arc::new(move |_| should_update_filters.store(true, Ordering::Relaxed)),
|
|
|
|
),
|
2022-05-29 22:25:48 +10:00
|
|
|
}
|
2022-05-29 21:42:45 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for Crossover {
|
|
|
|
fn default() -> Self {
|
2022-05-30 00:57:39 +10:00
|
|
|
let should_update_filters = Arc::new(AtomicBool::new(false));
|
|
|
|
|
2022-05-29 21:42:45 +10:00
|
|
|
Crossover {
|
2022-05-30 00:57:39 +10:00
|
|
|
params: Arc::new(CrossoverParams::new(should_update_filters.clone())),
|
2022-05-30 00:21:36 +10:00
|
|
|
|
|
|
|
buffer_config: BufferConfig {
|
|
|
|
sample_rate: 1.0,
|
|
|
|
min_buffer_size: None,
|
|
|
|
max_buffer_size: 0,
|
|
|
|
process_mode: ProcessMode::Realtime,
|
|
|
|
},
|
|
|
|
|
|
|
|
iir_crossover: IirCrossover::new(IirCrossoverType::LinkwitzRiley24),
|
2022-06-07 09:06:21 +10:00
|
|
|
fir_crossover: FirCrossover::new(FirCrossoverType::LinkwitzRiley24LinearPhase),
|
2022-05-30 00:57:39 +10:00
|
|
|
should_update_filters,
|
2022-05-29 21:42:45 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Plugin for Crossover {
|
|
|
|
const NAME: &'static str = "Crossover";
|
|
|
|
const VENDOR: &'static str = "Robbert van der Helm";
|
2022-11-12 04:08:10 +11:00
|
|
|
const URL: &'static str = env!("CARGO_PKG_HOMEPAGE");
|
2022-05-29 21:42:45 +10:00
|
|
|
const EMAIL: &'static str = "mail@robbertvanderhelm.nl";
|
|
|
|
|
2022-11-10 01:50:21 +11:00
|
|
|
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
2022-05-29 21:42:45 +10:00
|
|
|
|
2022-08-19 22:34:21 +10:00
|
|
|
const DEFAULT_INPUT_CHANNELS: u32 = NUM_CHANNELS;
|
|
|
|
const DEFAULT_OUTPUT_CHANNELS: u32 = NUM_CHANNELS;
|
2022-05-29 21:42:45 +10:00
|
|
|
|
|
|
|
const DEFAULT_AUX_OUTPUTS: Option<AuxiliaryIOConfig> = Some(AuxiliaryIOConfig {
|
|
|
|
// Two to five of these busses will be used at a time
|
|
|
|
num_busses: 5,
|
2022-06-08 04:32:27 +10:00
|
|
|
num_channels: NUM_CHANNELS,
|
2022-05-29 21:42:45 +10:00
|
|
|
});
|
|
|
|
|
|
|
|
const PORT_NAMES: PortNames = PortNames {
|
|
|
|
main_input: None,
|
|
|
|
// We won't output any sound here
|
|
|
|
main_output: Some("The Void"),
|
|
|
|
aux_inputs: None,
|
|
|
|
aux_outputs: Some(&["Band 1", "Band 2", "Band 3", "Band 4", "Band 5"]),
|
|
|
|
};
|
|
|
|
|
2022-10-22 10:59:29 +11:00
|
|
|
type BackgroundTask = ();
|
2022-10-22 08:52:46 +11:00
|
|
|
|
2022-05-29 21:42:45 +10:00
|
|
|
fn params(&self) -> Arc<dyn Params> {
|
|
|
|
self.params.clone()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn accepts_bus_config(&self, config: &BusConfig) -> bool {
|
|
|
|
// Only do stereo
|
2022-06-08 04:32:27 +10:00
|
|
|
config.num_input_channels == NUM_CHANNELS
|
|
|
|
&& config.num_output_channels == NUM_CHANNELS
|
|
|
|
&& config.aux_output_busses.num_channels == NUM_CHANNELS
|
2022-05-29 21:42:45 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
fn initialize(
|
|
|
|
&mut self,
|
|
|
|
_bus_config: &BusConfig,
|
2022-05-30 00:21:36 +10:00
|
|
|
buffer_config: &BufferConfig,
|
2022-10-22 09:21:08 +11:00
|
|
|
context: &mut impl InitContext<Self>,
|
2022-05-29 21:42:45 +10:00
|
|
|
) -> bool {
|
2022-05-30 00:21:36 +10:00
|
|
|
self.buffer_config = *buffer_config;
|
|
|
|
|
|
|
|
// Make sure the filter states match the current parameters
|
2022-06-08 00:13:39 +10:00
|
|
|
self.update_filters(1);
|
2022-05-30 00:21:36 +10:00
|
|
|
|
2022-06-07 09:06:21 +10:00
|
|
|
// The FIR filters are linear-phase and introduce latency
|
|
|
|
match self.params.crossover_type.value() {
|
|
|
|
CrossoverType::LinkwitzRiley24 => (),
|
|
|
|
CrossoverType::LinkwitzRiley24LinearPhase => {
|
|
|
|
context.set_latency_samples(self.fir_crossover.latency())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-29 21:42:45 +10:00
|
|
|
true
|
|
|
|
}
|
|
|
|
|
|
|
|
fn reset(&mut self) {
|
2022-05-30 00:21:36 +10:00
|
|
|
self.iir_crossover.reset();
|
2022-06-07 09:06:21 +10:00
|
|
|
self.fir_crossover.reset();
|
2022-05-29 21:42:45 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
fn process(
|
|
|
|
&mut self,
|
2022-05-29 22:43:01 +10:00
|
|
|
buffer: &mut Buffer,
|
2022-05-30 00:21:36 +10:00
|
|
|
aux: &mut AuxiliaryBuffers,
|
2022-10-22 10:15:16 +11:00
|
|
|
context: &mut impl ProcessContext<Self>,
|
2022-05-29 21:42:45 +10:00
|
|
|
) -> ProcessStatus {
|
2022-06-07 09:06:21 +10:00
|
|
|
// Right now both crossover types only do 24 dB/octave Linkwitz-Riley style crossovers
|
2022-06-06 07:45:28 +10:00
|
|
|
match self.params.crossover_type.value() {
|
|
|
|
CrossoverType::LinkwitzRiley24 => {
|
2022-06-08 04:36:02 +10:00
|
|
|
context.set_latency_samples(0);
|
|
|
|
|
2022-06-08 00:13:39 +10:00
|
|
|
self.process_iir(buffer, aux);
|
2022-06-06 07:45:28 +10:00
|
|
|
}
|
2022-06-07 09:06:21 +10:00
|
|
|
CrossoverType::LinkwitzRiley24LinearPhase => {
|
|
|
|
context.set_latency_samples(self.fir_crossover.latency());
|
|
|
|
|
2022-06-08 04:32:27 +10:00
|
|
|
self.process_fir(buffer, aux);
|
2022-06-07 09:06:21 +10:00
|
|
|
}
|
2022-06-06 07:45:28 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
ProcessStatus::Normal
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Crossover {
|
|
|
|
/// Takes care of all of the boilerplate in zipping the outputs together to get a nice iterator
|
2022-06-08 04:32:27 +10:00
|
|
|
/// friendly and SIMD-able interface for the processing function. Prevents having to branch per
|
2022-06-06 07:45:28 +10:00
|
|
|
/// sample. The closure receives an input sample and it should write the output samples for each
|
|
|
|
/// band to the array.
|
2022-06-08 00:13:39 +10:00
|
|
|
fn process_iir(&mut self, buffer: &mut Buffer, aux: &mut AuxiliaryBuffers) {
|
2022-05-30 00:21:36 +10:00
|
|
|
let aux_outputs = &mut aux.outputs;
|
|
|
|
let (band_1_buffer, aux_outputs) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
let (band_2_buffer, aux_outputs) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
let (band_3_buffer, aux_outputs) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
let (band_4_buffer, aux_outputs) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
let (band_5_buffer, _) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
|
|
|
|
// Snoclists for days
|
|
|
|
for (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
((main_channel_samples, band_1_channel_samples), band_2_channel_samples),
|
|
|
|
band_3_channel_samples,
|
|
|
|
),
|
|
|
|
band_4_channel_samples,
|
|
|
|
),
|
|
|
|
band_5_channel_samples,
|
|
|
|
) in buffer
|
|
|
|
.iter_samples()
|
|
|
|
.zip(band_1_buffer.iter_samples())
|
|
|
|
.zip(band_2_buffer.iter_samples())
|
|
|
|
.zip(band_3_buffer.iter_samples())
|
|
|
|
.zip(band_4_buffer.iter_samples())
|
|
|
|
.zip(band_5_buffer.iter_samples())
|
|
|
|
{
|
|
|
|
// We can avoid a lot of hardcoding and conditionals by restoring the original array structure
|
|
|
|
let bands = [
|
|
|
|
band_1_channel_samples,
|
|
|
|
band_2_channel_samples,
|
|
|
|
band_3_channel_samples,
|
|
|
|
band_4_channel_samples,
|
|
|
|
band_5_channel_samples,
|
|
|
|
];
|
2022-05-29 22:43:01 +10:00
|
|
|
|
2022-06-08 00:13:39 +10:00
|
|
|
// Only update the filters when needed
|
|
|
|
if self.should_update_filters() {
|
|
|
|
self.update_filters(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
self.iir_crossover.process(
|
2022-09-07 05:55:14 +10:00
|
|
|
self.params.num_bands.value() as usize,
|
2022-06-08 00:13:39 +10:00
|
|
|
&main_channel_samples,
|
|
|
|
bands,
|
|
|
|
);
|
2022-05-30 00:21:36 +10:00
|
|
|
|
|
|
|
// The main output should be silent as the signal is already evenly split over the other
|
|
|
|
// bands
|
|
|
|
for sample in main_channel_samples {
|
|
|
|
*sample = 0.0;
|
|
|
|
}
|
2022-05-29 22:43:01 +10:00
|
|
|
}
|
2022-05-29 21:42:45 +10:00
|
|
|
}
|
|
|
|
|
2022-06-08 04:32:27 +10:00
|
|
|
/// `process_iir()`, but for the linear-phase FIR crossovers. This processes an entire channel
|
|
|
|
/// at once instead of processing per-sample since we use FFT convolution.
|
|
|
|
fn process_fir(&mut self, buffer: &mut Buffer, aux: &mut AuxiliaryBuffers) {
|
|
|
|
// In theory we could do smoothing in between processed blocks, but this hsould be fine
|
|
|
|
if self.should_update_filters() {
|
|
|
|
self.update_filters(buffer.len() as u32);
|
|
|
|
}
|
|
|
|
|
|
|
|
let aux_outputs = &mut aux.outputs;
|
|
|
|
let (band_1_buffer, aux_outputs) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
let (band_2_buffer, aux_outputs) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
let (band_3_buffer, aux_outputs) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
let (band_4_buffer, aux_outputs) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
let (band_5_buffer, _) = aux_outputs.split_first_mut().unwrap();
|
|
|
|
|
|
|
|
// We can avoid a lot of hardcoding and conditionals by restoring the original array structure
|
|
|
|
for channel_idx in 0..buffer.channels() {
|
|
|
|
let main_io = &mut buffer.as_slice()[channel_idx];
|
|
|
|
let band_outputs = [
|
|
|
|
&mut band_1_buffer.as_slice()[channel_idx],
|
|
|
|
&mut band_2_buffer.as_slice()[channel_idx],
|
|
|
|
&mut band_3_buffer.as_slice()[channel_idx],
|
|
|
|
&mut band_4_buffer.as_slice()[channel_idx],
|
|
|
|
&mut band_5_buffer.as_slice()[channel_idx],
|
|
|
|
];
|
|
|
|
|
|
|
|
self.fir_crossover.process(
|
2022-09-07 05:55:14 +10:00
|
|
|
self.params.num_bands.value() as usize,
|
2022-06-08 04:32:27 +10:00
|
|
|
main_io,
|
|
|
|
band_outputs,
|
|
|
|
channel_idx,
|
|
|
|
);
|
|
|
|
|
|
|
|
// The main output should be silent as the signal is already evenly split over the other
|
|
|
|
// bands
|
|
|
|
main_io.fill(0.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-08 00:13:39 +10:00
|
|
|
/// Returns whether the filters should be updated. There are different updating functions for
|
|
|
|
/// the IIR and FIR crossovers.
|
|
|
|
fn should_update_filters(&mut self) -> bool {
|
|
|
|
// Technically this would only require a &self since `should_update_filters` has interior
|
|
|
|
// mutability, but with the current setup this doesn't cause any problems and makes the
|
|
|
|
// former a bit more obvious
|
|
|
|
self.should_update_filters
|
2022-05-30 00:57:39 +10:00
|
|
|
.compare_exchange(true, false, Ordering::Relaxed, Ordering::Relaxed)
|
|
|
|
.is_ok()
|
|
|
|
|| self.params.crossover_1_freq.smoothed.is_smoothing()
|
2022-05-30 00:21:36 +10:00
|
|
|
|| self.params.crossover_2_freq.smoothed.is_smoothing()
|
|
|
|
|| self.params.crossover_3_freq.smoothed.is_smoothing()
|
|
|
|
|| self.params.crossover_4_freq.smoothed.is_smoothing()
|
|
|
|
}
|
|
|
|
|
2022-06-08 00:13:39 +10:00
|
|
|
/// Update the filter coefficients for the crossovers. The step size can be used when the filter
|
|
|
|
/// coefficietns aren't updated every sample.
|
|
|
|
fn update_filters(&mut self, step_size: u32) {
|
2022-06-07 09:06:21 +10:00
|
|
|
let crossover_frequencies = [
|
2022-06-08 00:13:39 +10:00
|
|
|
self.params.crossover_1_freq.smoothed.next_step(step_size),
|
|
|
|
self.params.crossover_2_freq.smoothed.next_step(step_size),
|
|
|
|
self.params.crossover_3_freq.smoothed.next_step(step_size),
|
|
|
|
self.params.crossover_4_freq.smoothed.next_step(step_size),
|
2022-06-07 09:06:21 +10:00
|
|
|
];
|
|
|
|
|
2022-06-06 07:45:28 +10:00
|
|
|
match self.params.crossover_type.value() {
|
|
|
|
CrossoverType::LinkwitzRiley24 => self.iir_crossover.update(
|
|
|
|
self.buffer_config.sample_rate,
|
2022-09-07 05:55:14 +10:00
|
|
|
self.params.num_bands.value() as usize,
|
2022-06-07 09:06:21 +10:00
|
|
|
crossover_frequencies,
|
|
|
|
),
|
|
|
|
CrossoverType::LinkwitzRiley24LinearPhase => self.fir_crossover.update(
|
|
|
|
self.buffer_config.sample_rate,
|
2022-09-07 05:55:14 +10:00
|
|
|
self.params.num_bands.value() as usize,
|
2022-06-07 09:06:21 +10:00
|
|
|
crossover_frequencies,
|
2022-06-06 07:45:28 +10:00
|
|
|
),
|
|
|
|
}
|
2022-05-30 00:21:36 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-29 21:42:45 +10:00
|
|
|
impl ClapPlugin for Crossover {
|
|
|
|
const CLAP_ID: &'static str = "nl.robbertvanderhelm.crossover";
|
2022-07-04 20:44:30 +10:00
|
|
|
const CLAP_DESCRIPTION: Option<&'static str> =
|
|
|
|
Some("Cleanly split a signal into multiple bands");
|
|
|
|
const CLAP_MANUAL_URL: Option<&'static str> = Some(Self::URL);
|
|
|
|
const CLAP_SUPPORT_URL: Option<&'static str> = None;
|
2022-06-02 09:16:30 +10:00
|
|
|
const CLAP_FEATURES: &'static [ClapFeature] = &[
|
|
|
|
ClapFeature::AudioEffect,
|
|
|
|
ClapFeature::Stereo,
|
|
|
|
ClapFeature::Utility,
|
|
|
|
];
|
2022-05-29 21:42:45 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Vst3Plugin for Crossover {
|
|
|
|
const VST3_CLASS_ID: [u8; 16] = *b"CrossoverRvdH...";
|
|
|
|
const VST3_CATEGORIES: &'static str = "Fx|Tools";
|
|
|
|
}
|
|
|
|
|
|
|
|
nih_export_clap!(Crossover);
|
|
|
|
nih_export_vst3!(Crossover);
|