25IPlugAPIBase::IPlugAPIBase(Config c, EAPI plugAPI)
28 mUniqueID = c.uniqueID;
30 mVersion = c.vendorVersion;
31 mPluginName.Set(c.pluginName, MAX_PLUGIN_NAME_LEN);
32 mProductName.Set(c.productName, MAX_PLUGIN_NAME_LEN);
33 mMfrName.Set(c.mfrName, MAX_PLUGIN_NAME_LEN);
35 mHostResize = c.plugHostResize;
36 SetEditorSize(c.plugWidth, c.plugHeight);
37 SetSizeConstraints(c.plugMinWidth, c.plugMaxWidth, c.plugMinHeight, c.plugMaxHeight);
38 mStateChunks = c.plugDoesChunks;
40 mBundleID.Set(c.bundleID);
41 mAppGroupID.Set(c.appGroupID);
43 Trace(TRACELOC,
"%s:%s", c.pluginName, CurrentTime());
45 mParamDisplayStr.Set(
"", MAX_PARAM_DISPLAY_LEN);
48IPlugAPIBase::~IPlugAPIBase()
62 for (
int i = 0; i < count; i++)
69 mTimer = std::unique_ptr<Timer>(Timer::Create(std::bind(&IPlugAPIBase::OnTimer,
this, std::placeholders::_1), IDLE_TIMER_RATE));
76 const double* data = (
const double*) pIncomingState + startPos;
80 for (
int i = 0; i < NParams(); i++)
82 float v = (float) GetParam(i)->Value();
83 float vi = (float) *(data++);
85 isEqual &= (std::fabs(v - vi) < 0.00001);
91bool IPlugAPIBase::EditorResizeFromUI(
int viewWidth,
int viewHeight,
bool needsPlatformResize)
93 if (needsPlatformResize)
94 return EditorResize(viewWidth, viewHeight);
103 assert(mHost == kHostUninit);
106 mHostVersion = version;
110 Trace(TRACELOC,
"host_%sknown:%s:%s", (mHost == kHostUnknown ?
"un" :
""), host, vStr.Get());
118 Trace(TRACELOC,
"%d:%f", idx, normalizedValue);
119 GetParam(idx)->SetNormalized(normalizedValue);
120 InformHostOfParamChange(idx, normalizedValue);
121 OnParamChange(idx, kUI);
126 for (
int p = 0; p < NParams(); p++)
128 double normalizedValue = GetParam(p)->GetNormalized();
129 InformHostOfParamChange(p, normalizedValue);
136 value = GetParam(paramIdx)->FromNormalized(value);
141void IPlugAPIBase::OnTimer(
Timer& t)
146#if defined VST3P_API || defined VST3_API
150 mMidiMsgsFromProcessor.
Pop(msg);
152 TransmitMidiMsgFromProcessor(msg);
154 SendMidiMsgFromDelegate(msg);
161 mSysExDataFromProcessor.
Pop(msg);
163 TransmitSysExDataFromProcessor(msg);
165 SendSysexMsgFromDelegate({msg.mOffset, msg.mData, msg.mSize});
173 mParamChangeFromProcessor.
Pop(p);
174 SendParameterValueFromDelegate(p.idx, p.value,
false);
180 mMidiMsgsFromProcessor.
Pop(msg);
181 SendMidiMsgFromDelegate(msg);
187 mSysExDataFromProcessor.
Pop(msg);
188 SendSysexMsgFromDelegate({msg.mOffset, msg.mData, msg.mSize});
196void IPlugAPIBase::SendMidiMsgFromUI(
const IMidiMsg& msg)
199 EDITOR_DELEGATE_CLASS::SendMidiMsgFromUI(msg);
202void IPlugAPIBase::SendSysexMsgFromUI(
const ISysEx& msg)
205 EDITOR_DELEGATE_CLASS::SendSysexMsgFromUI(msg);
208void IPlugAPIBase::SendArbitraryMsgFromUI(
int msgTag,
int ctrlTag,
int dataSize,
const void* pData)
210 OnMessage(msgTag, ctrlTag, dataSize, pData);
212 EDITOR_DELEGATE_CLASS::SendArbitraryMsgFromUI(msgTag, ctrlTag, dataSize, pData);
void CreateTimer()
Called by the API class to create the timer that pumps the parameter/message queues.
virtual void OnIdle()
Override this method to get an "idle"" call on the main thread.
virtual bool CompareState(const uint8_t *pIncomingState, int startPos) const
Override this method to implement a custom comparison of incoming state data with your plug-ins state...
void SetParameterValue(int paramIdx, double normalizedValue)
SetParameterValue is called from the UI in the middle of a parameter change gesture (possibly via del...
virtual void SendParameterValueFromAPI(int paramIdx, double value, bool normalized)
This is called from the plug-in API class in order to update UI controls linked to plug-in parameters...
void SetHost(const char *host, int version)
Called to set the name of the current host, if known (calls on to HostSpecificInit() and OnHostIdenti...
virtual void DirtyParametersFromUI() override
In a distributed VST3 or WAM plugin, if you modify the parameters on the UI side (e....
virtual void HostSpecificInit()
This method is implemented in some API classes, in order to do specific initialisation for particular...
virtual void OnHostIdentified()
Implement this to do something specific when IPlug becomes aware of the particular host that is hosti...
virtual void OnHostRequestingImportantParameters(int count, WDL_TypedBuf< int > &results)
Called by AUv3 plug-ins to get the "overview parameters".
size_t ElementsAvailable() const
Base class that contains plug-in info and state manipulation methods.
static void GetVersionStr(int versionInteger, WDL_String &str)
Helper function to get the semantic version number as a string from an integer.
static EHost LookUpHost(const char *inHost)
Gets the host ID from a human-readable name.
Encapsulates a MIDI message and provides helper functions.
A struct for dealing with SysEx messages.
In certain cases we need to queue parameter changes for transferral between threads.
This structure is used when queueing Sysex messages.