Add comments for potential parameter quirks
This commit is contained in:
parent
5f1ebca6e6
commit
e5edbac2b4
|
@ -395,10 +395,14 @@ impl<P: ClapPlugin> Wrapper<P> {
|
|||
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<P: ClapPlugin> Wrapper<P> {
|
|||
} 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
|
||||
|
|
|
@ -433,6 +433,8 @@ impl<P: Vst3Plugin> IEditController for Wrapper<P> {
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue