DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::plugin::clap_backend::Plugin< P > Struct Template Reference

#include <DSParkClap.h>

Collaboration diagram for dspark::plugin::clap_backend::Plugin< P >:

Classes

struct  EndedVoice
 

Public Member Functions

 Plugin (const clap_host_t *h) noexcept
 
double heardPlain (int index, double normalized) const noexcept
 
void applyNormalized (int index, double normalized) noexcept
 
bool applyFromUi (int index, double normalized) noexcept
 
bool drainPending () noexcept
 
double voiceHeardPlain (int index, bool valued, double value, bool modulated, double amount) const noexcept
 
template<typename Params >
double voiceHeardPlain (int index, int slot, const Params &params) const noexcept
 
void deliverToVoice (MidiEvent midi, int channel, int key, int32_t noteId) noexcept
 
void resendVoiceModulation (int index, int sampleOffset, bool modulationMoved) noexcept
 
void endVoice (int slot) noexcept
 
void trackVoice (const MidiEvent &midi) noexcept
 
void applyVoiceEvent (const BlockEvent &ev, MidiEvent midi) noexcept
 
void pollVoices () noexcept
 
void flushEndedVoices (const clap_output_events_t *out, uint32_t time) noexcept
 
void requestParamFlush () noexcept
 
void applyFactoryPresetIdx (int idx) noexcept
 
void refreshLatency () noexcept
 
void collectEvent (const clap_event_header_t *ev, uint32_t numSamples, BlockEventList &events) noexcept
 
void collectEvents (const clap_input_events_t *in, uint32_t numSamples, BlockEventList &events) noexcept
 
bool applyBlockEvent (const BlockEvent &ev, int blockStart) noexcept
 
void forwardTransport (const clap_event_transport_t *t) noexcept
 
void blendBypass (float *const *out, float *const *dry, uint32_t nCh, int outStart, int dryStart, int length) noexcept
 

Static Public Member Functions

static Plugin * self (const clap_plugin_t *p) noexcept
 
static int indexOfParamId (uint32_t id) noexcept
 
static bool sInit (const clap_plugin_t *p) noexcept
 
static void sDestroy (const clap_plugin_t *p) noexcept
 
static bool sActivate (const clap_plugin_t *p, double sr, uint32_t, uint32_t maxFrames) noexcept
 
static void sDeactivate (const clap_plugin_t *p) noexcept
 
static bool sStartProcessing (const clap_plugin_t *p) noexcept
 
static void sStopProcessing (const clap_plugin_t *) noexcept
 
static void sReset (const clap_plugin_t *p) noexcept
 
static clap_process_status sProcess (const clap_plugin_t *p, const clap_process_t *process) noexcept
 
static const void * sGetExtension (const clap_plugin_t *, const char *id) noexcept
 
static void sOnMainThread (const clap_plugin_t *p) noexcept
 
static uint32_t sPortCount (const clap_plugin_t *, bool isInput) noexcept
 
static bool sPortGet (const clap_plugin_t *p, uint32_t index, bool isInput, clap_audio_port_info_t *info) noexcept
 
static uint32_t sConfigCount (const clap_plugin_t *) noexcept
 
static void fillConfig (clap_audio_ports_config_t *config, int width) noexcept
 
static bool sConfigGet (const clap_plugin_t *, uint32_t index, clap_audio_ports_config_t *config) noexcept
 
static bool sConfigSelect (const clap_plugin_t *p, clap_id configId) noexcept
 
static clap_id sConfigCurrent (const clap_plugin_t *p) noexcept
 
static bool sConfigInfoGet (const clap_plugin_t *p, clap_id configId, uint32_t portIndex, bool isInput, clap_audio_port_info_t *info) noexcept
 
static uint32_t sNotePortCount (const clap_plugin_t *, bool isInput) noexcept
 
static bool sNotePortGet (const clap_plugin_t *, uint32_t index, bool isInput, clap_note_port_info_t *info) noexcept
 
static bool sRenderHardRealtime (const clap_plugin_t *) noexcept
 
static bool sRenderSet (const clap_plugin_t *p, clap_plugin_render_mode mode) noexcept
 
static bool sPresetFromLocation (const clap_plugin_t *p, uint32_t locationKind, const char *location, const char *loadKey) noexcept
 
static uint32_t sParamCount (const clap_plugin_t *) noexcept
 
static constexpr bool isIntegerGrid (const Param &spec) noexcept
 
static bool sParamInfo (const clap_plugin_t *, uint32_t index, clap_param_info_t *info) noexcept
 
static bool sParamValue (const clap_plugin_t *p, clap_id id, double *out) noexcept
 
