DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
dspark::plugin::PluginBase< Derived > Struct Template Reference

Optional convenience base that makes EVERY contract method visible and overridable from one place - IDE-discoverable, without the virtuals. More...

#include <DSParkPlugin.h>

Public Member Functions

void reset () noexcept
 
int getLatency () const noexcept
 
double getTailSeconds () const noexcept
 
std::vector< uint8_t > getState () const
 
bool setState (const uint8_t *, size_t)
 - restore side. Return false on a foreign blob.
 
void setTransport (const TransportInfo &) noexcept
 
void setOfflineRendering (bool) noexcept
 

Static Public Attributes

static constexpr bool hasEditor = false
 

Detailed Description

template<typename Derived>
struct dspark::plugin::PluginBase< Derived >

Optional convenience base that makes EVERY contract method visible and overridable from one place - IDE-discoverable, without the virtuals.

struct MyPlugin : dspark::plugin::PluginBase<MyPlugin> { ... };
Optional convenience base that makes EVERY contract method visible and overridable from one place - I...

Each method below ships a safe default; define the same signature in your class to replace it (plain C++ shadowing - resolved at compile time, zero dispatch cost, no override keyword involved). Delete nothing, implement what applies, and your IDE's autocomplete shows you the full menu.

Inheriting is OPTIONAL: a free-standing struct with the same members works identically (the wrappers detect capabilities structurally either way). You must still provide the two identity members yourself - descriptor and parameters have no safe default - plus prepare, setParameter and processBlock.

Three capabilities have no default here on purpose, because their mere presence changes what the host sees:

  • a sidechain input: define void processBlock(AudioBufferView<float> io, AudioBufferView<float> sidechain) noexcept INSTEAD of the single-buffer form and every format grows a host-routable "Sidechain" bus (see HasSidechain);
  • MIDI input: define void handleMidiEvent(const MidiEvent&) noexcept and every format grows a note/event input (see HasMidi);
  • factory presets: declare static constexpr auto factoryPresets = presets(...) and every format publishes a host-browsable program list (see HasFactoryPresets). Channel support is declarative too (static constexpr auto channels) and already defaults to mono+stereo without any member here.

Definition at line 789 of file DSParkPlugin.h.

Member Function Documentation

◆ getLatency()

template<typename Derived >
int dspark::plugin::PluginBase< Derived >::getLatency ( ) const
inlinenoexcept

Samples of delay your chain introduces (lookahead limiters, linear-phase EQ, oversampling, FFT processing). The host shifts other tracks to compensate - report it accurately or parallel paths phase. Read after prepare(); sum your DSPark effects' getLatency(). Maps to VST3 getLatencySamples and the CLAP latency extension. Default: zero latency.

Definition at line 807 of file DSParkPlugin.h.

◆ getState()

template<typename Derived >
std::vector< uint8_t > dspark::plugin::PluginBase< Derived >::getState ( ) const
inline

Extra state BEYOND the parameters (learned profiles, loaded IRs, editor layout). The wrapper already saves/restores every parameter by its stable id on its own - most plugins never touch this pair. DSPark's StateBlob (Core/StateBlob.h) is the natural serializer. Default: no extra state.

Definition at line 824 of file DSParkPlugin.h.

◆ getTailSeconds()

template<typename Derived >
double dspark::plugin::PluginBase< Derived >::getTailSeconds ( ) const
inlinenoexcept

How long sound continues after the input stops (reverb decay, delay feedback). Hosts keep processing you that long instead of cutting the tail. Maps to VST3 getTailSamples and the CLAP tail extension. Default: no tail.

Definition at line 815 of file DSParkPlugin.h.

◆ reset()

template<typename Derived >
void dspark::plugin::PluginBase< Derived >::reset ( )
inlinenoexcept

Clears processing history (delay lines, envelopes, reverb tails) on transport jumps. CLAP hosts call this directly; VST3 hosts re-activate (your prepare() runs again) instead. Default: nothing to clear.

Definition at line 797 of file DSParkPlugin.h.

◆ setOfflineRendering()

template<typename Derived >
void dspark::plugin::PluginBase< Derived >::setOfflineRendering ( bool  )
inlinenoexcept

Render-mode switch: hosts flip it to true for non-realtime bounces - the moment to raise oversampling or other quality/cost trade-offs. Called outside the audio thread, before processing (re)starts. Maps to the VST3 kOffline process mode, the CLAP render extension and the AU OfflineRender property. Default: render mode ignored (always the realtime path).

Definition at line 847 of file DSParkPlugin.h.

◆ setState()

template<typename Derived >
bool dspark::plugin::PluginBase< Derived >::setState ( const uint8_t *  ,
size_t   
)
inline

- restore side. Return false on a foreign blob.

Extra state BEYOND the parameters (learned profiles, loaded IRs, editor layout). The wrapper already saves/restores every parameter by its stable id on its own - most plugins never touch this pair. DSPark's StateBlob (Core/StateBlob.h) is the natural serializer. Default: no extra state. - restore side. Return false on a foreign blob.

Definition at line 827 of file DSParkPlugin.h.

◆ setTransport()

template<typename Derived >
void dspark::plugin::PluginBase< Derived >::setTransport ( const TransportInfo )
inlinenoexcept

Host transport snapshot, delivered on the audio thread before each processBlock whenever the host supplies timeline data. Read tempoBpm and ppqPosition (checking the *Valid flags) to sync delays, LFOs and gates to the song. Maps to the VST3 ProcessContext, the CLAP transport event and the AU host callbacks. Default: transport ignored.

Definition at line 837 of file DSParkPlugin.h.

Member Data Documentation

◆ hasEditor

template<typename Derived >
constexpr bool dspark::plugin::PluginBase< Derived >::hasEditor = false
staticconstexpr

Custom editor flag. While false, hosts show their generic parameter UI. Set it to true, implement static const char* editorHtml() and include plugin/webview/DSParkWebViewEditor.h before the format headers to get a WebView editor embedded in the host window (see docs/plugins.md).

Definition at line 855 of file DSParkPlugin.h.


The documentation for this struct was generated from the following file: