DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
DSParkClap.h File Reference

Native CLAP backend: the same plugin class, one more macro. More...

#include "../DSParkPlugin.h"
#include "clap/clap.h"
#include <algorithm>
#include <atomic>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <new>
#include <vector>
Include dependency graph for DSParkClap.h:

Go to the source code of this file.

Classes

struct  dspark::plugin::clap_backend::Plugin< P >
 
struct  dspark::plugin::clap_backend::Factory< P >
 
struct  dspark::plugin::clap_backend::Factory< P >::ProviderState
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 
namespace  dspark::plugin
 
namespace  dspark::plugin::clap_backend
 

Macros

#define DSPARK_PLUGIN_CLAP_INCLUDED   1
 
#define DSPARK_CLAP_PLUGIN(PluginClass)
 Declares the CLAP module entry for one plugin class. May coexist with DSPARK_VST3_PLUGIN in the same translation unit: the resulting binary is a valid .vst3 AND a valid .clap at the same time.
 

Variables

constexpr uint32_t dspark::plugin::clap_backend::kBypassParamId = 0x42595053u
 
constexpr int dspark::plugin::clap_backend::kBypassRampSamples = 256
 

Detailed Description

Native CLAP backend: the same plugin class, one more macro.

CLAP (https://cleveraudio.org, MIT, vendored under plugin/clap/clap/) is a plain-C plugin ABI - the cleanest of the desktop formats. This backend exposes the exact same user class as the VST3 backend:

struct MyPlugin { ... }; // see plugin/DSParkPlugin.h
DSPARK_CLAP_PLUGIN(MyPlugin) // both ABIs can live in ONE binary:
Native CLAP backend: the same plugin class, one more macro.
#define DSPARK_CLAP_PLUGIN(PluginClass)
Declares the CLAP module entry for one plugin class. May coexist with DSPARK_VST3_PLUGIN in the same ...
Native VST3 backend: a complete plugin from one DSPark plugin class.
#define DSPARK_VST3_PLUGIN(PluginClass)
Declares the VST3 module entry points for one plugin class. Place once in exactly one translation uni...

// ship it as .vst3 AND as .clap

Implementation notes:

  • CLAP parameters travel in PLAIN values (min..max), so clap_param_info maps 1:1 onto the declarative table; the wrapper still keeps its normalized shadows so state blobs stay byte-identical with the VST3 backend (presets are portable across formats by construction).
  • Parameter events apply SAMPLE-ACCURATELY by default: every timestamped event splits processing at kAutomationQuantum boundaries (plugins may opt out, see DSParkPlugin.h). DSPark setters smooth internally either way.
  • The wrapper-owned Bypass uses CLAP_PARAM_IS_BYPASS and the same short crossfade against the kept dry signal.
  • Buses follow the declared ChannelSupport through audio-ports-config (Mono / Stereo configurations); Category::Instrument drops the audio inputs and HasMidi adds a note port accepting both CLAP note events and raw MIDI (notes, pitch bend, CC, pressure).
  • HasTransport plugins receive the per-block clap transport as a TransportInfo; HasOfflineMode plugins get the render extension; a latency change after parameter motion notifies the host through clap_host_latency on the main thread (request_callback).
  • Factory presets publish through preset-load + preset-discovery (the plugin DSO itself is the preset container; load keys are indices).
  • process() runs under a DenormalGuard (FTZ/DAZ) so user DSP outside DSPark's own classes is covered in hosts that do not set it.
  • GUI: when plugin/webview/DSParkWebViewEditor.h is included before this header and the class declares hasEditor = true, the gui extension embeds the WebView editor (otherwise hosts show their generic editor). Editor edits reach the host as gesture begin/end plus CLAP_EVENT_PARAM_VALUE through a lock-free queue drained by process()/flush(), so automation recording works.

Definition in file DSParkClap.h.

Macro Definition Documentation

◆ DSPARK_CLAP_PLUGIN

#define DSPARK_CLAP_PLUGIN (   PluginClass)
Value:

Declares the CLAP module entry for one plugin class. May coexist with DSPARK_VST3_PLUGIN in the same translation unit: the resulting binary is a valid .vst3 AND a valid .clap at the same time.

Definition at line 1574 of file DSParkClap.h.

◆ DSPARK_PLUGIN_CLAP_INCLUDED

#define DSPARK_PLUGIN_CLAP_INCLUDED   1

Definition at line 53 of file DSParkClap.h.