use sim_kernel::Result;
use sim_lib_audio_graph_core::{PortDecl, PortDir, PortMedia};
use sim_lib_plugin_core::{
ParameterDescriptor, ParameterKind, PluginDescriptor, PluginFormat, PluginId,
};
pub fn clap_audio_effect_descriptor(
stable_id: impl Into<String>,
name: impl Into<String>,
channels: u16,
) -> Result<PluginDescriptor> {
PluginDescriptor::audio_effect(PluginFormat::Clap, stable_id, name, channels)
}
pub fn clap_gain_descriptor() -> Result<PluginDescriptor> {
Ok(
clap_audio_effect_descriptor("org.sim.gain", "SIM Gain", 2)?.with_parameter(
ParameterDescriptor::new(0, "gain", "Gain", 0.0, 2.0, 1.0)?
.with_kind(ParameterKind::Float),
),
)
}
pub fn clap_synth_descriptor() -> Result<PluginDescriptor> {
let mut descriptor = PluginDescriptor::new(
PluginId::new(PluginFormat::Clap, "org.sim.subtractive-synth")?,
"SIM Subtractive Synth",
"sim",
env!("CARGO_PKG_VERSION"),
)?;
descriptor
.ports
.push(PortDecl::new("events-in", PortMedia::Event, PortDir::In, 1));
descriptor.ports.push(PortDecl::new(
"audio-out",
PortMedia::Audio,
PortDir::Out,
2,
));
descriptor.parameters.push(ParameterDescriptor::new(
0,
"output-gain",
"Output Gain",
0.0,
1.0,
0.25,
)?);
Ok(descriptor)
}