static bool sParamValueToText (const clap_plugin_t *, clap_id id, double value, char *out, uint32_t size) noexcept
 
static bool sParamTextToValue (const clap_plugin_t *, clap_id id, const char *text, double *out) noexcept
 
static void sParamFlush (const clap_plugin_t *p, const clap_input_events_t *in, const clap_output_events_t *out) noexcept
 
static bool sStateSave (const clap_plugin_t *p, const clap_ostream_t *stream) noexcept
 
static bool sStateLoad (const clap_plugin_t *p, const clap_istream_t *stream) noexcept
 
static uint32_t sLatencyGet (const clap_plugin_t *p) noexcept
 
static uint32_t sTailGet (const clap_plugin_t *p) noexcept
 
static const clap_plugin_descriptor_t * descriptor () noexcept
 
static const clap_plugin_t * create (const clap_host_t *host) noexcept
 

Public Attributes

clap_plugin_t plugin {}
 
const clap_host_t * host = nullptr
 
const clap_host_latency_t * hostLatency = nullptr
 
const clap_host_params_t * hostParams = nullptr
 
const clap_host_preset_load_t * hostPresetLoad = nullptr
 
P user {}
 
double sampleRate = 48000.0
 
uint32_t maxFrames = 0
 
bool prepared = false
 
std::atomic< int > cachedLatency { 0 }
 
int currentChannels = defaultChannelCount<P>()
 
bool offlineRender = false
 
std::atomic< bool > latencyDirty { false }
 
int latencyAtActivate = 0
 
std::atomic< bool > active { false }
 
PendingParams< kNumParams > pending
 
BlockEventList blockEvents
 
ActiveNotes sounding
 
VoiceTable< kNumPerVoice > voices
 The voices delivered so far, for per-voice events (audio thread).
 
EndedVoice endedVoices [kMaxEndedVoices] {}
 
int endedCount = 0
 
std::atomic< double > shadow [kNumParams==0 ? 1 :kNumParams] {}
 
double modulation [kNumParams==0 ? 1 :kNumParams] {}
 Host modulation amount per parameter, plain units (audio thread).
 
std::atomic< bool > bypass { false }
 
std::atomic< int > currentProgram { 0 }
 
float bypassMix = 0.0f
 
std::vector< float > dryL
 
std::vector< float > dryR
 
std::vector< float > silence
 
DryDelay dryDelay
 
EditorSizeMemory< P > editorMemory
 

Static Public Attributes

static constexpr size_t kNumParams = P::parameters.size()
 
static constexpr bool kIsInstrument
 
static constexpr int kNumPresets = factoryPresetCountOf<P>()
 
static constexpr size_t kNumPerVoice = perVoiceParamCount<P>()
 
static constexpr bool kHasPerVoice = kNumPerVoice > 0
 
static constexpr int kMaxEndedVoices
 
static const clap_plugin_audio_ports_t kAudioPorts = { &sPortCount, &sPortGet }
 
static const clap_plugin_audio_ports_config_t kPortsConfig
 
static const clap_plugin_audio_ports_config_info_t kPortsConfigInfo
 
static const clap_plugin_note_ports_t kNotePorts
 
static const clap_plugin_render_t kRender
 
static const clap_plugin_preset_load_t kPresetLoad
 
static const clap_plugin_params_t kParams
 
static const clap_plugin_state_t kState = { &sStateSave, &sStateLoad }
 
static const clap_plugin_latency_t kLatency = { &sLatencyGet }
 
static const clap_plugin_tail_t kTail = { &sTailGet }
 

Detailed Description

template<typename P>
struct dspark::plugin::clap_backend::Plugin< P >

Definition at line 254 of file DSParkClap.h.

Constructor & Destructor Documentation

◆ Plugin()

template<typename P >
dspark::plugin::clap_backend::Plugin< P >::Plugin ( const clap_host_t *  h)
inlineexplicitnoexcept

Definition at line 366 of file DSParkClap.h.

Member Function Documentation

◆ applyBlockEvent()

template<typename P >
bool dspark::plugin::clap_backend::Plugin< P >::applyBlockEvent ( const BlockEvent &  ev,
int  blockStart 
)
inlinenoexcept

Applies one event; blockStart rebases MIDI offsets onto the next processBlock call. Returns true when a user parameter changed.

Definition at line 951 of file DSParkClap.h.

◆ applyFactoryPresetIdx()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::applyFactoryPresetIdx ( int  idx)
inlinenoexcept

Applies one factory preset (main thread).

Definition at line 671 of file DSParkClap.h.

◆ applyFromUi()

