iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
IPlugAPIBase Class Reference

The base class of an IPlug plug-in, which interacts with the different plug-in APIs. More...

#include <IPlugAPIBase.h>

Inheritance diagram for IPlugAPIBase:
[legend]

Public Member Functions

 IPlugAPIBase (Config config, EAPI plugAPI)
 
 IPlugAPIBase (const IPlugAPIBase &)=delete
 
IPlugAPIBaseoperator= (const IPlugAPIBase &)=delete
 
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 data, in order to support the ProTools compare light when using custom state chunks. More...
 
virtual bool OnHostRequestingAboutBox ()
 
virtual bool OnHostRequestingProductHelp ()
 
virtual void OnHostIdentified ()
 Implement this to do something specific when IPlug becomes aware of the particular host that is hosting the plug-in. More...
 
virtual void OnHostRequestingImportantParameters (int count, WDL_TypedBuf< int > &results)
 Called by AUv3 plug-ins to get the "overview parameters". More...
 
virtual bool OnHostRequestingSupportedViewConfiguration (int width, int height)
 Called by AUv3 plug-in hosts to query support for multiple UI sizes. More...
 
virtual void OnHostSelectedViewConfiguration (int width, int height)
 Called by some AUv3 plug-in hosts when a particular UI size is selected. More...
 
virtual bool GetMidiNoteText (int noteNumber, char *str) const
 Override this method to provide custom text linked to MIDI note numbers in API classes that support that (VST2) Typically this might be used for a drum machine plug-in, in order to label a certainty "kick drum" etc. More...
 
virtual void * GetAAXViewInterface ()
 You need to implement this method if you are not using IGraphics and you want to support AAX's view interface functionality (special shortcuts to add automation for a parameter etc.) More...
 
virtual void OnIdle ()
 Override this method to get an "idle"" call on the main thread. More...
 
void SetParameterValue (int paramIdx, double normalizedValue)
 SetParameterValue is called from the UI in the middle of a parameter change gesture (possibly via delegate) in order to update a parameter's value. More...
 
virtual void GetTrackColor (int &r, int &g, int &b)
 Get the color of the track that the plug-in is inserted on. More...
 
virtual void GetTrackName (WDL_String &str)
 Get the name of the track that the plug-in is inserted on. More...
 
virtual int GetTrackIndex ()
 Get the index of the track that the plug-in is inserted on. More...
 
virtual void GetTrackNamespace (WDL_String &str)
 Get the namespace of the track that the plug-in is inserted on. More...
 
virtual int GetTrackNamespaceIndex ()
 Get the namespace index of the track that the plug-in is inserted on. More...
 
