1
0
Fork 0

Use ParamFlags::NON_AUTOMATABLE in the wrappers

Setting this will cause the parameter to be hidden from the host's
generic UI and automation lanes.
This commit is contained in:
Robbert van der Helm 2022-03-23 13:11:00 +01:00
parent a1be942d6d
commit e9983cf71c
2 changed files with 16 additions and 6 deletions

View file

@ -68,6 +68,7 @@ use crate::buffer::Buffer;
use crate::context::Transport;
use crate::event_loop::{EventLoop, MainThreadExecutor, TASK_QUEUE_CAPACITY};
use crate::param::internals::ParamPtr;
use crate::param::ParamFlags;
use crate::plugin::{
BufferConfig, BusConfig, ClapPlugin, Editor, NoteEvent, ParentWindowHandle, ProcessStatus,
};
@ -1740,13 +1741,16 @@ impl<P: ClapPlugin> Wrapper<P> {
let param_ptr = &wrapper.param_by_hash[param_hash];
let default_value = param_ptr.default_normalized_value();
let step_count = param_ptr.step_count();
let automatable = !param_ptr.flags().contains(ParamFlags::NON_AUTOMATABLE);
param_info.id = *param_hash;
param_info.flags = if step_count.is_some() {
CLAP_PARAM_IS_STEPPED | CLAP_PARAM_IS_AUTOMATABLE
} else {
CLAP_PARAM_IS_AUTOMATABLE
};
param_info.flags = 0;
if automatable {
param_info.flags |= CLAP_PARAM_IS_AUTOMATABLE
}
if step_count.is_some() {
param_info.flags |= CLAP_PARAM_IS_STEPPED
}
param_info.cookie = ptr::null_mut();
strlcpy(&mut param_info.name, param_ptr.name());
strlcpy(&mut param_info.module, param_group);

View file

@ -18,6 +18,7 @@ use super::inner::WrapperInner;
use super::util::{VstPtr, BYPASS_PARAM_HASH, BYPASS_PARAM_ID};
use super::view::WrapperView;
use crate::context::Transport;
use crate::param::ParamFlags;
use crate::plugin::{BufferConfig, BusConfig, NoteEvent, ProcessStatus, Vst3Plugin};
use crate::wrapper::state;
use crate::wrapper::util::{process_wrapper, u16strlcpy};
@ -342,6 +343,7 @@ impl<P: Vst3Plugin> IEditController for Wrapper<P> {
.expect("Inconsistent parameter data");
let param_ptr = &self.inner.param_by_hash[param_hash];
let default_value = param_ptr.default_normalized_value();
let automatable = !param_ptr.flags().contains(ParamFlags::NON_AUTOMATABLE);
info.id = *param_hash;
u16strlcpy(&mut info.title, param_ptr.name());
@ -350,7 +352,11 @@ impl<P: Vst3Plugin> IEditController for Wrapper<P> {
info.step_count = param_ptr.step_count().unwrap_or(0) as i32;
info.default_normalized_value = default_value as f64;
info.unit_id = *param_unit;
info.flags = vst3_sys::vst::ParameterFlags::kCanAutomate as i32;
info.flags = if automatable {
vst3_sys::vst::ParameterFlags::kCanAutomate as i32
} else {
vst3_sys::vst::ParameterFlags::kNoFlags as i32
};
}
kResultOk