mikkeli dd5cedfa92 fix: rewrite the plugin skeleton against the pinned NIH-plug API
The scaffold did not compile. src/lib.rs was written against an API that
does not exist at the pinned rev (f36931f):

- `impl Params` declared six methods that are not trait members
  (`as_slice`, `param_by_id`, `param_by_name` and their `_mut` pairs) over
  two types that appear nowhere in the crate (`AtomicParam`, `ParamId`).
  The real trait is `unsafe trait Params` with one required method,
  `param_map`, and is meant to be derived rather than hand-written.
- `type SysSysexMessage` misspells the associated type `SysExMessage`.
- `ChannelSamples` has no immutable `get`, so the passthrough loop's
  `*frame.get_mut(ch).unwrap() = *frame.get(ch).unwrap()` could not resolve.

Replaced with `#[derive(Params)]` over an example gain parameter, so the
skeleton demonstrates the smoother and dB formatters a real plugin needs
instead of leaving an empty struct that teaches nothing. The passthrough
loop becomes an actual gain application for the same reason.

`editor()` is wired to a real `create_egui_editor` window in the same
change rather than a follow-up: nih_plug_egui was already a declared
dependency that nothing used, and the persisted `editor_state` field the
editor needs is part of the same params struct being rewritten here.
Splitting them would leave a commit whose params struct exists only to
serve an editor that is not there yet.

Verified against a local checkout of nih-plug at the pinned rev rather
than from memory, and confirmed by building.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHt4DykxXaQnyaJfyS8KCn
2026-08-29 10:23:37 +09:00
2026-08-21 03:55:36 +00:00

NIH-plug Template

Minimal scaffold for new NIH-plug audio plugins (Rust + CLAP/VST3 + egui).

Based on patterns from musiikki/codename-206.

Quick Start

# Clone this repo as your starting point
git clone http://192.168.2.199:3005/musiikki/nih-plug-template my-plugin
cd my-plugin

# Edit: src/lib.rs, Cargo.toml, bundler.toml — replace placeholder values
# See musiikki/codename-206 for a real-world example of how to fill these in

Build

# Install Rust via rustup: https://rustup.rs
# No VST3 SDK needed — NIH-plug bundles its own bindings.

# Build + bundle the VST3 and CLAP
cargo xtask bundle nih_plug_template --release

Output: target/bundled/nih_plug_template.vst3 and nih_plug_template.clap

Deploy

FL Studio

FL Studio scans C:\Program Files\Common Files\VST3 by default, ignores directory junctions (so a symlinked bundle is invisible to its scanner), and caches failed scans.

  1. Copy the .vst3 bundle to a folder FL scans (e.g. C:\Program Files\Common Files\VST3).
  2. Copy the .clap bundle to a folder FL scans (e.g. C:\Program Files\Common Files\CLAP).
  3. In FL Studio: Options → Manage plugins → tick "Rescan previously failed plugins" → Find installed plugins, then search for your plugin name (set in bundler.toml).

Linux

# VST3
cp target/bundled/nih_plug_template.vst3 ~/.vst3/

# CLAP
cp target/bundled/nih_plug_template.clap ~/.clap/

# Or globally:
# sudo cp target/bundled/nih_plug_template.vst3 /usr/lib/vst3/
# sudo cp target/bundled/nih_plug_template.clap /usr/lib/clap/

Project Structure

Cargo.toml          # Package deps — NIH-plug pinned to codename-206's rev
bundler.toml        # Bundle name for `cargo xtask bundle`
src/lib.rs          # Plugin skeleton — fill in params, DSP, editor
xtask/              # Bundler xtask (cargo xtask bundle)
.cargo/config.toml  # xtask alias

License

Apache-2.0

VST3 Licensing Note

You must accept Steinberg's VST3 SDK licence before distributing VST3 binaries. NIH-plug's VST3 bindings are GPLv3; if you distribute, the plugin must also be GPLv3 (or you need a commercial Steinberg licence). CLAP has no such restriction.

S
Description
Minimal NIH-plug audio plugin scaffold (Rust + CLAP/VST3 + egui)
Readme GPL-3.0 219 KiB
Languages
Shell 83.7%
Rust 16.3%