virtual void DirtyParametersFromUI () override
 In a distributed VST3 or WAM plugin, if you modify the parameters on the UI side (e.g. More...
 
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, prior to calling OnParamChange() NOTE: It may be called on the high priority audio thread. More...
 
void SetHost (const char *host, int version)
 Called to set the name of the current host, if known (calls on to HostSpecificInit() and OnHostIdentified()). More...
 
virtual void HostSpecificInit ()
 This method is implemented in some API classes, in order to do specific initialisation for particular problematic hosts. More...
 
void BeginInformHostOfParamChangeFromUI (int paramIdx) override
 
void EndInformHostOfParamChangeFromUI (int paramIdx) override
 
bool EditorResizeFromUI (int viewWidth, int viewHeight, bool needsPlatformResize) override
 
void SendParameterValueFromUI (int paramIdx, double normalisedValue) override
 
void SendMidiMsgFromUI (const IMidiMsg &msg) override
 
void SendSysexMsgFromUI (const ISysEx &msg) override
 
void SendArbitraryMsgFromUI (int msgTag, int ctrlTag=kNoTag, int dataSize=0, const void *pData=nullptr) override
 
void DeferMidiMsg (const IMidiMsg &msg) override
 
void DeferSysexMsg (const ISysEx &msg) override
 
void CreateTimer ()
 Called by the API class to create the timer that pumps the parameter/message queues. More...
 
- Public Member Functions inherited from IPluginBase
 IPluginBase (int nParams, int nPresets)
 
 IPluginBase (const IPluginBase &)=delete
 
IPluginBaseoperator= (const IPluginBase &)=delete
 
const char * GetPluginName () const
 
int GetPluginVersion (bool decimal) const
 Get the plug-in version number. More...
 
void GetPluginVersionStr (WDL_String &str) const
 Gets the plug-in version as a string. More...
 
const char * GetMfrName () const
 Get the manufacturer name as a CString. More...
 
const char * GetProductName () const
 Get the product name as a CString. More...
 
int GetUniqueID () const
 
int GetMfrID () const
 
EHost GetHost () const
 
void GetHostStr (WDL_String &str) const
 Get the host name as a CString. More...
 
int GetHostVersion (bool decimal) const
 Get the host version number as an integer. More...
 
void GetHostVersionStr (WDL_String &str) const
 Get the host version number as a string. More...
 
EAPI GetAPI () const
 
const char * GetAPIStr () const
 
const char * GetArchStr () const
 
void GetBuildInfoStr (WDL_String &str, const char *date, const char *time) const
 Get the build date of the plug-in and architecture/api details in one string. More...
 
bool HasUI () const
 
bool GetHostResizeEnabled () const
 
const char * GetBundleID () const
 
const char * GetAppGroupID () const
 
int NParamGroups () const
 
int AddParamGroup (const char *name)
 Called to add a parameter group name, when a unique group name is discovered. More...
 
const char * GetParamGroupName (int idx) const
 Get the parameter group name as a particular index. More...
 
virtual void InformHostOfParameterDetailsChange ()
 Implemented by the API class, call this if you update parameter labels and hopefully the host should update it's displays (not applicable to all APIs) More...
 
bool DoesStateChunks () const
 
bool SerializeParams (IByteChunk &chunk) const
 Serializes the current double precision floating point, non-normalised values (IParam::mValue) of all parameters, into a binary byte chunk. More...
 
int UnserializeParams (const IByteChunk &chunk, int startPos)
 Unserializes double precision floating point, non-normalised values from a byte chunk into mParams. More...
 
virtual bool SerializeState (IByteChunk &chunk) const
 Override this method to serialize custom state data, if your plugin does state chunks. More...
 
virtual int UnserializeState (const IByteChunk &chunk, int startPos)
 Override this method to unserialize custom state data, if your plugin does state chunks. More...
 
virtual bool SerializeVST3CtrlrState (IByteChunk &chunk) const
 VST3 ONLY! - THIS IS ONLY INCLUDED FOR COMPATIBILITY - NOONE ELSE SHOULD NEED IT! More...
 
virtual int UnserializeVST3CtrlrState (const IByteChunk &chunk, int startPos)
 VST3 ONLY! - THIS IS ONLY INCLUDED FOR COMPATIBILITY - NOONE ELSE SHOULD NEED IT! More...
 
int GetCurrentPresetIdx () const
 Get the index of the current, active preset. More...
 
void SetCurrentPresetIdx (int idx)
 Set the index of the current, active preset. More...
 
virtual void InformHostOfPresetChange ()
 Implemented by the API class, called by the UI (etc) when the plug-in initiates a program/preset change (not applicable to all APIs) More...
 
IPresetGetPreset (int idx)
 Get a ptr to a factory preset @ param idx The index number of the preset you are referring to. More...
 
void ModifyCurrentPreset (const char *name=0)
 This method should update the current preset with current values NOTE: This is only relevant for VST2 plug-ins, which is the only format to have the notion of banks? More...
 
int NPresets () const
 Gets the number of factory presets. More...
 
bool RestorePreset (int idx)
 Restore a preset by index. More...
 
bool RestorePreset (const char *name)
 Restore a preset by name. More...
 
const char * GetPresetName (int idx) const
 Get the name a preset. More...
 
void CopyPreset (IPreset *pSrc, int destIdx, bool copyname=false)
 Copy source preset to preset at index. More...
 
void MakeDefaultPreset (const char *name=0, int nPresets=1)
 This method can be used to initialize baked-in factory presets with the default parameter values. More...
 
void MakePreset (const char *name,...)
 Create a baked-in factory preset, specifiying parameter values sequentially usage: MakePreset(name, param1, param2, ..., paramN) See DumpMakePresetSrc() which is a utility that can be used to create the code for MakePreset() calls. More...
 
void MakePresetFromNamedParams (const char *name, int nParamsNamed,...)
 Create a baked-in factory preset, specifiying parameter values with a list of parameter index and value pairs usage: MakePresetFromNamedParams(name, nParamsNamed, paramEnum1, paramVal1, paramEnum2, paramVal2, ..., paramEnumN, paramVal2) See DumpMakePresetFromNamedParamsSrc() which is a utility that can be used to create the code for MakePreset() calls nParamsNamed may be less than the total number of params. More...
 
void MakePresetFromChunk (const char *name, IByteChunk &chunk)
 Creates a preset from an IByteChunk containging serialized data. More...
 
void MakePresetFromBlob (const char *name, const char *blob, int sizeOfChunk)
 Creates a preset from a base64 encoded CString. More...
 
void PruneUninitializedPresets ()
 [AUV2 only] Removes any presets that weren't initialized More...
 
virtual void OnPresetsModified ()
 [VST2 only] Called when the preset name is changed by the host More...
 
void EnsureDefaultPreset ()
 [VST2 only] Called to fill uninitialzed presets More...
 
bool SerializePresets (IByteChunk &chunk) const
 [VST2 only] Called when the VST2 host calls effGetChunk for a bank *
More...
 
int UnserializePresets (const IByteChunk &chunk, int startPos)
 [VST2 only] Called when the VST2 host calls effSetChunk for a bank *
More...
 
void DumpMakePresetSrc (const char *file) const
 Writes a call to MakePreset() for the current preset to a new text file. More...
 
void DumpMakePresetFromNamedParamsSrc (const char *file, const char *paramEnumNames[]) const
 Writes a call to MakePresetFromNamedParams() for the current preset to a new text file. More...
 
void DumpPresetBlob (const char *file) const
 Writes a call to MakePresetFromBlob() for the current preset to a new text file. More...
 
bool SavePresetAsFXP (const char *file) const
 Save current state as a VST2 format preset. More...
 
bool SaveBankAsFXB (const char *file) const
 Save current bank as a VST2 format bank [VST2 only]. More...
 
bool LoadPresetFromFXP (const char *file)
 Load VST2 format preset. More...
 
bool LoadBankFromFXB (const char *file)
 Load VST2 format bank [VST2 only]. More...
 
void InitParamRange (int startIdx, int endIdx, int countStart, const char *nameFmtStr, double defaultVal, double minVal, double maxVal, double step, const char *label="", int flags=0, const char *group="", const IParam::Shape &shape=IParam::ShapeLinear(), IParam::EParamUnit unit=IParam::kUnitCustom, IParam::DisplayFunc displayFunc=nullptr)
 Initialise a range of parameters simultaneously. More...
 
void CloneParamRange (int cloneStartIdx, int cloneEndIdx, int startIdx, const char *searchStr="", const char *replaceStr="", const char *newGroup="")
 Clone a range of parameters, optionally doing a string substitution on the parameter name. More...
 
void ForParamInRange (int startIdx, int endIdx, std::function< void(int paramIdx, IParam &param)> func)
 Modify a range of parameters with a lamda function. More...
 
void ForParamInGroup (const char *paramGroup, std::function< void(int paramIdx, IParam &param)> func)
 Modify a parameter group simulataneously. More...
 
void CopyParamValues (int startIdx, int destIdx, int nParams)
 Copy a range of parameter values. More...
 
void CopyParamValues (const char *inGroup, const char *outGroup)
 Copy a range of parameter values for a parameter group. More...
 
void RandomiseParamValues ()
 Randomise all parameters. More...
 
void RandomiseParamValues (int startIdx, int endIdx)
 Randomise parameter values within a range. More...
 
void RandomiseParamValues (const char *paramGroup)
 Randomise parameter values for a parameter group. More...
 
void DefaultParamValues ()
 Set all parameters to their default values. More...
 
void DefaultParamValues (int startIdx, int endIdx)
 Default parameter values within a range. More...
 
void DefaultParamValues (const char *paramGroup)
 Default parameter values for a parameter group. More...
 
void PrintParamValues ()
 Default parameter values for a parameter group
More...
 

Friends

class IPlugAPP
 
class IPlugAAX
 
class IPlugVST2
 
class IPlugVST3
 
class IPlugVST3Controller
 
class IPlugVST3Processor
 
class IPlugAU
 
class IPlugAUv3
 
class IPlugWEB
 
class IPlugWAM
 

Detailed Description

The base class of an IPlug plug-in, which interacts with the different plug-in APIs.

This interface does not handle audio processing, see @IPlugProcessor

Definition at line 42 of file IPlugAPIBase.h.

Constructor & Destructor Documentation

◆ IPlugAPIBase()

IPlugAPIBase::IPlugAPIBase ( Config  config,
EAPI  plugAPI 
)

Definition at line 25 of file IPlugAPIBase.cpp.

◆ ~IPlugAPIBase()

IPlugAPIBase::~IPlugAPIBase ( )
virtual

Definition at line 48 of file IPlugAPIBase.cpp.

Member Function Documentation

◆ BeginInformHostOfParamChangeFromUI()

void IPlugAPIBase::BeginInformHostOfParamChangeFromUI ( int  paramIdx)
inlineoverride

Definition at line 158 of file IPlugAPIBase.h.

◆ CompareState()

bool IPlugAPIBase::CompareState ( const uint8_t *  pIncomingState,
int  startPos 
) const
virtual

Override this method to implement a custom comparison of incoming state data with your plug-ins state data, in order to support the ProTools compare light when using custom state chunks.

The default implementation will compare the serialized parameters.

Parameters
pIncomingStateThe incoming state data
startPosThe position to start in the incoming data in bytes
Returns
true in order to indicate that the states are equal.

Definition at line 72 of file IPlugAPIBase.cpp.

◆ CreateTimer()

void IPlugAPIBase::CreateTimer ( )

Called by the API class to create the timer that pumps the parameter/message queues.

Definition at line 67 of file IPlugAPIBase.cpp.

◆ DeferMidiMsg()

void IPlugAPIBase::DeferMidiMsg ( const IMidiMsg msg)
inlineoverride

Definition at line 177 of file IPlugAPIBase.h.

◆ DeferSysexMsg()

void IPlugAPIBase::DeferSysexMsg ( const ISysEx msg)
inlineoverride

Definition at line 179 of file IPlugAPIBase.h.

◆ DirtyParametersFromUI()

void IPlugAPIBase::DirtyParametersFromUI ( )
overridevirtual

In a distributed VST3 or WAM plugin, if you modify the parameters on the UI side (e.g.

recall preset in custom preset browser), you can call this to update the parameters on the DSP side

Reimplemented in IPlugVST3, and IPlugVST3Controller.

Definition at line 124 of file IPlugAPIBase.cpp.

Referenced by IPlugVST3::DirtyParametersFromUI(), and IPlugVST3Controller::DirtyParametersFromUI().

◆ EditorResizeFromUI()

bool IPlugAPIBase::EditorResizeFromUI ( int  viewWidth,
int  viewHeight,
bool  needsPlatformResize 
)
override

Definition at line 91 of file IPlugAPIBase.cpp.

◆ EndInformHostOfParamChangeFromUI()

void IPlugAPIBase::EndInformHostOfParamChangeFromUI ( int  paramIdx)
inlineoverride

Definition at line 160 of file IPlugAPIBase.h.

◆ GetAAXViewInterface()

virtual void * IPlugAPIBase::GetAAXViewInterface ( )
inlinevirtual

You need to implement this method if you are not using IGraphics and you want to support AAX's view interface functionality (special shortcuts to add automation for a parameter etc.)

Returns
pointer to the class that implements the IAAXViewInterface

Definition at line 101 of file IPlugAPIBase.h.

Referenced by IPlugAAX::EditorResize().

◆ GetMidiNoteText()

virtual bool IPlugAPIBase::GetMidiNoteText ( int  noteNumber,
char *  str 
) const
inlinevirtual

Override this method to provide custom text linked to MIDI note numbers in API classes that support that (VST2) Typically this might be used for a drum machine plug-in, in order to label a certainty "kick drum" etc.

Parameters
noteNumberMIDI note to get the textual description for
strchar array to set the text for the note. Should be less thatn kVstMaxNameLen (64) characters
Returns
true if you specified a custom textual description for this note

Definition at line 96 of file IPlugAPIBase.h.

◆ GetTrackColor()

virtual void IPlugAPIBase::GetTrackColor ( int &  r,
int &  g,
int &  b 
)
inlinevirtual

Get the color of the track that the plug-in is inserted on.

Reimplemented in IPlugReaperVST2, IPlugVST3, and IPlugVST3Controller.

Definition at line 121 of file IPlugAPIBase.h.

◆ GetTrackIndex()

virtual int IPlugAPIBase::GetTrackIndex ( )
inlinevirtual

Get the index of the track that the plug-in is inserted on.

Reimplemented in IPlugVST3, and IPlugVST3Controller.

Definition at line 127 of file IPlugAPIBase.h.

◆ GetTrackName()

virtual void IPlugAPIBase::GetTrackName ( WDL_String &  str)
inlinevirtual

Get the name of the track that the plug-in is inserted on.

Reimplemented in IPlugAAX, IPlugAU, IPlugReaperVST2, IPlugVST3, and IPlugVST3Controller.

Definition at line 124 of file IPlugAPIBase.h.

◆ GetTrackNamespace()

virtual void IPlugAPIBase::GetTrackNamespace ( WDL_String &  str)
inlinevirtual

Get the namespace of the track that the plug-in is inserted on.

Reimplemented in IPlugVST3, and IPlugVST3Controller.

Definition at line 130 of file IPlugAPIBase.h.

◆ GetTrackNamespaceIndex()

virtual int IPlugAPIBase::GetTrackNamespaceIndex ( )
inlinevirtual

Get the namespace index of the track that the plug-in is inserted on.

Reimplemented in IPlugVST3, and IPlugVST3Controller.

Definition at line 133 of file IPlugAPIBase.h.

◆ HostSpecificInit()

virtual void IPlugAPIBase::HostSpecificInit ( )
inlinevirtual

This method is implemented in some API classes, in order to do specific initialisation for particular problematic hosts.

This is not the same as OnHostIdentified(), which you may implement in your plug-in class to do your own specific initialisation after a host has been identified

Reimplemented in IPlugVST2.

Definition at line 155 of file IPlugAPIBase.h.

Referenced by SetHost().

◆ OnHostIdentified()

virtual void IPlugAPIBase::OnHostIdentified ( )
inlinevirtual

Implement this to do something specific when IPlug becomes aware of the particular host that is hosting the plug-in.

The method may get called multiple times.

Definition at line 69 of file IPlugAPIBase.h.

Referenced by SetHost().

◆ OnHostRequestingAboutBox()

virtual bool IPlugAPIBase::OnHostRequestingAboutBox ( )
inlinevirtual

Definition at line 62 of file IPlugAPIBase.h.

◆ OnHostRequestingImportantParameters()

void IPlugAPIBase::OnHostRequestingImportantParameters ( int  count,
WDL_TypedBuf< int > &  results 
)
virtual

Called by AUv3 plug-ins to get the "overview parameters".

Parameters
countHow many overview parameters
resultsYou should populate this typed buf with the indexes of the overview parameters if the host wants to show count number of controls

Definition at line 58 of file IPlugAPIBase.cpp.

◆ OnHostRequestingProductHelp()

virtual bool IPlugAPIBase::OnHostRequestingProductHelp ( )
inlinevirtual

Definition at line 65 of file IPlugAPIBase.h.

◆ OnHostRequestingSupportedViewConfiguration()

virtual bool IPlugAPIBase::OnHostRequestingSupportedViewConfiguration ( int  width,
int  height 
)
inlinevirtual

Called by AUv3 plug-in hosts to query support for multiple UI sizes.

Parameters
widthThe width the host offers
heightThe height the host offers
Returns
return true if your plug-in supports these dimensions

Definition at line 80 of file IPlugAPIBase.h.

◆ OnHostSelectedViewConfiguration()

virtual void IPlugAPIBase::OnHostSelectedViewConfiguration ( int  width,
int  height 
)
inlinevirtual

Called by some AUv3 plug-in hosts when a particular UI size is selected.

Parameters
widthThe selected width
heightThe selected height

Definition at line 89 of file IPlugAPIBase.h.

◆ OnIdle()

virtual void IPlugAPIBase::OnIdle ( )
inlinevirtual

Override this method to get an "idle"" call on the main thread.

Reimplemented in IPlugWeb.

Definition at line 111 of file IPlugAPIBase.h.

◆ SendArbitraryMsgFromUI()

void IPlugAPIBase::SendArbitraryMsgFromUI ( int  msgTag,
int  ctrlTag = kNoTag,
int  dataSize = 0,
const void *  pData = nullptr 
)
override

Definition at line 208 of file IPlugAPIBase.cpp.

◆ SendMidiMsgFromUI()

void IPlugAPIBase::SendMidiMsgFromUI ( const IMidiMsg msg)
override

Definition at line 196 of file IPlugAPIBase.cpp.

◆ SendParameterValueFromAPI()

void IPlugAPIBase::SendParameterValueFromAPI ( int  paramIdx,
double  value,
bool  normalized 
)
virtual

This is called from the plug-in API class in order to update UI controls linked to plug-in parameters, prior to calling OnParamChange() NOTE: It may be called on the high priority audio thread.

Its purpose is to place parameter changes in a queue to defer to main thread for the UI

Parameters
paramIdxThe index of the parameter that changed
valueThe new value
normalized/true if value is normalised

Definition at line 133 of file IPlugAPIBase.cpp.

References IPlugQueue< T >::Push().

◆ SendParameterValueFromUI()

void IPlugAPIBase::SendParameterValueFromUI ( int  paramIdx,
double  normalisedValue 
)
inlineoverride

Definition at line 164 of file IPlugAPIBase.h.

◆ SendSysexMsgFromUI()

void IPlugAPIBase::SendSysexMsgFromUI ( const ISysEx msg)
override

Definition at line 202 of file IPlugAPIBase.cpp.

◆ SetHost()

void IPlugAPIBase::SetHost ( const char *  host,
int  version 
)

Called to set the name of the current host, if known (calls on to HostSpecificInit() and OnHostIdentified()).

Parameters
hostThe name of the plug-in host
versionThe version of the plug-in host where version in hex = 0xVVVVRRMM

Definition at line 101 of file IPlugAPIBase.cpp.

References GetVersionStr(), HostSpecificInit(), LookUpHost(), and OnHostIdentified().

◆ SetParameterValue()

void IPlugAPIBase::SetParameterValue ( int  paramIdx,
double  normalizedValue 
)

SetParameterValue is called from the UI in the middle of a parameter change gesture (possibly via delegate) in order to update a parameter's value.

It will update mParams[paramIdx], call InformHostOfParamChange and IPlugAPIBase::OnParamChange();

Parameters
paramIdxThe index of the parameter that changed
normalizedValueThe new (normalised) value

Definition at line 116 of file IPlugAPIBase.cpp.

Friends And Related Function Documentation

◆ IPlugAAX

friend class IPlugAAX
friend

Definition at line 216 of file IPlugAPIBase.h.

◆ IPlugAPP

friend class IPlugAPP
friend

Definition at line 215 of file IPlugAPIBase.h.

◆ IPlugAU

friend class IPlugAU
friend

Definition at line 221 of file IPlugAPIBase.h.

◆ IPlugAUv3

friend class IPlugAUv3
friend

Definition at line 222 of file IPlugAPIBase.h.

◆ IPlugVST2

friend class IPlugVST2
friend

Definition at line 217 of file IPlugAPIBase.h.

◆ IPlugVST3

friend class IPlugVST3
friend

Definition at line 218 of file IPlugAPIBase.h.

◆ IPlugVST3Controller

friend class IPlugVST3Controller
friend

Definition at line 219 of file IPlugAPIBase.h.

◆ IPlugVST3Processor

friend class IPlugVST3Processor
friend

Definition at line 220 of file IPlugAPIBase.h.

◆ IPlugWAM

friend class IPlugWAM
friend

Definition at line 224 of file IPlugAPIBase.h.

◆ IPlugWEB

friend class IPlugWEB
friend

Definition at line 223 of file IPlugAPIBase.h.


The documentation for this class was generated from the following files: