Add a dedicated bypass param for Diopser
This will be shown in the GUI.
This commit is contained in:
parent
3f0922b5c0
commit
aee08bae20
|
@ -81,6 +81,12 @@ struct DiopserParams {
|
||||||
#[persist = "editor-state"]
|
#[persist = "editor-state"]
|
||||||
editor_state: Arc<ViziaState>,
|
editor_state: Arc<ViziaState>,
|
||||||
|
|
||||||
|
/// This plugin really doesn't need its own bypass parameter, but it's still useful to have a
|
||||||
|
/// dedicated one so it can be shown in the GUI. This is linked to the host's bypass if the host
|
||||||
|
/// supports it.
|
||||||
|
#[id = "bypass"]
|
||||||
|
bypass: BoolParam,
|
||||||
|
|
||||||
/// The number of all-pass filters applied in series.
|
/// The number of all-pass filters applied in series.
|
||||||
#[id = "stages"]
|
#[id = "stages"]
|
||||||
filter_stages: IntParam,
|
filter_stages: IntParam,
|
||||||
|
@ -144,6 +150,8 @@ impl DiopserParams {
|
||||||
Self {
|
Self {
|
||||||
editor_state: editor::default_state(),
|
editor_state: editor::default_state(),
|
||||||
|
|
||||||
|
bypass: BoolParam::new("Bypass", false).make_bypass(),
|
||||||
|
|
||||||
filter_stages: IntParam::new(
|
filter_stages: IntParam::new(
|
||||||
"Filter Stages",
|
"Filter Stages",
|
||||||
0,
|
0,
|
||||||
|
@ -295,22 +303,24 @@ impl Plugin for Diopser {
|
||||||
let smoothing_interval =
|
let smoothing_interval =
|
||||||
unnormalize_automation_precision(self.params.automation_precision.value());
|
unnormalize_automation_precision(self.params.automation_precision.value());
|
||||||
|
|
||||||
for mut channel_samples in buffer.iter_samples() {
|
if !self.params.bypass.value() {
|
||||||
self.maybe_update_filters(smoothing_interval);
|
for mut channel_samples in buffer.iter_samples() {
|
||||||
|
self.maybe_update_filters(smoothing_interval);
|
||||||
|
|
||||||
// We can compute the filters for both channels at once. The SIMD version thus now only
|
// We can compute the filters for both channels at once. The SIMD version thus now
|
||||||
// supports steroo audio.
|
// only supports steroo audio.
|
||||||
let mut samples = unsafe { channel_samples.to_simd_unchecked() };
|
let mut samples = unsafe { channel_samples.to_simd_unchecked() };
|
||||||
|
|
||||||
for filter in self
|
for filter in self
|
||||||
.filters
|
.filters
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.take(self.params.filter_stages.value() as usize)
|
.take(self.params.filter_stages.value() as usize)
|
||||||
{
|
{
|
||||||
samples = filter.process(samples);
|
samples = filter.process(samples);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe { channel_samples.from_simd_unchecked(samples) };
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe { channel_samples.from_simd_unchecked(samples) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute a spectrum for the GUI if needed
|
// Compute a spectrum for the GUI if needed
|
||||||
|
|
Loading…
Reference in a new issue