diff --git a/src/wrapper/clap/plugin.rs b/src/wrapper/clap/plugin.rs index 67fe4704..5a7f8542 100644 --- a/src/wrapper/clap/plugin.rs +++ b/src/wrapper/clap/plugin.rs @@ -395,10 +395,14 @@ impl Wrapper

{ param_info.cookie = ptr::null_mut(); strlcpy(&mut param_info.name, param_ptr.name()); strlcpy(&mut param_info.module, ""); + // We don't use the actual minimum and maximum values here because that would not scale + // with skewed integer ranges. Instead, just treat all parameters as `[0, 1]` normalized + // paramters multiplied by the step size. param_info.min_value = 0.0; // Stepped parameters are unnormalized float parameters since there's no separate step // range option // TODO: This should probably be encapsulated in some way so we don't forget about this in one place + // TODO: Like with VST3, this won't actually do the correct thing with skewed stepped parameters param_info.max_value = step_count.unwrap_or(1) as f64; param_info.default_value = *default_value as f64 * step_count.unwrap_or(1) as f64; } @@ -423,9 +427,9 @@ impl Wrapper

{ } else { 0.0 }; - true } else if let Some(param_ptr) = wrapper.param_by_hash.get(¶m_id) { + // TODO: As explained above, this may do strange things with skewed discrete parameters *value = param_ptr.normalized_value() as f64 * param_ptr.step_count().unwrap_or(1) as f64; true diff --git a/src/wrapper/vst3/wrapper.rs b/src/wrapper/vst3/wrapper.rs index bcb7f065..a4e25320 100644 --- a/src/wrapper/vst3/wrapper.rs +++ b/src/wrapper/vst3/wrapper.rs @@ -433,6 +433,8 @@ impl IEditController for Wrapper

{ u16strlcpy(&mut info.title, param_ptr.name()); u16strlcpy(&mut info.short_title, param_ptr.name()); u16strlcpy(&mut info.units, param_ptr.unit()); + // TODO: The host assumes these steps are distirbuted linearly, so this may cause weird + // behavior with skewed integers info.step_count = param_ptr.step_count().unwrap_or(0); info.default_normalized_value = *default_value as f64; info.unit_id = vst3_sys::vst::kRootUnitId;