template<typename P >
bool dspark::plugin::clap_backend::Plugin< P >::applyFromUi ( int  index,
double  normalized 
)
inlinenoexcept

A change made on the main thread (editor, state load, preset). While active only the shadow is written and the parameter is marked; the audio thread applies it at its next process() or flush(). The old code called setParameter here, concurrently with process(). Returns true when the change reached the DSP immediately.

Definition at line 410 of file DSParkClap.h.

◆ applyNormalized()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::applyNormalized ( int  index,
double  normalized 
)
inlinenoexcept

Definition at line 389 of file DSParkClap.h.

◆ applyVoiceEvent()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::applyVoiceEvent ( const BlockEvent &  ev,
MidiEvent  midi 
)
inlinenoexcept

Applies one per-voice event (NoteExpression, or NoteModulation from a per-voice modulation amount or a per-note value) to every voice its host address matches. An exact channel + key address the table does not hold (a voice started before activation) is still delivered once.

Definition at line 578 of file DSParkClap.h.

◆ blendBypass()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::blendBypass ( float *const *  out,
float *const *  dry,
uint32_t  nCh,
int  outStart,
int  dryStart,
int  length 
)
inlinenoexcept

Crossfades length output frames (from outStart) toward the dry copy (from dryStart) at the current bypass target.

Definition at line 1194 of file DSParkClap.h.

◆ collectEvent()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::collectEvent ( const clap_event_header_t *  ev,
uint32_t  numSamples,
BlockEventList &  events 
)
inlinenoexcept

Translates one CLAP event into the timestamped block stream. CLAP param events carry PLAIN values; raw MIDI covers what note events don't (pitch bend, CC, pressure).

Definition at line 708 of file DSParkClap.h.

◆ collectEvents()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::collectEvents ( const clap_input_events_t *  in,
uint32_t  numSamples,
BlockEventList &  events 
)
inlinenoexcept

Definition at line 940 of file DSParkClap.h.

◆ create()

template<typename P >
static const clap_plugin_t * dspark::plugin::clap_backend::Plugin< P >::create ( const clap_host_t *  host)
inlinestaticnoexcept

Definition at line 2238 of file DSParkClap.h.

◆ deliverToVoice()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::deliverToVoice ( MidiEvent  midi,
int  channel,
int  key,
int32_t  noteId 
)
inlinenoexcept

One per-voice event to the plugin, addressed to the exact voice (channel, key, noteId).

Definition at line 462 of file DSParkClap.h.

◆ descriptor()

template<typename P >
static const clap_plugin_descriptor_t * dspark::plugin::clap_backend::Plugin< P >::descriptor ( )
inlinestaticnoexcept

Definition at line 2214 of file DSParkClap.h.

◆ drainPending()

template<typename P >
bool dspark::plugin::clap_backend::Plugin< P >::drainPending ( )
inlinenoexcept

Definition at line 423 of file DSParkClap.h.

◆ endVoice()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::endVoice ( int  slot)
inlinenoexcept

Retires voice slot; with perVoice() parameters the host hears of it (NOTE_END) at the end of the block.

Definition at line 526 of file DSParkClap.h.

◆ fillConfig()

template<typename P >
static void dspark::plugin::clap_backend::Plugin< P >::fillConfig ( clap_audio_ports_config_t *  config,
int  width 
)
inlinestaticnoexcept

Definition at line 1499 of file DSParkClap.h.

◆ flushEndedVoices()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::flushEndedVoices ( const clap_output_events_t *  out,
uint32_t  time 
)
inlinenoexcept

Reports this block's ended voices to the host as NOTE_END events.

Definition at line 635 of file DSParkClap.h.

◆ forwardTransport()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::forwardTransport ( const clap_event_transport_t *  t)
inlinenoexcept

Forwards the per-block clap transport as a TransportInfo.

Definition at line 999 of file DSParkClap.h.

◆ heardPlain()

template<typename P >
double dspark::plugin::clap_backend::Plugin< P >::heardPlain ( int  index,
double  normalized 
) const
inlinenoexcept

The plain value the DSP hears for a parameter at normalized: the value plus the host's modulation amount, clamped to the range and snapped like any other value (CLAP: value heard = value + mod).

Definition at line 381 of file DSParkClap.h.

◆ indexOfParamId()

template<typename P >
static int dspark::plugin::clap_backend::Plugin< P >::indexOfParamId ( uint32_t  id)
inlinestaticnoexcept

Definition at line 398 of file DSParkClap.h.

◆ isIntegerGrid()

template<typename P >
static constexpr bool dspark::plugin::clap_backend::Plugin< P >::isIntegerGrid ( const Param &  spec)
inlinestaticconstexprnoexcept

