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);
105 mRawHostNameStr.Set(host);
107 mHostVersion = version;
111 Trace(TRACELOC,
"host_%sknown:%s:%s", (mHost == kHostUnknown ?
"un" :
""), host, vStr.Get());
119 Trace(TRACELOC,
"%d:%f", idx, normalizedValue);
120 GetParam(idx)->SetNormalized(normalizedValue);
121 InformHostOfParamChange(idx, normalizedValue);
122 OnParamChange(idx, kUI);
127 for (
int p = 0; p < NParams(); p++)
129 double normalizedValue = GetParam(p)->GetNormalized();
130 InformHostOfParamChange(p, normalizedValue);
137 value = GetParam(paramIdx)->FromNormalized(value);
139 mParamChangeFromProcessor.
PushFromArgs(paramIdx, value);
142void IPlugAPIBase::OnTimer(
Timer& t)
147#if defined VST3P_API || defined VST3_API
151 mMidiMsgsFromProcessor.
Pop(msg);
153 TransmitMidiMsgFromProcessor(msg);
155 SendMidiMsgFromDelegate(msg);
162 mSysExDataFromProcessor.
Pop(msg);
164 TransmitSysExDataFromProcessor(msg);
166 SendSysexMsgFromDelegate({msg.mOffset, msg.mData, msg.mSize});
174 mParamChangeFromProcessor.
Pop(p);
175 SendParameterValueFromDelegate(p.idx, p.value,
false);
181 mMidiMsgsFromProcessor.
Pop(msg);
182 SendMidiMsgFromDelegate(msg);
188 mSysExDataFromProcessor.
Pop(msg);
189 SendSysexMsgFromDelegate({msg.mOffset, msg.mData, msg.mSize});
197void IPlugAPIBase::SendMidiMsgFromUI(
const IMidiMsg& msg)
200 EDITOR_DELEGATE_CLASS::SendMidiMsgFromUI(msg);
203void IPlugAPIBase::SendSysexMsgFromUI(
const ISysEx& msg)
206 EDITOR_DELEGATE_CLASS::SendSysexMsgFromUI(msg);
209void IPlugAPIBase::SendArbitraryMsgFromUI(
int msgTag,
int ctrlTag,
int dataSize,
const void* pData)
211 OnMessage(msgTag, ctrlTag, dataSize, pData);
213 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
bool PushFromArgs(Args ...args)
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.