Skip to content

Commit 702b340

Browse files
committed
Add not_output() to ParameterInfo
If not set, use the CLAP_PARAM_REQUIRES_PROCESS flag
1 parent fe0a7e9 commit 702b340

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

plinth-plugin/src/formats/clap/extensions/params.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{ffi::{c_char, CStr}, marker::PhantomData, sync::atomic::Ordering};
22

3-
use clap_sys::{events::{clap_input_events, clap_output_events}, ext::params::{clap_param_info, clap_plugin_params, CLAP_PARAM_IS_AUTOMATABLE, CLAP_PARAM_IS_BYPASS, CLAP_PARAM_IS_HIDDEN, CLAP_PARAM_IS_MODULATABLE, CLAP_PARAM_IS_STEPPED}, id::clap_id, plugin::clap_plugin};
3+
use clap_sys::{events::{clap_input_events, clap_output_events}, ext::params::{CLAP_PARAM_IS_AUTOMATABLE, CLAP_PARAM_IS_BYPASS, CLAP_PARAM_IS_HIDDEN, CLAP_PARAM_IS_MODULATABLE, CLAP_PARAM_IS_STEPPED, CLAP_PARAM_REQUIRES_PROCESS, clap_param_info, clap_plugin_params}, id::clap_id, plugin::clap_plugin};
44

55
use crate::{clap::{event::EventIterator, parameters::{map_parameter_value_from_clap, map_parameter_value_to_clap}, plugin_instance::PluginInstance, ClapPlugin}, processor::Processor, string::copy_str_to_char8, Parameters};
66

@@ -52,6 +52,9 @@ impl<P: ClapPlugin> Params<P> {
5252
if parameter_info.is_bypass() {
5353
clap_param_info.flags |= CLAP_PARAM_IS_BYPASS;
5454
}
55+
if parameter_info.is_output() {
56+
clap_param_info.flags |= CLAP_PARAM_REQUIRES_PROCESS;
57+
}
5558
if parameter_info.visible() {
5659
clap_param_info.flags |= CLAP_PARAM_IS_AUTOMATABLE | CLAP_PARAM_IS_MODULATABLE
5760
} else {

plinth-plugin/src/parameters/info.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub struct ParameterInfo {
1010
default_normalized_value: ParameterValue,
1111
steps: usize,
1212
is_bypass: bool,
13+
is_output: bool,
1314
visible: bool,
1415
}
1516

@@ -22,6 +23,7 @@ impl ParameterInfo {
2223
default_normalized_value: Default::default(),
2324
steps: 0,
2425
is_bypass: false,
26+
is_output: true,
2527
visible: true,
2628
}
2729
}
@@ -46,6 +48,14 @@ impl ParameterInfo {
4648
self
4749
}
4850

51+
/// By default, parameters are assumed to affect plugin output
52+
/// Calling this function will mark the parameter as not affecting the output,
53+
/// which might improve performance
54+
pub fn not_output(mut self) -> Self {
55+
self.is_output = false;
56+
self
57+
}
58+
4959
pub fn hidden(mut self) -> Self {
5060
self.visible = false;
5161
self
@@ -75,6 +85,10 @@ impl ParameterInfo {
7585
self.is_bypass
7686
}
7787

88+
pub fn is_output(&self) -> bool {
89+
self.is_output
90+
}
91+
7892
pub fn visible(&self) -> bool {
7993
self.visible
8094
}

0 commit comments

Comments
 (0)