Add a ClapPlugin trait
Just like the Vst3Plugin trait
This commit is contained in:
parent
8c63cebc07
commit
d5d90e3e61
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -101,6 +101,11 @@ version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap-sys"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/glowcoil/clap-sys?rev=3ef7048e1d3b426a7c6b02b5d3ae18f14874d4e5#3ef7048e1d3b426a7c6b02b5d3ae18f14874d4e5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clipboard-win"
|
name = "clipboard-win"
|
||||||
version = "3.1.1"
|
version = "3.1.1"
|
||||||
|
@ -530,6 +535,7 @@ dependencies = [
|
||||||
"assert_no_alloc",
|
"assert_no_alloc",
|
||||||
"atomic_float",
|
"atomic_float",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
"clap-sys",
|
||||||
"crossbeam",
|
"crossbeam",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"nih_plug_derive",
|
"nih_plug_derive",
|
||||||
|
|
|
@ -33,6 +33,8 @@ nih_plug_derive = { path = "nih_plug_derive" }
|
||||||
|
|
||||||
atomic_float = "0.1"
|
atomic_float = "0.1"
|
||||||
cfg-if = "1.0"
|
cfg-if = "1.0"
|
||||||
|
# For CLAP 0.18
|
||||||
|
clap-sys = { git = "https://github.com/glowcoil/clap-sys", rev = "3ef7048e1d3b426a7c6b02b5d3ae18f14874d4e5" }
|
||||||
crossbeam = "0.8"
|
crossbeam = "0.8"
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
parking_lot = "0.12"
|
parking_lot = "0.12"
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
extern crate nih_plug;
|
extern crate nih_plug;
|
||||||
|
|
||||||
use nih_plug::{
|
use nih_plug::{
|
||||||
formatters, Buffer, BufferConfig, BusConfig, Plugin, ProcessContext, ProcessStatus, Vst3Plugin,
|
formatters, Buffer, BufferConfig, BusConfig, ClapPlugin, Plugin, ProcessContext, ProcessStatus,
|
||||||
|
Vst3Plugin,
|
||||||
};
|
};
|
||||||
use nih_plug::{BoolParam, FloatParam, IntParam, Params, Range, SmoothingStyle};
|
use nih_plug::{BoolParam, FloatParam, IntParam, Params, Range, SmoothingStyle};
|
||||||
use nih_plug::{Enum, EnumParam};
|
use nih_plug::{Enum, EnumParam};
|
||||||
|
@ -409,6 +410,8 @@ fn unnormalize_automation_precision(normalized: f32) -> u32 {
|
||||||
- (normalized * (MAX_AUTOMATION_STEP_SIZE - MIN_AUTOMATION_STEP_SIZE) as f32).round() as u32
|
- (normalized * (MAX_AUTOMATION_STEP_SIZE - MIN_AUTOMATION_STEP_SIZE) as f32).round() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ClapPlugin for Diopser {}
|
||||||
|
|
||||||
impl Vst3Plugin for Diopser {
|
impl Vst3Plugin for Diopser {
|
||||||
const VST3_CLASS_ID: [u8; 16] = *b"DiopserPlugRvdH.";
|
const VST3_CLASS_ID: [u8; 16] = *b"DiopserPlugRvdH.";
|
||||||
const VST3_CATEGORIES: &'static str = "Fx|Filter";
|
const VST3_CATEGORIES: &'static str = "Fx|Filter";
|
||||||
|
|
|
@ -3,8 +3,8 @@ extern crate nih_plug;
|
||||||
|
|
||||||
use atomic_float::AtomicF32;
|
use atomic_float::AtomicF32;
|
||||||
use nih_plug::{
|
use nih_plug::{
|
||||||
util, Buffer, BufferConfig, BusConfig, Editor, IntParam, Plugin, ProcessContext, ProcessStatus,
|
util, Buffer, BufferConfig, BusConfig, ClapPlugin, Editor, IntParam, Plugin, ProcessContext,
|
||||||
Vst3Plugin,
|
ProcessStatus, Vst3Plugin,
|
||||||
};
|
};
|
||||||
use nih_plug::{FloatParam, Params, Range, SmoothingStyle};
|
use nih_plug::{FloatParam, Params, Range, SmoothingStyle};
|
||||||
use nih_plug_egui::{create_egui_editor, egui, widgets, EguiState};
|
use nih_plug_egui::{create_egui_editor, egui, widgets, EguiState};
|
||||||
|
@ -202,6 +202,8 @@ impl Plugin for Gain {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ClapPlugin for Gain {}
|
||||||
|
|
||||||
impl Vst3Plugin for Gain {
|
impl Vst3Plugin for Gain {
|
||||||
const VST3_CLASS_ID: [u8; 16] = *b"GainGuiYeahBoyyy";
|
const VST3_CLASS_ID: [u8; 16] = *b"GainGuiYeahBoyyy";
|
||||||
const VST3_CATEGORIES: &'static str = "Fx|Dynamics";
|
const VST3_CATEGORIES: &'static str = "Fx|Dynamics";
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
extern crate nih_plug;
|
extern crate nih_plug;
|
||||||
|
|
||||||
use nih_plug::{
|
use nih_plug::{
|
||||||
formatters, util, Buffer, BufferConfig, BusConfig, Plugin, ProcessContext, ProcessStatus,
|
formatters, util, Buffer, BufferConfig, BusConfig, ClapPlugin, Plugin, ProcessContext,
|
||||||
Vst3Plugin,
|
ProcessStatus, Vst3Plugin,
|
||||||
};
|
};
|
||||||
use nih_plug::{BoolParam, FloatParam, Params, Range, Smoother, SmoothingStyle};
|
use nih_plug::{BoolParam, FloatParam, Params, Range, Smoother, SmoothingStyle};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
@ -129,6 +129,8 @@ impl Plugin for Gain {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ClapPlugin for Gain {}
|
||||||
|
|
||||||
impl Vst3Plugin for Gain {
|
impl Vst3Plugin for Gain {
|
||||||
const VST3_CLASS_ID: [u8; 16] = *b"GainMoistestPlug";
|
const VST3_CLASS_ID: [u8; 16] = *b"GainMoistestPlug";
|
||||||
const VST3_CATEGORIES: &'static str = "Fx|Dynamics";
|
const VST3_CATEGORIES: &'static str = "Fx|Dynamics";
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
extern crate nih_plug;
|
extern crate nih_plug;
|
||||||
|
|
||||||
use nih_plug::{
|
use nih_plug::{
|
||||||
formatters, util, Buffer, BufferConfig, BusConfig, Plugin, ProcessContext, ProcessStatus,
|
formatters, util, Buffer, BufferConfig, BusConfig, ClapPlugin, Plugin, ProcessContext,
|
||||||
Vst3Plugin,
|
ProcessStatus, Vst3Plugin,
|
||||||
};
|
};
|
||||||
use nih_plug::{BoolParam, FloatParam, Params, Range, Smoother, SmoothingStyle};
|
use nih_plug::{BoolParam, FloatParam, Params, Range, Smoother, SmoothingStyle};
|
||||||
use std::f32::consts;
|
use std::f32::consts;
|
||||||
|
@ -176,6 +176,8 @@ impl Plugin for Sine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ClapPlugin for Sine {}
|
||||||
|
|
||||||
impl Vst3Plugin for Sine {
|
impl Vst3Plugin for Sine {
|
||||||
const VST3_CLASS_ID: [u8; 16] = *b"SineMoistestPlug";
|
const VST3_CLASS_ID: [u8; 16] = *b"SineMoistestPlug";
|
||||||
const VST3_CATEGORIES: &'static str = "Instrument|Synth|Tools";
|
const VST3_CATEGORIES: &'static str = "Instrument|Synth|Tools";
|
||||||
|
|
|
@ -19,8 +19,8 @@ pub use param::range::Range;
|
||||||
pub use param::smoothing::{Smoother, SmoothingStyle};
|
pub use param::smoothing::{Smoother, SmoothingStyle};
|
||||||
pub use param::{BoolParam, FloatParam, IntParam, Param};
|
pub use param::{BoolParam, FloatParam, IntParam, Param};
|
||||||
pub use plugin::{
|
pub use plugin::{
|
||||||
BufferConfig, BusConfig, Editor, NoteEvent, ParentWindowHandle, Plugin, ProcessStatus,
|
BufferConfig, BusConfig, ClapPlugin, Editor, NoteEvent, ParentWindowHandle, Plugin,
|
||||||
Vst3Plugin,
|
ProcessStatus, Vst3Plugin,
|
||||||
};
|
};
|
||||||
|
|
||||||
// The rest is either internal or already re-exported
|
// The rest is either internal or already re-exported
|
||||||
|
|
|
@ -101,6 +101,11 @@ pub trait Plugin: Default + Send + Sync + 'static {
|
||||||
fn process(&mut self, buffer: &mut Buffer, context: &mut impl ProcessContext) -> ProcessStatus;
|
fn process(&mut self, buffer: &mut Buffer, context: &mut impl ProcessContext) -> ProcessStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Provides auxiliary metadata needed for a CLAP plugin.
|
||||||
|
pub trait ClapPlugin: Plugin {
|
||||||
|
// TODO: Add the required fields, just like the [Vst3Plugin] trait
|
||||||
|
}
|
||||||
|
|
||||||
/// Provides auxiliary metadata needed for a VST3 plugin.
|
/// Provides auxiliary metadata needed for a VST3 plugin.
|
||||||
pub trait Vst3Plugin: Plugin {
|
pub trait Vst3Plugin: Plugin {
|
||||||
/// The unique class ID that identifies this particular plugin. You can use the
|
/// The unique class ID that identifies this particular plugin. You can use the
|
||||||
|
|
Loading…
Reference in a new issue