31 const clap_plugin_descriptor* mDesc;
32 const clap_host* mHost;
38using ClapPluginHelper = clap::helpers::Plugin<clap::helpers::MisbehaviourHandler::Terminate, clap::helpers::CheckingLevel::Maximal>;
39using ClapHost = clap::helpers::HostProxy<clap::helpers::MisbehaviourHandler::Terminate, clap::helpers::CheckingLevel::Maximal>;
41using ClapPluginHelper = clap::helpers::Plugin<clap::helpers::MisbehaviourHandler::Ignore, clap::helpers::CheckingLevel::None>;
42using ClapHost = clap::helpers::HostProxy<clap::helpers::MisbehaviourHandler::Ignore, clap::helpers::CheckingLevel::None>;
49 ,
public ClapPluginHelper
53 enum class Type { Begin, Value, End };
61 ParamToHost(Type type,
int idx,
double value)
67 uint32_t idx()
const {
return static_cast<uint32_t
>(mIdx); }
68 double value()
const {
return mValue; }
73 case Type::Begin:
return CLAP_EVENT_PARAM_GESTURE_BEGIN;
74 case Type::End:
return CLAP_EVENT_PARAM_GESTURE_END;
76 default:
return CLAP_EVENT_PARAM_VALUE;
86 IPlugCLAP(
const InstanceInfo& info,
const Config& config);
92 bool EditorResize(
int viewWidth,
int viewHeight)
override;
102 bool init()
noexcept override;
103 bool activate(
double sampleRate, uint32_t minFrameCount, uint32_t maxFrameCount)
noexcept override;
104 void deactivate()
noexcept override;
105 bool startProcessing()
noexcept override {
return true; }
106 void stopProcessing()
noexcept override {}
107 clap_process_status process(
const clap_process* pProcess)
noexcept override;
110 bool implementsLatency()
const noexcept override {
return true; }
111 uint32_t latencyGet()
const noexcept override {
return GetLatency(); }
114 bool implementsTail()
const noexcept override {
return true; }
115 uint32_t tailGet()
const noexcept override;
118 bool implementsRender()
const noexcept override {
return true; }
119 bool renderHasHardRealtimeRequirement()
noexcept override {
return false; }
120 bool renderSetMode(clap_plugin_render_mode mode)
noexcept override;
123 bool implementsState()
const noexcept override {
return true; }
124 bool stateSave(
const clap_ostream* pStream)
noexcept override;
125 bool stateLoad(
const clap_istream* pStream)
noexcept override;
128 bool implementsAudioPorts()
const noexcept override;
129 uint32_t audioPortsCount(
bool isInput)
const noexcept override;
130 bool audioPortsInfo(uint32_t index,
bool isInput, clap_audio_port_info* pInfo)
const noexcept override;
133 bool implementsAudioPortsConfig()
const noexcept override;
134 uint32_t audioPortsConfigCount()
const noexcept override;
135 bool audioPortsGetConfig(uint32_t index, clap_audio_ports_config* pConfig)
const noexcept override;
136 bool audioPortsSetConfig(clap_id configIdx)
noexcept override;
140 uint32_t notePortsCount(
bool isInput)
const noexcept override;
141 bool notePortsInfo(uint32_t index,
bool isInput, clap_note_port_info* pInfo)
const noexcept override;
144 bool implementsParams()
const noexcept override {
return true; }
145 uint32_t paramsCount()
const noexcept override {
return NParams(); }
147 bool paramsInfo(uint32_t paramIdx, clap_param_info* pInfo)
const noexcept override;
149 bool paramsValue(clap_id paramIdx,
double* pValue)
noexcept override;
150 bool paramsValueToText(clap_id paramIdx,
double value,
char* display, uint32_t size)
noexcept override;
151 bool paramsTextToValue(clap_id paramIdx,
const char* display,
double* pValue)
noexcept override;
153 void paramsFlush(
const clap_input_events* pInputParamChanges,
const clap_output_events* pOutputParamChanges)
noexcept override;
154 bool isValidParamId(clap_id paramIdx)
const noexcept override {
return paramIdx < NParams(); }
157 bool implementsGui()
const noexcept override;
158 bool guiCreate(
const char* api,
bool isFloating)
noexcept override;
159 void guiDestroy()
noexcept override;
161 bool guiSetScale(
double scale)
noexcept override;
162 bool guiShow()
noexcept override;
163 bool guiHide()
noexcept override;
164 bool guiGetSize(uint32_t* pWidth, uint32_t* pHeight)
noexcept override;
166 bool guiCanResize()
const noexcept override;
167 bool guiAdjustSize(uint32_t* pWidth, uint32_t* pHeight)
noexcept override;
168 bool guiSetSize(uint32_t width, uint32_t height)
noexcept override;
171 bool guiIsApiSupported(
const char* api,
bool isFloating)
noexcept override;
172 bool guiSetParent(
const clap_window* pWindow)
noexcept override;
175 bool GUIWindowAttach(
void* parent)
noexcept;
178 void ProcessInputEvents(
const clap_input_events* pInputEvents)
noexcept;
179 void ProcessOutputParams(
const clap_output_events* pOutputParamChanges)
noexcept;
180 void ProcessOutputEvents(
const clap_output_events* pOutputEvents,
int nFrames)
noexcept;
183 ClapHost& GetClapHost() {
return _host; }
186 void SetDefaultConfig();
187 int RequiredChannels()
const;
188 uint32_t NBuses(
ERoute direction)
const;
189 uint32_t NChannels(
ERoute direction, uint32_t bus)
const;
190 uint32_t NBuses(
ERoute direction,
int configIdx)
const;
191 uint32_t NChannels(
ERoute direction, uint32_t bus,
int configIdx)
const;
196 WDL_TypedBuf<float *> mAudioIO32;
197 WDL_TypedBuf<double *> mAudioIO64;
200 bool mHostHasTail =
false;
201 bool mTailUpdate =
false;
202 bool mLatencyUpdate =
false;
204 void* mWindow =
nullptr;
205 bool mGUIOpen =
false;
208IPlugCLAP* MakePlug(
const InstanceInfo& info);
A class to help with queuing timestamped MIDI messages.
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
CLAP API base class for an IPlug plug-in.
bool SendSysEx(const ISysEx &msg) override
Send a single MIDI System Exclusive (SysEx) message // TODO: info about what thread should this be ca...
void InformHostOfParamChange(int idx, double normalizedValue) override
Implemented by the API class, called by the UI via SetParameterValue() with the value of a parameter ...
void SetTailSize(int tailSize) override
Call this method if you need to update the tail size at runtime, for example if the decay time of you...
void SetLatency(int samples) override
Call this if the latency of your plug-in changes after initialization (perhaps from OnReset() ) This ...
bool EditorResize(int viewWidth, int viewHeight) override
Implementations call into the APIs resize hooks returns a bool to indicate whether the DAW or plugin ...
void BeginInformHostOfParamChange(int idx) override
Implemented by the API class, called by the UI (or by a delegate) at the beginning of a parameter cha...
bool SendMidiMsg(const IMidiMsg &msg) override
Send a single MIDI message // TODO: info about what thread should this be called on or not called on!
void EndInformHostOfParamChange(int idx) override
Implemented by the API class, called by the UI (or by a delegate) at the end of a parameter change ge...
The base class for IPlug Audio Processing.
A lock-free SPSC queue used to transfer data between threads based on MLQueue.h by Randy Jones based ...
ERoute
Used to identify whether a bus/channel connection is an input or an output.
Encapsulates a MIDI message and provides helper functions.
A struct for dealing with SysEx messages.