1
0
Fork 0

Fix sample accurate automation for VST3

This commit is contained in:
Robbert van der Helm 2022-03-29 00:55:24 +02:00
parent 6dd11561c5
commit f301726f37

View file

@ -717,25 +717,37 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
{ {
let param_hash = param_change_queue.get_parameter_id(); let param_hash = param_change_queue.get_parameter_id();
let num_changes = param_change_queue.get_point_count(); let num_changes = param_change_queue.get_point_count();
if num_changes <= 0 {
continue;
}
let mut sample_offset = 0i32; let mut sample_offset = 0i32;
let mut value = 0.0f64; let mut value = 0.0f64;
if num_changes > 0 #[allow(clippy::collapsible_else_if)]
&& param_change_queue.get_point( if P::SAMPLE_ACCURATE_AUTOMATION {
for change_idx in 0..num_changes {
if param_change_queue.get_point(
change_idx,
&mut sample_offset,
&mut value,
) == kResultOk
{
input_param_changes.push(Reverse((
sample_offset as usize,
ParameterChange {
hash: param_hash,
normalized_value: value as f32,
},
)));
}
}
} else {
if param_change_queue.get_point(
num_changes - 1, num_changes - 1,
&mut sample_offset, &mut sample_offset,
&mut value, &mut value,
) == kResultOk ) == kResultOk
{ {
if P::SAMPLE_ACCURATE_AUTOMATION {
input_param_changes.push(Reverse((
sample_offset as usize,
ParameterChange {
hash: param_hash,
normalized_value: value as f32,
},
)));
} else {
self.inner.set_normalized_value_by_hash( self.inner.set_normalized_value_by_hash(
param_hash, param_hash,
value as f32, value as f32,