From c7f1c46f1895ca53a0655c7619431b1a62752ae5 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 28 Feb 2022 17:04:39 +0100 Subject: [PATCH] Add a reverse DNS ID field to ClapPlugin --- plugins/diopser/src/lib.rs | 4 +++- plugins/examples/gain-gui/src/lib.rs | 4 +++- plugins/examples/gain/src/lib.rs | 4 +++- plugins/examples/sine/src/lib.rs | 4 +++- src/plugin.rs | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/plugins/diopser/src/lib.rs b/plugins/diopser/src/lib.rs index 48e9e1d1..938fe28a 100644 --- a/plugins/diopser/src/lib.rs +++ b/plugins/diopser/src/lib.rs @@ -410,7 +410,9 @@ fn unnormalize_automation_precision(normalized: f32) -> u32 { - (normalized * (MAX_AUTOMATION_STEP_SIZE - MIN_AUTOMATION_STEP_SIZE) as f32).round() as u32 } -impl ClapPlugin for Diopser {} +impl ClapPlugin for Diopser { + const CLAP_ID: &'static str = "nl.robbertvanderhelm.diopser"; +} impl Vst3Plugin for Diopser { const VST3_CLASS_ID: [u8; 16] = *b"DiopserPlugRvdH."; diff --git a/plugins/examples/gain-gui/src/lib.rs b/plugins/examples/gain-gui/src/lib.rs index 62e1b586..7cc61e95 100644 --- a/plugins/examples/gain-gui/src/lib.rs +++ b/plugins/examples/gain-gui/src/lib.rs @@ -202,7 +202,9 @@ impl Plugin for Gain { } } -impl ClapPlugin for Gain {} +impl ClapPlugin for Gain { + const CLAP_ID: &'static str = "com.moist-plugins-gmbh.gain"; +} impl Vst3Plugin for Gain { const VST3_CLASS_ID: [u8; 16] = *b"GainGuiYeahBoyyy"; diff --git a/plugins/examples/gain/src/lib.rs b/plugins/examples/gain/src/lib.rs index 77f509eb..dafc6a5f 100644 --- a/plugins/examples/gain/src/lib.rs +++ b/plugins/examples/gain/src/lib.rs @@ -129,7 +129,9 @@ impl Plugin for Gain { } } -impl ClapPlugin for Gain {} +impl ClapPlugin for Gain { + const CLAP_ID: &'static str = "com.moist-plugins-gmbh.gain"; +} impl Vst3Plugin for Gain { const VST3_CLASS_ID: [u8; 16] = *b"GainMoistestPlug"; diff --git a/plugins/examples/sine/src/lib.rs b/plugins/examples/sine/src/lib.rs index 3f36028f..f36250e3 100644 --- a/plugins/examples/sine/src/lib.rs +++ b/plugins/examples/sine/src/lib.rs @@ -176,7 +176,9 @@ impl Plugin for Sine { } } -impl ClapPlugin for Sine {} +impl ClapPlugin for Sine { + const CLAP_ID: &'static str = "com.moist-plugins-gmbh.sine"; +} impl Vst3Plugin for Sine { const VST3_CLASS_ID: [u8; 16] = *b"SineMoistestPlug"; diff --git a/src/plugin.rs b/src/plugin.rs index 8d9ecce1..aeb9b6b7 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -103,7 +103,9 @@ pub trait Plugin: Default + Send + Sync + 'static { /// Provides auxiliary metadata needed for a CLAP plugin. pub trait ClapPlugin: Plugin { - // TODO: Add the required fields, just like the [Vst3Plugin] trait + /// A unique ID that identifies this particular plugin. This is usually in reverse domain name + /// notation, e.g. `com.manufacturer.plugin-name`. + const CLAP_ID: &'static str; } /// Provides auxiliary metadata needed for a VST3 plugin.