Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5f033b3
Extract format-neutral gain processor
godofecht Nov 16, 2026
72605f4
Reuse shared DSP in existing VST3 plugin
godofecht Nov 16, 2026
1393821
Add CLAP 1.x ABI declarations and layout tests
godofecht Nov 16, 2026
7dae6db
Implement loadable CLAP gain plugin with audio, automation, parameter…
godofecht Nov 16, 2026
336a998
Expose CLAP interface in public module
godofecht Nov 16, 2026
e826218
Correct CLAP ABI test sizes
godofecht Nov 16, 2026
df25770
Build native CLAP and universal macOS bundle
godofecht Nov 16, 2026
c836faa
Exercise CLAP loading, audio processing and sample-timed automation
godofecht Nov 16, 2026
2866900
Add CLAP ABI integration harness to build and tests
godofecht Nov 16, 2026
b3b58cf
Verify CLAP integration and macOS packaging in CI
godofecht Nov 16, 2026
1745da9
Distribute format adapter scripts with Zig package
godofecht Nov 16, 2026
4914839
Provide effect-typed AUv2 and optional AAX wrapper targets
godofecht Nov 16, 2026
daa63bb
Add AUv2/AAX CMake build helper with SDK gates
godofecht Nov 16, 2026
d111a09
Document CLAP, AUv2 and AAX build and validation paths
godofecht Nov 16, 2026
6b56fe2
Expose new CLAP, AU and AAX format support in README
godofecht Nov 16, 2026
b99ab44
Fix CLAP shared DSP module import boundaries
godofecht Nov 16, 2026
f67d2c4
Fix CLAP shared DSP module import boundaries
godofecht Nov 16, 2026
0a51e72
Build AUv2 wrapper on macOS with public SDKs in CI
godofecht Nov 16, 2026
1e3be41
Enable Objective-C++ in parent scope for AU wrapper CMake
godofecht Nov 16, 2026
a9129e7
Compile AU wrapper and recent AudioUnitSDK with C++20
godofecht Nov 16, 2026
d606b66
Use C++23 for current Apple AudioUnitSDK expected types
godofecht Nov 16, 2026
4c0bca0
Target C++20 for Apple AudioUnitSDK 1.3 wrapper
godofecht Nov 16, 2026
e6a576b
Pin Apple AudioUnitSDK 1.3.0 to avoid C++23-only headers
godofecht Nov 16, 2026
9ab26f5
Document pinned AudioUnitSDK compatibility version
godofecht Nov 16, 2026
ac9facf
Verify packaged Audio Unit with Apple's auval in CI
godofecht Nov 16, 2026
cea7491
Refresh AudioComponentRegistrar before AUv2 host validation
godofecht Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/auv2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: AUv2 wrapper

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
build-auv2:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: "0.15.2"
- name: Checkout public wrapper dependencies
run: |
mkdir -p "$RUNNER_TEMP/audio-sdks"
git clone --depth 1 https://github.com/free-audio/clap.git "$RUNNER_TEMP/audio-sdks/clap"
git clone --depth 1 --recurse-submodules --branch v0.15.1 https://github.com/free-audio/clap-wrapper.git "$RUNNER_TEMP/audio-sdks/clap-wrapper"
git clone https://github.com/apple/AudioUnitSDK.git "$RUNNER_TEMP/audio-sdks/AudioUnitSDK"
git -C "$RUNNER_TEMP/audio-sdks/AudioUnitSDK" checkout e789bc83ddc07cbf80e7bfaf84f1ade975287400
- name: Build Danzig AUv2 component
env:
CLAP_WRAPPER_SOURCE: ${{ runner.temp }}/audio-sdks/clap-wrapper
CLAP_SDK_ROOT: ${{ runner.temp }}/audio-sdks/clap
AUDIOUNIT_SDK_ROOT: ${{ runner.temp }}/audio-sdks/AudioUnitSDK
run: bash scripts/build-wrappers.sh
- name: Inspect Audio Unit bundle
run: |
component="$(find zig-out/format-wrappers -type d -name DanzigGain.component -print -quit)"
test -n "$component"
test -f "$component/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Print :AudioComponents" "$component/Contents/Info.plist" || true
echo "Built: $component"
- name: Validate AUv2 through Apple auval
run: |
component="$(find zig-out/format-wrappers -type d -name DanzigGain.component -print -quit)"
codesign --force --deep --sign - "$component"
mkdir -p "$HOME/Library/Audio/Plug-Ins/Components"
cp -R "$component" "$HOME/Library/Audio/Plug-Ins/Components/"
killall -9 AudioComponentRegistrar 2>/dev/null || true
for attempt in 1 2 3 4 5; do
if auval -a | grep -Eq 'aufx[[:space:]]+DzGn[[:space:]]+SuEl'; then
break
fi
sleep 3
done
auval -a
auval -v aufx DzGn SuEl
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ jobs:
# Drives the built plugin through the raw VST3 C ABI.
- name: Test
run: zig build test