True when every position of a discrete parameter is a whole number and neighbours are exactly one apart (what CLAP_PARAM_IS_STEPPED promises a host).

Definition at line 1659 of file DSParkClap.h.

◆ pollVoices()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::pollVoices ( )
inlinenoexcept

After a processed block: voices the plugin reports silent end (with perVoice() parameters and the voice query).

Definition at line 619 of file DSParkClap.h.

◆ refreshLatency()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::refreshLatency ( )
inlinenoexcept

Re-reads the plugin latency after parameter motion. The CLAP host must hear about it on the main thread, so a change only flags it and requests a callback; sOnMainThread then asks for a restart (see there) and activate() reports the new value.

Definition at line 690 of file DSParkClap.h.

◆ requestParamFlush()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::requestParamFlush ( )
inlinenoexcept

Asks the host for a process()/flush() so deferred values land even while the transport is stopped.

Definition at line 664 of file DSParkClap.h.

◆ resendVoiceModulation()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::resendVoiceModulation ( int  index,
int  sampleOffset,
bool  modulationMoved 
)
inlinenoexcept

A perVoice() parameter's global value moved (modulationMoved false) or its global modulation amount did (true): every voice whose heard value follows the one that moved, and that the plugin hears through NoteModulation, is told its new value. A voice with its own value ignores the global value; one with its own amount ignores the global amount.

Definition at line 486 of file DSParkClap.h.

◆ sActivate()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sActivate ( const clap_plugin_t *  p,
double  sr,
uint32_t  ,
uint32_t  maxFrames 
)
inlinestaticnoexcept

Definition at line 1119 of file DSParkClap.h.

◆ sConfigCount()

template<typename P >
static uint32_t dspark::plugin::clap_backend::Plugin< P >::sConfigCount ( const clap_plugin_t *  )
inlinestaticnoexcept

Definition at line 1497 of file DSParkClap.h.

◆ sConfigCurrent()

template<typename P >
static clap_id dspark::plugin::clap_backend::Plugin< P >::sConfigCurrent ( const clap_plugin_t *  p)
inlinestaticnoexcept

Definition at line 1535 of file DSParkClap.h.

◆ sConfigGet()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sConfigGet ( const clap_plugin_t *  ,
uint32_t  index,
clap_audio_ports_config_t *  config 
)
inlinestaticnoexcept

Definition at line 1515 of file DSParkClap.h.

◆ sConfigInfoGet()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sConfigInfoGet ( const clap_plugin_t *  p,
clap_id  configId,
uint32_t  portIndex,
bool  isInput,
clap_audio_port_info_t *  info 
)
inlinestaticnoexcept

Definition at line 1540 of file DSParkClap.h.

◆ sConfigSelect()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sConfigSelect ( const clap_plugin_t *  p,
clap_id  configId 
)
inlinestaticnoexcept

Definition at line 1523 of file DSParkClap.h.

◆ sDeactivate()

template<typename P >
static void dspark::plugin::clap_backend::Plugin< P >::sDeactivate ( const clap_plugin_t *  p)
inlinestaticnoexcept

Definition at line 1161 of file DSParkClap.h.

◆ sDestroy()

template<typename P >
static void dspark::plugin::clap_backend::Plugin< P >::sDestroy ( const clap_plugin_t *  p)
inlinestaticnoexcept

Definition at line 1117 of file DSParkClap.h.

◆ self()

template<typename P >
static Plugin * dspark::plugin::clap_backend::Plugin< P >::self ( const clap_plugin_t *  p)
inlinestaticnoexcept

Definition at line 373 of file DSParkClap.h.

◆ sGetExtension()

template<typename P >
static const void * dspark::plugin::clap_backend::Plugin< P >::sGetExtension ( const clap_plugin_t *  ,
const char *  id 
)
inlinestaticnoexcept

Definition at line 1397 of file DSParkClap.h.

◆ sInit()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sInit ( const clap_plugin_t *  p)
inlinestaticnoexcept

Definition at line 1096 of file DSParkClap.h.

◆ sLatencyGet()

template<typename P >
static uint32_t dspark::plugin::clap_backend::Plugin< P >::sLatencyGet ( const clap_plugin_t *  p)
inlinestaticnoexcept

Definition at line 1871 of file DSParkClap.h.

◆ sNotePortCount()

template<typename P >
static uint32_t dspark::plugin::clap_backend::Plugin< P >::sNotePortCount ( const clap_plugin_t *  ,
bool  isInput 
)
inlinestaticnoexcept

Definition at line 1576 of file DSParkClap.h.

