chore: scaffold Kolmekivi from nih-plug-template
A stereo delay/echo plugin. Scaffolded rather than forked: the template
and the plugins built from it diverge on branding immediately, so they
share code by file copy — as codename-206 does — not by merge base. This
repo starts its own history.
Branded with tools/brand-plugin.sh. Everything derives from PLUGIN_NAME
("Kolmekivi" -> kolmekivi / Kolmekivi / KolmekiviParams), so no override
is pinned. CODENAME is set to the repo name and, by convention, stays
there even if the plugin is later renamed.
Two identity constants are now frozen and must never move, because hosts
key saved projects and presets off them:
CLAP_ID org.novoyuuparosk.kolmekivi
VST3_CLASS_ID KolmekiviDelay!! (exactly 16 bytes)
Host categorisation is set for a delay rather than left at the template's
generic placeholders — ClapFeature::{AudioEffect,Delay,Stereo} and
Vst3SubCategory::{Fx,Delay}. These decide where the plugin appears in a
host's browser and are not covered by the branding checker, which knows
about names rather than categories.
The DSP is not written. src/lib.rs still carries the template's example
gain parameter, so the plugin builds, bundles and loads while the delay is
implemented.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHt4DykxXaQnyaJfyS8KCn
This commit is contained in:
+147
@@ -0,0 +1,147 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
use nih_plug::prelude::*;
|
||||
use nih_plug_egui::{create_egui_editor, egui, widgets, EguiState};
|
||||
use std::sync::Arc;
|
||||
|
||||
// ──────────────────────────────────────────────
|
||||
// Params — add your plugin parameters here.
|
||||
// See musiikki/codename-206/src/params.rs for a real example.
|
||||
// ──────────────────────────────────────────────
|
||||
|
||||
#[derive(Params)]
|
||||
struct KolmekiviParams {
|
||||
/// Editor window size, persisted with the plugin state.
|
||||
#[persist = "editor-state"]
|
||||
editor_state: Arc<EguiState>,
|
||||
|
||||
/// Example parameter — replace with your own. The `id` is the stable key the host
|
||||
/// stores automation against, so never change it once you've shipped.
|
||||
#[id = "gain"]
|
||||
gain: FloatParam,
|
||||
}
|
||||
|
||||
impl Default for KolmekiviParams {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
editor_state: EguiState::from_size(320, 160),
|
||||
gain: FloatParam::new(
|
||||
"Gain",
|
||||
util::db_to_gain(0.0),
|
||||
FloatRange::Skewed {
|
||||
min: util::db_to_gain(-30.0),
|
||||
max: util::db_to_gain(30.0),
|
||||
factor: FloatRange::gain_skew_factor(-30.0, 30.0),
|
||||
},
|
||||
)
|
||||
.with_smoother(SmoothingStyle::Logarithmic(50.0))
|
||||
.with_unit(" dB")
|
||||
.with_value_to_string(formatters::v2s_f32_gain_to_db(2))
|
||||
.with_string_to_value(formatters::s2v_f32_gain_to_db()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────
|
||||
// Plugin
|
||||
// ──────────────────────────────────────────────
|
||||
|
||||
#[derive(Default)]
|
||||
struct Kolmekivi {
|
||||
params: Arc<KolmekiviParams>,
|
||||
}
|
||||
|
||||
impl Plugin for Kolmekivi {
|
||||
// TODO: Replace these placeholder values with your plugin's metadata.
|
||||
const NAME: &'static str = "Kolmekivi";
|
||||
const VENDOR: &'static str = "Novoyuuparosk";
|
||||
const URL: &'static str = env!("CARGO_PKG_HOMEPAGE");
|
||||
const EMAIL: &'static str = "mikkeli@novoyuuparosk.org";
|
||||
|
||||
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
const AUDIO_IO_LAYOUTS: &'static [AudioIOLayout] = &[AudioIOLayout {
|
||||
main_input_channels: NonZeroU32::new(2),
|
||||
main_output_channels: NonZeroU32::new(2),
|
||||
..AudioIOLayout::const_default()
|
||||
}];
|
||||
|
||||
const MIDI_INPUT: MidiConfig = MidiConfig::None;
|
||||
const MIDI_OUTPUT: MidiConfig = MidiConfig::None;
|
||||
|
||||
const SAMPLE_ACCURATE_AUTOMATION: bool = true;
|
||||
|
||||
type SysExMessage = ();
|
||||
type BackgroundTask = ();
|
||||
|
||||
fn params(&self) -> Arc<dyn Params> {
|
||||
self.params.clone()
|
||||
}
|
||||
|
||||
fn editor(&mut self, _async_executor: AsyncExecutor<Self>) -> Option<Box<dyn Editor>> {
|
||||
// TODO: Build your own egui layout here.
|
||||
let params = self.params.clone();
|
||||
create_egui_editor(
|
||||
self.params.editor_state.clone(),
|
||||
(),
|
||||
|_, _| {},
|
||||
move |egui_ctx, setter, _state| {
|
||||
egui::CentralPanel::default().show(egui_ctx, |ui| {
|
||||
ui.label("Gain");
|
||||
ui.add(widgets::ParamSlider::for_param(¶ms.gain, setter));
|
||||
});
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn initialize(
|
||||
&mut self,
|
||||
_audio_io_layout: &AudioIOLayout,
|
||||
_buffer_config: &BufferConfig,
|
||||
_context: &mut impl InitContext<Self>,
|
||||
) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn reset(&mut self) {}
|
||||
|
||||
fn process(
|
||||
&mut self,
|
||||
buffer: &mut Buffer,
|
||||
_aux: &mut AuxiliaryBuffers,
|
||||
_context: &mut impl ProcessContext<Self>,
|
||||
) -> ProcessStatus {
|
||||
// TODO: Implement your DSP here. This applies the example gain parameter; note that
|
||||
// the smoother is advanced once per frame so automation doesn't zipper.
|
||||
for mut frame in buffer.iter_samples() {
|
||||
let gain = self.params.gain.smoothed.next();
|
||||
for sample in frame.iter_mut() {
|
||||
*sample *= gain;
|
||||
}
|
||||
}
|
||||
|
||||
ProcessStatus::Normal
|
||||
}
|
||||
}
|
||||
|
||||
impl ClapPlugin for Kolmekivi {
|
||||
// Frozen identity: hosts key saved projects and presets off this. Never change it.
|
||||
const CLAP_ID: &'static str = "org.novoyuuparosk.kolmekivi";
|
||||
const CLAP_DESCRIPTION: Option<&'static str> = Some("Stereo delay with feedback and mix control");
|
||||
const CLAP_MANUAL_URL: Option<&'static str> = Some(Self::URL);
|
||||
const CLAP_SUPPORT_URL: Option<&'static str> = None;
|
||||
const CLAP_FEATURES: &'static [ClapFeature] =
|
||||
&[ClapFeature::AudioEffect, ClapFeature::Delay, ClapFeature::Stereo];
|
||||
}
|
||||
|
||||
#[cfg(feature = "vst3")]
|
||||
impl Vst3Plugin for Kolmekivi {
|
||||
// Frozen identity, exactly 16 bytes. Never change it once distributed.
|
||||
const VST3_CLASS_ID: [u8; 16] = *b"KolmekiviDelay!!";
|
||||
const VST3_SUBCATEGORIES: &'static [Vst3SubCategory] =
|
||||
&[Vst3SubCategory::Fx, Vst3SubCategory::Delay];
|
||||
}
|
||||
|
||||
nih_export_clap!(Kolmekivi);
|
||||
#[cfg(feature = "vst3")]
|
||||
nih_export_vst3!(Kolmekivi);
|
||||
Reference in New Issue
Block a user