- name: Package CLAP
run: zig build clap
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
[![CI](https://github.com/godofecht/danzig/actions/workflows/ci.yml/badge.svg)](https://github.com/godofecht/danzig/actions/workflows/ci.yml)
[![Zig](https://img.shields.io/badge/zig-0.14.1%20%7C%200.15.2%20%7C%200.16.0-f7a41d)](https://ziglang.org/)

A VST3 plugin framework in pure Zig. No JUCE, no Steinberg SDK, no C++ in the
core. `src/vst3.zig` implements the VST3 C ABI directly as `extern struct`s of
A VST3 and CLAP plugin framework in pure Zig. No JUCE, no Steinberg SDK, no C++ in the
core. AUv2 and AAX builds are available through optional external CLAP wrappers. `src/vst3.zig` implements the VST3 C ABI directly as `extern struct`s of
`callconv(.c)` function pointers, which is what a C++ vtable is at the machine
level.

**[Read the guide: docs/WIKI.md](docs/WIKI.md)**
**[Read the guide: docs/WIKI.md](docs/WIKI.md)** | **[Plugin formats: CLAP / AU / AAX](docs/FORMATS.md)**

## Setup

Expand All @@ -27,8 +27,11 @@ By hand:
```bash
zig build # Build Summary: 29/29 steps succeeded
zig build test --summary all # Build Summary: 9/9 steps succeeded; 35/35 tests passed
zig build vst3 # universal arm64 + x86_64 bundle in zig-out/
zig build vst3 # universal arm64 + x86_64 VST3 bundle in zig-out/
zig build clap # universal arm64 + x86_64 CLAP bundle
zig build test-clap # CLAP factory and processing integration test
zig build install-vst3 # copy it to ~/Library/Audio/Plug-Ins/VST3/
zig build install-clap # copy it to ~/Library/Audio/Plug-Ins/CLAP/
```

Then:
Expand All @@ -54,6 +57,7 @@ Architectures in the fat file: zig-out/DanzigGain.vst3/Contents/MacOS/DanzigGain

| File | Contents |
|---|---|
| `clap.zig` | The CLAP 1.x C ABI, plugin lifecycle, parameters, audio buses, events and state interfaces. |
| `vst3.zig` | The VST3 C ABI: `IUnknown`, `IPluginBase`, `IComponent`, `IAudioProcessor`, `IEditController`, and the structs they pass. |
| `plugin.zig` | Plugin lifecycle and a heap-backed `ParameterMap`. |
| `audio.zig` | `dBToLinear`, `GainProcessor`, `SimpleRamp`, `AudioBuffer`. |
Expand All @@ -66,6 +70,8 @@ Architectures in the fat file: zig-out/DanzigGain.vst3/Contents/MacOS/DanzigGain
|---|---|
| [danzig-minimal](examples/danzig-minimal/). The smallest complete plugin, and the file to copy. | `zig build run-minimal` |
| [danzig-gain](examples/danzig-gain/). The plugin packaged into the `.vst3` bundle. | `zig build vst3` |
| [danzig-gain-clap](examples/danzig-gain-clap/). Shared gain DSP exported through the CLAP ABI. | `zig build clap` |
| [danzig-clap-test](examples/danzig-clap-test/). CLAP factory, parameters and processing test. | `zig build test-clap` |
| [danzig-test](examples/danzig-test/). Drives the built plugin through the raw VST3 C ABI. | `zig build test-integration` |
| [danzig-gain-standalone](examples/danzig-gain-standalone/). Offline WAV gain processing. | `zig build run-standalone` |
| [danzig-webui](examples/danzig-webui/). An HTTP server in pure `std.net`. | `./zig-out/bin/danzig-webui` |
Expand Down Expand Up @@ -121,8 +127,10 @@ The default Debug build produces the same artifacts at roughly 1 to 2 MB each.

## Current state

The core library, the tests, the build pipeline, the examples, and the VST3
plugin all work. `examples/danzig-gain` builds a universal `.vst3` bundle that a
The existing VST3 implementation has passed host validation. The CLAP adapter
and AUv2/AAX wrapper build configurations are being validated separately; see
[format-specific status and requirements](docs/FORMATS.md). The VST3
core library, tests and build pipeline remain available. `examples/danzig-gain` builds a universal `.vst3` bundle that a
host loads and instantiates, and it passes pluginval at strictness level 5:

```
Expand All @@ -142,6 +150,8 @@ shared lock-free parameter store. See

Published at [godofecht.github.io/danzig](https://godofecht.github.io/danzig/).

- **[docs/FORMATS.md](docs/FORMATS.md)**. CLAP and external AUv2/AAX wrappers,
packaging, signing and validation.
- **[docs/WIKI.md](docs/WIKI.md)**. The single-page guide. Architecture,
quickstart, parameters, audio helpers, bundle packaging, testing,
troubleshooting.
Expand Down
115 changes: 115 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("src/root.zig"),
});

// Share the format-neutral DSP across format-specific Zig modules.
const gain_core = b.addModule("gain_core", .{
.root_source_file = b.path("examples/danzig-gain/dsp.zig"),
});
gain_core.addImport("danzig", danzig_module);

// Danzig gain VST3 plugin (shared, embeds danzig)
const danzig_gain = b.addLibrary(.{
.name = "DanzigGain",
Expand All @@ -38,6 +44,36 @@ pub fn build(b: *std.Build) void {
// Install to zig-out/lib/
b.installArtifact(danzig_gain);

// Native CLAP dynamic library. macOS bundle packaging is a separate step.
const danzig_clap = b.addLibrary(.{
.name = "DanzigGainCLAP",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/danzig-gain-clap/root.zig"),
.target = target,
.optimize = optimize,
}),
.linkage = .dynamic,
});
danzig_clap.root_module.addImport("danzig", danzig_module);
danzig_clap.root_module.addImport("gain_core", gain_core);
b.installArtifact(danzig_clap);

// Execute the CLAP factory and DSP through the exported C ABI.
const clap_test = b.addExecutable(.{
.name = "danzig_clap_test",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/danzig-clap-test/root.zig"),
.target = target,
.optimize = optimize,
}),
});
clap_test.root_module.addImport("danzig", danzig_module);
clap_test.root_module.linkLibrary(danzig_clap);
b.installArtifact(clap_test);
const run_clap_test = b.addRunArtifact(clap_test);
const clap_test_step = b.step("test-clap", "Run CLAP ABI integration tests");
clap_test_step.dependOn(&run_clap_test.step);

// Integration harness. Links the plugin itself so it can call the exported
// GetPluginFactory entry point and drive it through the raw VST3 C ABI.
const danzig_test = b.addExecutable(.{
Expand Down Expand Up @@ -131,6 +167,7 @@ pub fn build(b: *std.Build) void {
// because it doubles compile work and only applies to macOS.
if (target.result.os.tag == .macos) {
addVst3Bundle(b, optimize, danzig_module);
addClapBundle(b, optimize, danzig_module, gain_core);
}

// --- GUI example (macOS) -------------------------------------------------
Expand Down Expand Up @@ -169,6 +206,7 @@ pub fn build(b: *std.Build) void {
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_unit_tests.step);
test_step.dependOn(&run_test.step);
test_step.dependOn(&run_clap_test.step);
}

/// Build DanzigGain for both macOS architectures, merge them into one
Expand Down Expand Up @@ -313,3 +351,80 @@ fn infoPlist(b: *std.Build) []const u8 {
;
return b.fmt(template, .{ VERSION, VERSION });
}


/// Build a universal macOS CLAP bundle containing the same DSP used by VST3.
fn addClapBundle(
b: *std.Build,
optimize: std.builtin.OptimizeMode,
danzig_module: *std.Build.Module,
gain_core: *std.Build.Module,
) void {
const arches = [_]std.Target.Cpu.Arch{ .aarch64, .x86_64 };
const suffixes = [_][]const u8{ "arm64", "x86" };
const lipo = b.addSystemCommand(&.{ "lipo", "-create" });

inline for (arches, suffixes) |arch, suffix| {
const arch_target = b.resolveTargetQuery(.{ .cpu_arch = arch, .os_tag = .macos });
const plugin = b.addLibrary(.{
.name = "DanzigGainCLAP_" ++ suffix,
.root_module = b.createModule(.{
.root_source_file = b.path("examples/danzig-gain-clap/root.zig"),
.target = arch_target,
.optimize = optimize,
}),
.linkage = .dynamic,
});
plugin.root_module.addImport("danzig", danzig_module);
plugin.root_module.addImport("gain_core", gain_core);
lipo.addArtifactArg(plugin);
}

lipo.addArg("-output");
const universal = lipo.addOutputFileArg("DanzigGain");
const bundle = b.addWriteFiles();
_ = bundle.add("Contents/Info.plist", clapInfoPlist(b));
_ = bundle.add("Contents/PkgInfo", "BNDL????");
_ = bundle.addCopyFile(universal, "Contents/MacOS/DanzigGain");

const package = b.addInstallDirectory(.{
.source_dir = bundle.getDirectory(),
.install_dir = .prefix,
.install_subdir = "DanzigGain.clap",
});
const clap_step = b.step("clap", "Build the universal macOS CLAP plugin");
clap_step.dependOn(&package.step);

const install = b.addSystemCommand(&.{
"sh", "-c",
"mkdir -p \"$HOME/Library/Audio/Plug-Ins/CLAP\" && rm -rf \"$HOME/Library/Audio/Plug-Ins/CLAP/DanzigGain.clap\" && cp -R \"$1\" \"$HOME/Library/Audio/Plug-Ins/CLAP/DanzigGain.clap\"",
"sh",
});
install.addDirectoryArg(bundle.getDirectory());
const install_step = b.step("install-clap", "Install CLAP to ~/Library/Audio/Plug-Ins/CLAP/");
install_step.dependOn(&install.step);
}

fn clapInfoPlist(b: *std.Build) []const u8 {
const template =
\\<?xml version="1.0" encoding="UTF-8"?>
\\<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
\\<plist version="1.0">
\\<dict>
\\ <key>CFBundleExecutable</key>
\\ <string>DanzigGain</string>
\\ <key>CFBundleIdentifier</key>
\\ <string>dev.superelectric.danzig.gain.clap</string>
\\ <key>CFBundleName</key>
\\ <string>DanzigGain</string>
\\ <key>CFBundlePackageType</key>
\\ <string>BNDL</string>
\\ <key>CFBundleVersion</key>
\\ <string>{s}</string>
\\ <key>CFBundleShortVersionString</key>
\\ <string>{s}</string>
\\</dict>
\\</plist>
;
return b.fmt(template, .{ VERSION, VERSION });
}
2 changes: 2 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"build.zig.zon",
"src",
"examples",
"wrappers",
"scripts",
"ui",
},
}
78 changes: 78 additions & 0 deletions docs/FORMATS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Plugin formats

Danzig's DSP is host-neutral Zig. The VST3 and CLAP adapters share
`examples/danzig-gain/dsp.zig`; the CLAP ABI declarations live in
`src/clap.zig`. The CLAP example implements its factory, stereo ports, gain and
bypass parameters, sample-timed automation and state persistence. Hosts provide
generic parameter controls; no custom CLAP editor is claimed.

## CLAP

Build and test the CLAP adapter on a supported target with `zig build` and
`zig build test-clap`. On macOS, package and install the universal bundle:

```sh
zig build clap
zig build test-clap
zig build install-clap
```

The bundle is `zig-out/DanzigGain.clap`. Install it to
`~/Library/Audio/Plug-Ins/CLAP` or `/Library/Audio/Plug-Ins/CLAP` on macOS.
The plugin identifier is `dev.superelectric.danzig.gain`, which must remain
stable across releases. Before shipping, validate using clap-validator and
a real host such as REAPER.

## Audio Unit v2

AUv2 is produced by [clap-wrapper](https://github.com/free-audio/clap-wrapper),
which hosts the CLAP implementation rather than duplicating the audio/parameter
protocol. The wrapper registers as an **effect** (`aufx`), not an instrument
(`aumu`), with subtype `DzGn` and manufacturer code `SuEl`.

On macOS, install Zig, CMake and Xcode command-line tools, then clone
[free-audio/clap](https://github.com/free-audio/clap),
[free-audio/clap-wrapper](https://github.com/free-audio/clap-wrapper), and
[apple/AudioUnitSDK](https://github.com/apple/AudioUnitSDK) (version 1.3.0; commit `e789bc83ddc07cbf80e7bfaf84f1ade975287400` for the CI-tested build).

```sh
export CLAP_WRAPPER_SOURCE="$HOME/src/clap-wrapper"
export CLAP_SDK_ROOT="$HOME/src/clap"
export AUDIOUNIT_SDK_ROOT="$HOME/src/AudioUnitSDK"
bash scripts/build-wrappers.sh
```

The `DanzigGain.component` bundle is produced under `zig-out/format-wrappers`.
Copy it into `~/Library/Audio/Plug-Ins/Components/`, sign as appropriate
and run `auval -v aufx DzGn SuEl` after registration. The AUv2 build requires
external SDKs and is intentionally not part of `zig build`.

## AAX

The same clap-wrapper project supports an optional AAX target, using Avid's
separately licensed AAX SDK. On macOS, set `AAX_SDK_ROOT` and opt in:

```sh
export DANZIG_BUILD_AAX=ON
export AAX_SDK_ROOT="$HOME/src/aax"
bash scripts/build-wrappers.sh
```

This can produce a `DanzigGain.aaxplugin` wrapper if the SDK and toolchain
support it. It is **not** automatically a Pro Tools-loadable release: Avid
developer terms, Avid/PACE signing, and validation in Pro Tools are still
required. Pro Tools testing also needs an iLok account. No AAX SDK sources
or signing credentials are committed to the repository.

## Verification matrix

| Format | Build | Verification |
|---|---|---|
| VST3 | `zig build vst3` | Existing VST3 C ABI harness |
| CLAP | `zig build clap` | CLAP factory, parameters and processing harness |
| AUv2 | `bash scripts/build-wrappers.sh` | Requires AudioUnitSDK, macOS and `auval` |
| AAX | `DANZIG_BUILD_AAX=ON bash scripts/build-wrappers.sh` | Requires Avid SDK, signing and Pro Tools |

These external wrappers are not a claim of independent native Zig AU or AAX
implementations. Danzig and clap-wrapper are MIT licensed; Apple AudioUnitSDK
and Avid AAX SDK have independent licences and redistribution requirements.
Loading
Loading