◆ sNotePortGet()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sNotePortGet ( const clap_plugin_t *  ,
uint32_t  index,
bool  isInput,
clap_note_port_info_t *  info 
)
inlinestaticnoexcept

Definition at line 1581 of file DSParkClap.h.

◆ sOnMainThread()

template<typename P >
static void dspark::plugin::clap_backend::Plugin< P >::sOnMainThread ( const clap_plugin_t *  p)
inlinestaticnoexcept

Definition at line 1435 of file DSParkClap.h.

◆ sParamCount()

template<typename P >
static uint32_t dspark::plugin::clap_backend::Plugin< P >::sParamCount ( const clap_plugin_t *  )
inlinestaticnoexcept

Definition at line 1651 of file DSParkClap.h.

◆ sParamFlush()

template<typename P >
static void dspark::plugin::clap_backend::Plugin< P >::sParamFlush ( const clap_plugin_t *  p,
const clap_input_events_t *  in,
const clap_output_events_t *  out 
)
inlinestaticnoexcept

Definition at line 1766 of file DSParkClap.h.

◆ sParamInfo()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sParamInfo ( const clap_plugin_t *  ,
uint32_t  index,
clap_param_info_t *  info 
)
inlinestaticnoexcept

Definition at line 1670 of file DSParkClap.h.

◆ sParamTextToValue()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sParamTextToValue ( const clap_plugin_t *  ,
clap_id  id,
const char *  text,
double *  out 
)
inlinestaticnoexcept

Definition at line 1748 of file DSParkClap.h.

◆ sParamValue()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sParamValue ( const clap_plugin_t *  p,
clap_id  id,
double *  out 
)
inlinestaticnoexcept

Definition at line 1716 of file DSParkClap.h.

◆ sParamValueToText()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sParamValueToText ( const clap_plugin_t *  ,
clap_id  id,
double  value,
char *  out,
uint32_t  size 
)
inlinestaticnoexcept

Definition at line 1732 of file DSParkClap.h.

◆ sPortCount()

template<typename P >
static uint32_t dspark::plugin::clap_backend::Plugin< P >::sPortCount ( const clap_plugin_t *  ,
bool  isInput 
)
inlinestaticnoexcept

Definition at line 1456 of file DSParkClap.h.

◆ sPortGet()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sPortGet ( const clap_plugin_t *  p,
uint32_t  index,
bool  isInput,
clap_audio_port_info_t *  info 
)
inlinestaticnoexcept

Definition at line 1466 of file DSParkClap.h.

◆ sPresetFromLocation()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sPresetFromLocation ( const clap_plugin_t *  p,
uint32_t  locationKind,
const char *  location,
const char *  loadKey 
)
inlinestaticnoexcept

Definition at line 1616 of file DSParkClap.h.

◆ sProcess()

template<typename P >
static clap_process_status dspark::plugin::clap_backend::Plugin< P >::sProcess ( const clap_plugin_t *  p,
const clap_process_t *  process 
)
inlinestaticnoexcept

Definition at line 1211 of file DSParkClap.h.

◆ sRenderHardRealtime()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sRenderHardRealtime ( const clap_plugin_t *  )
inlinestaticnoexcept

Definition at line 1599 of file DSParkClap.h.

◆ sRenderSet()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sRenderSet ( const clap_plugin_t *  p,
clap_plugin_render_mode  mode 
)
inlinestaticnoexcept

Definition at line 1601 of file DSParkClap.h.

◆ sReset()

template<typename P >
static void dspark::plugin::clap_backend::Plugin< P >::sReset ( const clap_plugin_t *  p)
inlinestaticnoexcept

Definition at line 1180 of file DSParkClap.h.

◆ sStartProcessing()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sStartProcessing ( const clap_plugin_t *  p)
inlinestaticnoexcept

as after reset(). The old no-op kept whatever a stopped processing run left in delay lines and tails.

Definition at line 1173 of file DSParkClap.h.

◆ sStateLoad()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sStateLoad ( const clap_plugin_t *  p,
const clap_istream_t *  stream 
)
inlinestaticnoexcept

Definition at line 1818 of file DSParkClap.h.

◆ sStateSave()

template<typename P >
static bool dspark::plugin::clap_backend::Plugin< P >::sStateSave ( const clap_plugin_t *  p,
const clap_ostream_t *  stream 
)
inlinestaticnoexcept

Definition at line 1794 of file DSParkClap.h.

◆ sStopProcessing()

template<typename P >
static void dspark::plugin::clap_backend::Plugin< P >::sStopProcessing ( const clap_plugin_t *  )
inlinestaticnoexcept

Definition at line 1178 of file DSParkClap.h.

