diff --git a/src/param/boolean.rs b/src/param/boolean.rs index 489f2ea9..1b5d1ded 100644 --- a/src/param/boolean.rs +++ b/src/param/boolean.rs @@ -226,7 +226,9 @@ impl BoolParam { /// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this /// parameter in [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`] /// events, and must thus be unique between _all_ polyphonically modulatable parameters. See the - /// event's documentation for more information on how to use this. + /// event's documentation on how to do this. Consider configuring the + /// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG] + /// constant when enabling this. /// /// # Important /// diff --git a/src/param/enums.rs b/src/param/enums.rs index f92d1a6a..4e796da6 100644 --- a/src/param/enums.rs +++ b/src/param/enums.rs @@ -337,7 +337,9 @@ impl EnumParam { /// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this /// parameter in [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`] /// events, and must thus be unique between _all_ polyphonically modulatable parameters. See the - /// event's documentation for more information on how to use this. + /// event's documentation on how to do this. Consider configuring the + /// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG] + /// constant when enabling this. /// /// # Important /// diff --git a/src/param/float.rs b/src/param/float.rs index 8da312e0..b3f258d0 100644 --- a/src/param/float.rs +++ b/src/param/float.rs @@ -293,7 +293,10 @@ impl FloatParam { /// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this /// parameter in [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`] - /// events, and must thus be unique between _all_ polyphonically modulatable parameters. + /// events, and must thus be unique between _all_ polyphonically modulatable parameters. See the + /// event's documentation on how to do this. Consider configuring the + /// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG] + /// constant when enabling this. /// /// # Important /// diff --git a/src/param/integer.rs b/src/param/integer.rs index e854fbec..b05ea4c7 100644 --- a/src/param/integer.rs +++ b/src/param/integer.rs @@ -258,7 +258,9 @@ impl IntParam { /// Enable polyphonic modulation for this parameter. The ID is used to uniquely identify this /// parameter in [`NoteEvent::PolyModulation][crate::prelude::NoteEvent::PolyModulation`] /// events, and must thus be unique between _all_ polyphonically modulatable parameters. See the - /// event's documentation for more information on how to use this. + /// event's documentation on how to do this. Consider configuring the + /// [`ClapPlugin::CLAP_POLY_MODULATION_CONFIG`][crate::prelude::ClapPlugin::CLAP_POLY_MODULATION_CONFIG] + /// constant when enabling this. /// /// # Important /// diff --git a/src/plugin.rs b/src/plugin.rs index 90b225a2..05207bad 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -19,8 +19,8 @@ use crate::wrapper::clap::features::ClapFeature; /// This is super basic, and lots of things I didn't need or want to use yet haven't been /// implemented. Notable missing features include: /// -/// - MIDI SysEx and MIDI2 for CLAP, note expressions and MIDI1 are already supported -/// - Polyphonic modulation for CLAP +/// - MIDI SysEx and MIDI2 for CLAP, note expressions, polyphonic modulation and MIDI1 are already +/// supported /// - Audio thread thread pools (with host integration in CLAP) #[allow(unused_variables)] pub trait Plugin: Default + Send + Sync + 'static { @@ -206,6 +206,9 @@ pub trait ClapPlugin: Plugin { /// Keywords describing the plugin. The host may use this to classify the plugin in its plugin /// browser. const CLAP_FEATURES: &'static [ClapFeature]; + + /// If set, this informs the host about the plugin's capabilities for polyphonic modulation. + const CLAP_POLY_MODULATION_CONFIG: Option = None; } /// Provides auxiliary metadata needed for a VST3 plugin. @@ -419,3 +422,15 @@ pub enum ProcessMode { /// processed. Offline, } + +/// Configuration for the plugin's polyphonic modulation options, if it supports . +pub struct PolyModulationConfig { + /// The maximum number of voices this plugin will ever use. Call the context's + /// `set_current_voices()` method during initialization or audio processing to set the number of + /// currently active voices. + pub max_voices: u32, + /// If set to `true`, then the host may send note events for the same channel and key, but using + /// different voice IDs. Bitwig Studio, for instance, can use this to do voice stacking. After + /// enabling this, you should always prioritize using voice IDs to map note events to voices. + pub supports_overlapping_voices: bool, +}