|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
#include <DSParkClap.h>

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 ¶ms) 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 } |
Definition at line 254 of file DSParkClap.h.
|
inlineexplicitnoexcept |
Definition at line 366 of file DSParkClap.h.
|
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.
|
inlinenoexcept |
Applies one factory preset (main thread).
Definition at line 671 of file DSParkClap.h.
|
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.
|
inlinenoexcept |
Definition at line 389 of file DSParkClap.h.
|
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.
|
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.
|
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.
|
inlinenoexcept |
Definition at line 940 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 2238 of file DSParkClap.h.
|
inlinenoexcept |
One per-voice event to the plugin, addressed to the exact voice (channel, key, noteId).
Definition at line 462 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 2214 of file DSParkClap.h.
|
inlinenoexcept |
Definition at line 423 of file DSParkClap.h.
|
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.
|
inlinestaticnoexcept |
Definition at line 1499 of file DSParkClap.h.
|
inlinenoexcept |
Reports this block's ended voices to the host as NOTE_END events.
Definition at line 635 of file DSParkClap.h.
|
inlinenoexcept |
Forwards the per-block clap transport as a TransportInfo.
Definition at line 999 of file DSParkClap.h.
|
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.
|
inlinestaticnoexcept |
Definition at line 398 of file DSParkClap.h.
|
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.
|
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.
|
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.
|
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.
|
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.
|
inlinestaticnoexcept |
Definition at line 1119 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1497 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1535 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1515 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1540 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1523 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1161 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1117 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 373 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1397 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1096 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1871 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1576 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1581 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1435 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1651 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1766 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1670 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1748 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1716 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1732 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1456 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1466 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1616 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1211 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1599 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1601 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1180 of file DSParkClap.h.
|
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.
|
inlinestaticnoexcept |
Definition at line 1818 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1794 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1178 of file DSParkClap.h.
|
inlinestaticnoexcept |
Definition at line 1879 of file DSParkClap.h.
|
inlinenoexcept |
Voice bookkeeping for a NoteOn / NoteOff the plugin just received.
Definition at line 541 of file DSParkClap.h.
|
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.
|
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.
| 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.
| BlockEventList dspark::plugin::clap_backend::Plugin< P >::blockEvents |
Definition at line 305 of file DSParkClap.h.
| std::atomic<bool> dspark::plugin::clap_backend::Plugin< P >::bypass { false } |
Definition at line 329 of file DSParkClap.h.
| float dspark::plugin::clap_backend::Plugin< P >::bypassMix = 0.0f |
Definition at line 331 of file DSParkClap.h.
| 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.
| int dspark::plugin::clap_backend::Plugin< P >::currentChannels = defaultChannelCount<P>() |
Definition at line 293 of file DSParkClap.h.
| std::atomic<int> dspark::plugin::clap_backend::Plugin< P >::currentProgram { 0 } |
Definition at line 330 of file DSParkClap.h.
| DryDelay dspark::plugin::clap_backend::Plugin< P >::dryDelay |
Definition at line 334 of file DSParkClap.h.
| std::vector<float> dspark::plugin::clap_backend::Plugin< P >::dryL |
Definition at line 332 of file DSParkClap.h.
| std::vector<float> dspark::plugin::clap_backend::Plugin< P >::dryR |
Definition at line 332 of file DSParkClap.h.
| 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.
| int dspark::plugin::clap_backend::Plugin< P >::endedCount = 0 |
Definition at line 324 of file DSParkClap.h.
| EndedVoice dspark::plugin::clap_backend::Plugin< P >::endedVoices[kMaxEndedVoices] {} |
Definition at line 323 of file DSParkClap.h.
| const clap_host_t* dspark::plugin::clap_backend::Plugin< P >::host = nullptr |
Definition at line 277 of file DSParkClap.h.
| const clap_host_latency_t* dspark::plugin::clap_backend::Plugin< P >::hostLatency = nullptr |
Definition at line 278 of file DSParkClap.h.
| const clap_host_params_t* dspark::plugin::clap_backend::Plugin< P >::hostParams = nullptr |
Definition at line 279 of file DSParkClap.h.
| const clap_host_preset_load_t* dspark::plugin::clap_backend::Plugin< P >::hostPresetLoad = nullptr |
Definition at line 280 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1493 of file DSParkClap.h.
|
staticconstexpr |
Definition at line 271 of file DSParkClap.h.
|
staticconstexpr |
Definition at line 257 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1877 of file DSParkClap.h.
|
staticconstexpr |
Definition at line 321 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1593 of file DSParkClap.h.
|
staticconstexpr |
Definition at line 256 of file DSParkClap.h.
|
staticconstexpr |
Definition at line 270 of file DSParkClap.h.
|
staticconstexpr |
Definition at line 259 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1787 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1531 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1570 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1645 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1610 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1867 of file DSParkClap.h.
|
inlinestatic |
Definition at line 1899 of file DSParkClap.h.
| int dspark::plugin::clap_backend::Plugin< P >::latencyAtActivate = 0 |
Definition at line 296 of file DSParkClap.h.
| std::atomic<bool> dspark::plugin::clap_backend::Plugin< P >::latencyDirty { false } |
Definition at line 295 of file DSParkClap.h.
| uint32_t dspark::plugin::clap_backend::Plugin< P >::maxFrames = 0 |
Definition at line 284 of file DSParkClap.h.
| 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.
| bool dspark::plugin::clap_backend::Plugin< P >::offlineRender = false |
Definition at line 294 of file DSParkClap.h.
| PendingParams<kNumParams> dspark::plugin::clap_backend::Plugin< P >::pending |
Definition at line 304 of file DSParkClap.h.
| clap_plugin_t dspark::plugin::clap_backend::Plugin< P >::plugin {} |
Definition at line 276 of file DSParkClap.h.
| bool dspark::plugin::clap_backend::Plugin< P >::prepared = false |
Definition at line 285 of file DSParkClap.h.
| double dspark::plugin::clap_backend::Plugin< P >::sampleRate = 48000.0 |
Definition at line 283 of file DSParkClap.h.
| std::atomic<double> dspark::plugin::clap_backend::Plugin< P >::shadow[kNumParams==0 ? 1 :kNumParams] {} |
Definition at line 326 of file DSParkClap.h.
| std::vector<float> dspark::plugin::clap_backend::Plugin< P >::silence |
Definition at line 333 of file DSParkClap.h.
| ActiveNotes dspark::plugin::clap_backend::Plugin< P >::sounding |
Definition at line 306 of file DSParkClap.h.
| P dspark::plugin::clap_backend::Plugin< P >::user {} |
Definition at line 282 of file DSParkClap.h.
| 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.