◆ sTailGet()

template<typename P >
static uint32_t dspark::plugin::clap_backend::Plugin< P >::sTailGet ( const clap_plugin_t *  p)
inlinestaticnoexcept

Definition at line 1879 of file DSParkClap.h.

◆ trackVoice()

template<typename P >
void dspark::plugin::clap_backend::Plugin< P >::trackVoice ( const MidiEvent &  midi)
inlinenoexcept

Voice bookkeeping for a NoteOn / NoteOff the plugin just received.

Definition at line 541 of file DSParkClap.h.

◆ voiceHeardPlain() [1/2]

template<typename P >
double dspark::plugin::clap_backend::Plugin< P >::voiceHeardPlain ( int  index,
bool  valued,
double  value,
bool  modulated,
double  amount 
) const
inlinenoexcept

The plain value one voice hears for perVoice() parameter index, as CLAP defines it: the voice's own value when the host automates the parameter per note (else the parameter's value), plus the voice's own modulation amount, which already includes the global signal (else the global amount) - clamped and snapped like any value.

Definition at line 439 of file DSParkClap.h.

◆ voiceHeardPlain() [2/2]

template<typename P >
template<typename Params >
double dspark::plugin::clap_backend::Plugin< P >::voiceHeardPlain ( int  index,
int  slot,
const Params &  params 
) const
inlinenoexcept

What a voice with the per-voice state params hears for perVoice() parameter index (its per-voice slot slot).

Definition at line 453 of file DSParkClap.h.

Member Data Documentation

◆ active

template<typename P >
std::atomic<bool> dspark::plugin::clap_backend::Plugin< P >::active { false }

True between activate() and deactivate(): process()/flush() may then run on the audio thread at any moment, so main-thread edits (editor, state, presets) go through pending and the audio thread calls the user's setParameter - DSPark setters such as Equalizer::setBand allow exactly one writer.

Definition at line 303 of file DSParkClap.h.

◆ blockEvents

template<typename P >
BlockEventList dspark::plugin::clap_backend::Plugin< P >::blockEvents

Definition at line 305 of file DSParkClap.h.

◆ bypass

template<typename P >
std::atomic<bool> dspark::plugin::clap_backend::Plugin< P >::bypass { false }

Definition at line 329 of file DSParkClap.h.

◆ bypassMix

template<typename P >
float dspark::plugin::clap_backend::Plugin< P >::bypassMix = 0.0f

Definition at line 331 of file DSParkClap.h.

◆ cachedLatency

template<typename P >
std::atomic<int> dspark::plugin::clap_backend::Plugin< P >::cachedLatency { 0 }

Latency in samples, as last reported to the host. The processing call re-reads it after parameter motion while the host fetches it from its own thread, so it is a published word rather than a plain int. It stands alone – nothing else is ordered against it, and the host is told to re-fetch through the notification path below – so the plain store/load idiom for a single independent value is the whole contract.

Definition at line 292 of file DSParkClap.h.

◆ currentChannels

template<typename P >
int dspark::plugin::clap_backend::Plugin< P >::currentChannels = defaultChannelCount<P>()

Definition at line 293 of file DSParkClap.h.

◆ currentProgram

template<typename P >
std::atomic<int> dspark::plugin::clap_backend::Plugin< P >::currentProgram { 0 }

Definition at line 330 of file DSParkClap.h.

◆ dryDelay

template<typename P >
DryDelay dspark::plugin::clap_backend::Plugin< P >::dryDelay

Definition at line 334 of file DSParkClap.h.

◆ dryL

template<typename P >
std::vector<float> dspark::plugin::clap_backend::Plugin< P >::dryL

Definition at line 332 of file DSParkClap.h.

◆ dryR

template<typename P >
std::vector<float> dspark::plugin::clap_backend::Plugin< P >::dryR

Definition at line 332 of file DSParkClap.h.

◆ editorMemory

template<typename P >
EditorSizeMemory<P> dspark::plugin::clap_backend::Plugin< P >::editorMemory

The editor size the user left (also without the editor layer, so a session saved where the editor ran keeps its size here).

Definition at line 337 of file DSParkClap.h.

◆ endedCount

template<typename P >
int dspark::plugin::clap_backend::Plugin< P >::endedCount = 0

Definition at line 324 of file DSParkClap.h.

◆ endedVoices

template<typename P >
EndedVoice dspark::plugin::clap_backend::Plugin< P >::endedVoices[kMaxEndedVoices] {}

Definition at line 323 of file DSParkClap.h.

◆ host

template<typename P >
const clap_host_t* dspark::plugin::clap_backend::Plugin< P >::host = nullptr

Definition at line 277 of file DSParkClap.h.

◆ hostLatency

template<typename P >
const clap_host_latency_t* dspark::plugin::clap_backend::Plugin< P >::hostLatency = nullptr

Definition at line 278 of file DSParkClap.h.

◆ hostParams

template<typename P >
const clap_host_params_t* dspark::plugin::clap_backend::Plugin< P >::hostParams = nullptr

Definition at line 279 of file DSParkClap.h.

◆ hostPresetLoad

template<typename P >
const clap_host_preset_load_t* dspark::plugin::clap_backend::Plugin< P >::hostPresetLoad = nullptr

Definition at line 280 of file DSParkClap.h.

◆ kAudioPorts

template<typename P >
const clap_plugin_audio_ports_t dspark::plugin::clap_backend::Plugin< P >::kAudioPorts = { &sPortCount, &sPortGet }
inlinestatic

Definition at line 1493 of file DSParkClap.h.

◆ kHasPerVoice

template<typename P >
constexpr bool dspark::plugin::clap_backend::Plugin< P >::kHasPerVoice = kNumPerVoice > 0
staticconstexpr

Definition at line 271 of file DSParkClap.h.

◆ kIsInstrument

template<typename P >
constexpr bool dspark::plugin::clap_backend::Plugin< P >::kIsInstrument
staticconstexpr
Initial value:
=
P::descriptor.category == Category::Instrument
@ Instrument
Audio generator (MIDI in -> audio out, no audio input).

Definition at line 257 of file DSParkClap.h.

◆ kLatency

template<typename P >
const clap_plugin_latency_t dspark::plugin::clap_backend::Plugin< P >::kLatency = { &sLatencyGet }
inlinestatic

Definition at line 1877 of file DSParkClap.h.

◆ kMaxEndedVoices

template<typename P >
constexpr int dspark::plugin::clap_backend::Plugin< P >::kMaxEndedVoices
staticconstexpr
Initial value:
=
VoiceTable<kNumPerVoice>::kCapacity + kMaxBlockEvents
constexpr int kMaxBlockEvents
Capacity of the per-block event list. Past it the list merges rather than drops: an intermediate para...

Definition at line 321 of file DSParkClap.h.

◆ kNotePorts

template<typename P >
const clap_plugin_note_ports_t dspark::plugin::clap_backend::Plugin< P >::kNotePorts
inlinestatic
Initial value:
= {
}
static uint32_t sNotePortCount(const clap_plugin_t *, bool isInput) noexcept
static bool sNotePortGet(const clap_plugin_t *, uint32_t index, bool isInput, clap_note_port_info_t *info) noexcept

Definition at line 1593 of file DSParkClap.h.

◆ kNumParams

template<typename P >
constexpr size_t dspark::plugin::clap_backend::Plugin< P >::kNumParams = P::parameters.size()
staticconstexpr

Definition at line 256 of file DSParkClap.h.

◆ kNumPerVoice

template<typename P >
constexpr size_t dspark::plugin::clap_backend::Plugin< P >::kNumPerVoice = perVoiceParamCount<P>()
staticconstexpr

Definition at line 270 of file DSParkClap.h.

◆ kNumPresets

template<typename P >
constexpr int dspark::plugin::clap_backend::Plugin< P >::kNumPresets = factoryPresetCountOf<P>()
staticconstexpr

Definition at line 259 of file DSParkClap.h.

◆ kParams

template<typename P >
const clap_plugin_params_t dspark::plugin::clap_backend::Plugin< P >::kParams
inlinestatic
Initial value:
= {
}
static uint32_t sParamCount(const clap_plugin_t *) noexcept
static bool sParamValue(const clap_plugin_t *p, clap_id id, double *out) noexcept
static bool sParamTextToValue(const clap_plugin_t *, clap_id id, const char *text, double *out) noexcept
static void sParamFlush(const clap_plugin_t *p, const clap_input_events_t *in, const clap_output_events_t *out) noexcept
static bool sParamInfo(const clap_plugin_t *, uint32_t index, clap_param_info_t *info) noexcept
static bool sParamValueToText(const clap_plugin_t *, clap_id id, double value, char *out, uint32_t size) noexcept

Definition at line 1787 of file DSParkClap.h.

◆ kPortsConfig

template<typename P >
const clap_plugin_audio_ports_config_t dspark::plugin::clap_backend::Plugin< P >::kPortsConfig
inlinestatic
Initial value:
= {
}
static uint32_t sConfigCount(const clap_plugin_t *) noexcept
static bool sConfigSelect(const clap_plugin_t *p, clap_id configId) noexcept
static bool sConfigGet(const clap_plugin_t *, uint32_t index, clap_audio_ports_config_t *config) noexcept

Definition at line 1531 of file DSParkClap.h.

◆ kPortsConfigInfo

template<typename P >
const clap_plugin_audio_ports_config_info_t dspark::plugin::clap_backend::Plugin< P >::kPortsConfigInfo
inlinestatic
Initial value:
= {
}
static bool sConfigInfoGet(const clap_plugin_t *p, clap_id configId, uint32_t portIndex, bool isInput, clap_audio_port_info_t *info) noexcept
static clap_id sConfigCurrent(const clap_plugin_t *p) noexcept

Definition at line 1570 of file DSParkClap.h.

◆ kPresetLoad

template<typename P >
const clap_plugin_preset_load_t dspark::plugin::clap_backend::Plugin< P >::kPresetLoad
inlinestatic
Initial value:
= {
}
static bool sPresetFromLocation(const clap_plugin_t *p, uint32_t locationKind, const char *location, const char *loadKey) noexcept

Definition at line 1645 of file DSParkClap.h.

◆ kRender

template<typename P >
const clap_plugin_render_t dspark::plugin::clap_backend::Plugin< P >::kRender
inlinestatic
Initial value:
= {
}
static bool sRenderSet(const clap_plugin_t *p, clap_plugin_render_mode mode) noexcept
static bool sRenderHardRealtime(const clap_plugin_t *) noexcept

Definition at line 1610 of file DSParkClap.h.

◆ kState

template<typename P >
const clap_plugin_state_t dspark::plugin::clap_backend::Plugin< P >::kState = { &sStateSave, &sStateLoad }
inlinestatic

Definition at line 1867 of file DSParkClap.h.

◆ kTail

template<typename P >
const clap_plugin_tail_t dspark::plugin::clap_backend::Plugin< P >::kTail = { &sTailGet }
inlinestatic

Definition at line 1899 of file DSParkClap.h.

◆ latencyAtActivate

template<typename P >
int dspark::plugin::clap_backend::Plugin< P >::latencyAtActivate = 0

Definition at line 296 of file DSParkClap.h.

◆ latencyDirty

template<typename P >
std::atomic<bool> dspark::plugin::clap_backend::Plugin< P >::latencyDirty { false }

Definition at line 295 of file DSParkClap.h.

◆ maxFrames

template<typename P >
uint32_t dspark::plugin::clap_backend::Plugin< P >::maxFrames = 0

Definition at line 284 of file DSParkClap.h.

◆ modulation

template<typename P >
double dspark::plugin::clap_backend::Plugin< P >::modulation[kNumParams==0 ? 1 :kNumParams] {}

Host modulation amount per parameter, plain units (audio thread).

Definition at line 328 of file DSParkClap.h.

◆ offlineRender

template<typename P >
bool dspark::plugin::clap_backend::Plugin< P >::offlineRender = false

Definition at line 294 of file DSParkClap.h.

◆ pending

template<typename P >
PendingParams<kNumParams> dspark::plugin::clap_backend::Plugin< P >::pending

Definition at line 304 of file DSParkClap.h.

◆ plugin

template<typename P >
clap_plugin_t dspark::plugin::clap_backend::Plugin< P >::plugin {}

Definition at line 276 of file DSParkClap.h.

◆ prepared

template<typename P >
bool dspark::plugin::clap_backend::Plugin< P >::prepared = false

Definition at line 285 of file DSParkClap.h.

◆ sampleRate

template<typename P >
double dspark::plugin::clap_backend::Plugin< P >::sampleRate = 48000.0

Definition at line 283 of file DSParkClap.h.

◆ shadow

template<typename P >
std::atomic<double> dspark::plugin::clap_backend::Plugin< P >::shadow[kNumParams==0 ? 1 :kNumParams] {}

Definition at line 326 of file DSParkClap.h.

◆ silence

template<typename P >
std::vector<float> dspark::plugin::clap_backend::Plugin< P >::silence

Definition at line 333 of file DSParkClap.h.

◆ sounding

template<typename P >
ActiveNotes dspark::plugin::clap_backend::Plugin< P >::sounding

Definition at line 306 of file DSParkClap.h.

◆ user

template<typename P >
P dspark::plugin::clap_backend::Plugin< P >::user {}

Definition at line 282 of file DSParkClap.h.

◆ voices

template<typename P >
VoiceTable<kNumPerVoice> dspark::plugin::clap_backend::Plugin< P >::voices

The voices delivered so far, for per-voice events (audio thread).

Definition at line 309 of file DSParkClap.h.


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