Auto-disable Diopser safe mode for older instances

Since this used to not do anything.
This commit is contained in:
Robbert van der Helm
2022-11-29 20:00:21 +01:00
parent 836a72dbc4
commit aca09c49c7
3 changed files with 23 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "diopser"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
authors = ["Robbert van der Helm <mail@robbertvanderhelm.nl>"]
license = "GPL-3.0-or-later"
@@ -20,6 +20,7 @@ nih_plug = { path = "../../", features = ["assert_process_allocs"] }
nih_plug_vizia = { path = "../../nih_plug_vizia" }
atomic_float = "0.1"
semver = "1.0.14"
# For the GUI
realfft = "3.0"

View File

@@ -137,6 +137,19 @@ impl Plugin for Diopser {
)
}
fn filter_state(state: &mut PluginState) {
// Safe-mode is enabled by default, so to avoid changing the behavior we'll keep it disabled
// for older presets
if semver::Version::parse(&state.version)
.map(|version| version < semver::Version::parse("0.4.0").unwrap())
.unwrap_or(true)
{
state
.fields
.insert(String::from("safe-mode"), String::from("false"));
}
}
fn accepts_bus_config(&self, config: &BusConfig) -> bool {
// The SIMD version only supports stereo
config.num_input_channels == config.num_output_channels && config.num_input_channels == 2