ASPiK SDK
Loading...
Searching...
No Matches
pluginbase.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// ASPiK Plugin Kernel File: pluginbase.h
3//
12// -----------------------------------------------------------------------------
13#ifndef __PluginBase__
14#define __PluginBase__
15
16#include "pluginparameter.h"
17#include <map>
18
42{
43public:
44 PluginBase();
45 virtual ~PluginBase();
46
47 // --- PURE VIRTUAL FUNCTIONS ---------------------------------------------------------------------------------------------------- //
49 virtual bool processAudioFrame(ProcessFrameInfo& processFrameInfo) = 0;
50
52 virtual bool updatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo& paramInfo) = 0;
53
55 virtual bool updatePluginParameterNormalized(int32_t controlID, double normalizedValue, ParameterUpdateInfo& paramInfo) = 0;
56
58 virtual bool postUpdatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo& paramInfo) = 0;
59
61 virtual bool preProcessAudioBuffers(ProcessBufferInfo& processInfo) = 0;
62
64 virtual bool postProcessAudioBuffers(ProcessBufferInfo& processInfo) = 0;
65 // ----------------------------------------------------------------------------------------------------------------------------- //
66
68 virtual bool reset(ResetInfo& resetInfo);
69
71 virtual bool initialize(PluginInfo& _pluginInfo);
72
75
77 virtual bool processAudioBuffers(ProcessBufferInfo& processInfo);
78
80 virtual bool preProcessAudioBlock(IMidiEventQueue* midiEventQueue = nullptr) { return true; }
81
83 virtual bool processAudioBlock(ProcessBlockInfo& processBlockInfo) { return true; }
84
87
89 virtual bool guiParameterChanged(int32_t controlID, double actualValue) { return true; }
90
92 virtual bool processMessage(MessageInfo& messageInfo) { return true; }
93
95 virtual bool processMIDIEvent(midiEvent& event) { return true; }
96
98 bool doVST3SAAUpdates();
99
102
104 virtual bool setVectorJoystickParameters(const VectorJoystickData& vectorJoysickData) { return true; }
105
107 int32_t addPluginParameter(PluginParameter* piParam, double sampleRate = 44100);
108
110 void setParamAuxAttribute(uint32_t controlID, const AuxParameterAttribute& auxAttribute);
111
113 size_t getPluginParameterCount(){ return pluginParameters.size(); }
114
122
129 PluginParameter* getPluginParameterByControlID(int32_t controlID) { return pluginParameterMap[controlID]; }
130
132 PluginParameter* getNextParameterOfType(int32_t& startIndex, controlVariableType controlType);
133
135 double getPIParamValueDouble(int32_t controlID);
136
138 float getPIParamValueFloat(int32_t controlID);
139
141 int getPIParamValueInt(int32_t controlID);
142
144 uint32_t getPIParamValueUInt(int32_t controlID);
145
147 bool hasProToolsGRMeters();
148
150 double getProToolsGRValue();
151
154
157
163
166
169
174 int32_t getChannelInputFormat(uint32_t ioConfigIndex) {return pluginDescriptor.supportedIOCombinations[ioConfigIndex].inputChannelFormat;}
175
180 int32_t getChannelOutputFormat(uint32_t ioConfigIndex) {return pluginDescriptor.supportedIOCombinations[ioConfigIndex].outputChannelFormat;}
181
183 uint32_t getInputChannelCount(uint32_t ioConfigIndex);
184
186 uint32_t getOutputChannelCount(uint32_t ioConfigIndex);
187
196
198 void setPIParamValue(uint32_t _controlID, double _controlValue);
199
201 double setPIParamValueNormalized(uint32_t _controlID, double _normalizedValue, bool applyTaper = true);
202
204 bool updatePIParamBoundValue(uint32_t _controlID);
205
207 void clearUpdateGUIParameters(std::vector<GUIParameter*>& guiParameters);
208
210 std::vector<PluginParameter*>* makePluginParameterVectorCopy(bool disableSmoothing = true);
211
213 bool initPresetParameters(std::vector<PresetParameter>& presetParameters, bool disableSmoothing = true);
214
216 bool setPresetParameter(std::vector<PresetParameter>& presetParameters, uint32_t _controlID, double _controlValue);
217
223 void setPluginHostConnector(IPluginHostConnector* _pluginHostConnector){pluginHostConnector = _pluginHostConnector;}
224
230 size_t getPresetCount(){return presets.size();}
231
233 const char* getPresetName(uint32_t index);
234
236 size_t addPreset(PresetInfo* preset);
237
239 void removePreset(uint32_t index);
240
242 void removeAllPresets();
243
245 PresetInfo* getPreset(uint32_t index);
246
249
251 bool compareSelectedString(int32_t controlID, const char* compareString);
252
259
266
273
280
287
294
300 const char* getPluginName() { return pluginDescriptor.pluginName.c_str(); }
301
307 const char* getShortPluginName() { return pluginDescriptor.shortPluginName.c_str(); }
308
314 const char* getVendorName() { return pluginDescriptor.vendorName.c_str(); }
315
322
329
336
343
349 const uint32_t getAAXProductID() { return apiSpecificInfo.aaxProductID; }
350
356 const char* getAAXBundleID() { return apiSpecificInfo.aaxBundleID.c_str(); }
357
363 const char* getAAXEffectID() { return apiSpecificInfo.aaxEffectID.c_str(); }
364
371
377 const char* getVST3_FUID() { return apiSpecificInfo.vst3FUID.c_str(); }
378
385
392
398 const char* getVST3BundleID() { return apiSpecificInfo.vst3BundleID.c_str(); }
399
405 const char* getAUBundleID() { return apiSpecificInfo.auBundleID.c_str(); }
406
412 const char* getAUBundleName() { return apiSpecificInfo.auBundleName.c_str(); }
413
414protected:
419
420 // --- arrays for frame processing
421 float inputFrame[MAX_CHANNEL_COUNT];
422 float outputFrame[MAX_CHANNEL_COUNT];
423 float auxInputFrame[MAX_CHANNEL_COUNT];
424 float auxOutputFrame[MAX_CHANNEL_COUNT];
425
426 // --- block info struct (optional for block processing, if enabled)
427 ProcessBlockInfo processBlockInfo;
428
429 // --- ultra-fast access ***for real-time audio processing***
431 uint32_t numPluginParameters = 0;
432
435
438
441
442 // --- vectorized version of pluginParameterMap for faster iteration that the map version below
443 std::vector<PluginParameter*> pluginParameters;
444
445 // --- map<controlID , PluginParameter*> NOTE: VERY SLOW ITERATIONS -- only used for non-audio proc thread stuff
446 typedef std::map<uint32_t, PluginParameter*> pluginParameterControlIDMap;
448
449 // --- plugin core -> host (wrap) connector
451
452 // --- PRESETS
453 std::vector<PresetInfo*> presets;
454};
455
456#endif /* defined(__PluginBase__) */
457
Double buffered queue for MIDI messages.
Definition: pluginstructures.h:1628
Custom interface to send the plugin shell a message from plugin core.
Definition: pluginstructures.h:1610
The PluginBase object is the base class for the Plugin Core object.
Definition: pluginbase.h:42
size_t addPreset(PresetInfo *preset)
add a new preset
Definition: pluginbase.cpp:860
double setPIParamValueNormalized(uint32_t _controlID, double _normalizedValue, bool applyTaper=true)
set a parameter's value with the normalied value (as double)
Definition: pluginbase.cpp:728
const char * getAAXBundleID()
Description query: AAX Bundle ID.
Definition: pluginbase.h:356
uint32_t getOutputChannelCount(uint32_t ioConfigIndex)
get the number of output channels for a configuration at a given index
Definition: pluginbase.cpp:697
uint32_t addSupportedIOCombination(ChannelIOConfig ioConfig)
add a new I/O configuration pair
Definition: pluginbase.cpp:592
bool setPresetParameter(std::vector< PresetParameter > &presetParameters, uint32_t _controlID, double _controlValue)
set a new value for a preset
Definition: pluginbase.cpp:822
virtual bool postProcessAudioBuffers(ProcessBufferInfo &processInfo)=0
float outputFrame[MAX_CHANNEL_COUNT]
output array for frame processing
Definition: pluginbase.h:422
void setPluginHostConnector(IPluginHostConnector *_pluginHostConnector)
store the plugin host interface pointer: this pointer will never go out of scope or be invalid once s...
Definition: pluginbase.h:223
PluginParameter * getNextParameterOfType(int32_t &startIndex, controlVariableType controlType)
get a parameter by type
Definition: pluginbase.cpp:464
float auxOutputFrame[MAX_CHANNEL_COUNT]
aux output array for frame processing
Definition: pluginbase.h:424
virtual bool initialize(PluginInfo &_pluginInfo)
one-time initialize function called after object creation and before the first reset( ) call
Definition: pluginbase.cpp:90
virtual bool processAudioFrame(ProcessFrameInfo &processFrameInfo)=0
float auxInputFrame[MAX_CHANNEL_COUNT]
aux input array for frame processing
Definition: pluginbase.h:423
int getPIParamValueInt(int32_t controlID)
value-as-int
Definition: pluginbase.cpp:521
uint32_t numSmoothingPluginParameters
number of smoothable parameters only
Definition: pluginbase.h:437
virtual bool processAudioBuffers(ProcessBufferInfo &processInfo)
THE buffer processing function.
Definition: pluginbase.cpp:135
virtual bool processAudioBlock(ProcessBlockInfo &processBlockInfo)
Definition: pluginbase.h:83
const char * getPresetName(uint32_t index)
gets name as a const char* for connecting with all APIs at some level
Definition: pluginbase.cpp:844
bool wantsMIDI()
Description query: MIDI.
Definition: pluginbase.h:265
bool updateOutBoundVariables()
copy newly updated metering variables into GUI parameters for display
Definition: pluginbase.cpp:308
virtual bool postUpdatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo &paramInfo)=0
PluginParameter ** VSTSAAPluginParameters
old-fashioned C-arrays of pointers for smoothable parameters
Definition: pluginbase.h:433
std::vector< PluginParameter * > * makePluginParameterVectorCopy(bool disableSmoothing=true)
copies parameters into a new list; used to initialize the GUI - note that this makes true,...
Definition: pluginbase.cpp:774
const char * getAUBundleID()
Description query: AU Bundle ID.
Definition: pluginbase.h:405
const char * getAUBundleName()
Description query: AU Bundle Name.
Definition: pluginbase.h:412
virtual bool updatePluginParameterNormalized(int32_t controlID, double normalizedValue, ParameterUpdateInfo &paramInfo)=0
bool updatePIParamBoundValue(uint32_t _controlID)
update a bound-variable with a parameter's control value; this is the essence of the variable binding...
Definition: pluginbase.cpp:744
float inputFrame[MAX_CHANNEL_COUNT]
input array for frame processing
Definition: pluginbase.h:421
bool doParameterSmoothing()
combines parameter smoothing and VST3 sample accurate updates
Definition: pluginbase.cpp:336
int32_t addPluginParameter(PluginParameter *piParam, double sampleRate=44100)
adds a new plugin parameter to the parameter map
Definition: pluginbase.cpp:428
const char * getVendorName()
Description query:vendor name.
Definition: pluginbase.h:314
const uint32_t getAAXManufacturerID()
Description query: AAX Man ID.
Definition: pluginbase.h:342
bool hasSupportedOutputChannelFormat(uint32_t channelFormat)
check to see if plugin support a given output channel format
Definition: pluginbase.cpp:665
uint32_t getVST3SampleAccuracyGranularity()
Description query: VST Sample Accurate Automation granularity.
Definition: pluginbase.h:391
bool initPresetParameters(std::vector< PresetParameter > &presetParameters, bool disableSmoothing=true)
creates the preset parameter ID/Value pair PresetParameter objects and adds them to supplied list
Definition: pluginbase.cpp:800
pluginParameterControlIDMap pluginParameterMap
member map of parameter list
Definition: pluginbase.h:447
uint32_t getInputChannelCount(uint32_t ioConfigIndex)
get the number of input channels for a configuration at a given index
Definition: pluginbase.cpp:682
void syncInBoundVariables()
initialize object for a new run of audio; called just before audio streams
Definition: pluginbase.cpp:105
void clearUpdateGUIParameters(std::vector< GUIParameter * > &guiParameters)
delete GUI update structures in a list
Definition: pluginbase.cpp:759
virtual bool preProcessAudioBlock(IMidiEventQueue *midiEventQueue=nullptr)
Definition: pluginbase.h:80
virtual bool guiParameterChanged(int32_t controlID, double actualValue)
Definition: pluginbase.h:89
uint32_t addSupportedAuxIOCombination(ChannelIOConfig ioConfig)
add a new I/O configuration pair
Definition: pluginbase.cpp:620
PluginParameter ** pluginParameterArray
old-fashioned C-arrays of pointers for ultra-fast access for real-time audio processing
Definition: pluginbase.h:430
PluginParameter ** smoothingPluginParameters
old-fashioned C-arrays of pointers for smoothable parameters
Definition: pluginbase.h:436
void setPIParamValue(uint32_t _controlID, double _controlValue)
set a parameter's value with the actual value (as double)
Definition: pluginbase.cpp:712
std::vector< PresetInfo * > presets
preset list
Definition: pluginbase.h:453
bool wantsInfiniteTailVST3()
Description query: infinite tail (VST3 only)
Definition: pluginbase.h:293
AudioProcDescriptor audioProcDescriptor
current audio processing description
Definition: pluginbase.h:417
virtual ~PluginBase()
PluginBase destructor.
Definition: pluginbase.cpp:41
PluginParameter * getPluginParameterByIndex(int32_t index)
get a parameter by index location in vector or array
Definition: pluginbase.h:121
const uint32_t getAAXProductID()
Description query: AAX Prod ID.
Definition: pluginbase.h:349
PluginParameter * getPluginParameterByControlID(int32_t controlID)
get a parameter by control ID - uses map (slowest)
Definition: pluginbase.h:129
uint32_t getAAXPluginCategory()
Description query: AAX Category.
Definition: pluginbase.h:370
uint32_t numVSTSAAPluginParameters
number of smoothable parameters only
Definition: pluginbase.h:434
PluginInfo pluginInfo
info about the DLL (component) itself, includes path to DLL
Definition: pluginbase.h:418
double getProToolsGRValue()
pro tools GR meter is only ever observed to be single meter; this merges all meter values for meters ...
Definition: pluginbase.cpp:566
bool hasProToolsGRMeters()
checks for at least one meter parameter that has the pro tools GR meter flag set
Definition: pluginbase.cpp:549
double getSampleRate()
Description query: sample rate.
Definition: pluginbase.h:328
bool doVST3SAAUpdates()
ONLY for VST3 plugins with sample accurate automation enabled.
Definition: pluginbase.cpp:372
uint32_t getDefaultChannelIOConfigForChannelCount(uint32_t channelCount)
get the configuration (e.g. kCFStereo) for a given channel count; mainly for AU that does not discrim...
Definition: pluginbase.h:195
const char * getVST3_FUID()
Description query: VST3 FUID.
Definition: pluginbase.h:377
virtual bool preProcessAudioBuffers(ProcessBufferInfo &processInfo)=0
PluginBase()
PluginBase constructor.
Definition: pluginbase.cpp:23
size_t getPresetCount()
get number of stored presets
Definition: pluginbase.h:230
void setParamAuxAttribute(uint32_t controlID, const AuxParameterAttribute &auxAttribute)
adds an auxilliary attribute to the plugin parameter; you can have as many auxilliary attributes as y...
Definition: pluginbase.cpp:448
bool hasCustomGUI()
Description query: has GUI.
Definition: pluginbase.h:272
uint32_t getPluginType()
Description query: plugin type.
Definition: pluginbase.h:321
double getTailTimeInMSec()
Description query: tail time.
Definition: pluginbase.h:286
const char * getVST3BundleID()
Description query: VST3 Bundle ID.
Definition: pluginbase.h:398
uint32_t getNumSupportedIOCombinations()
get I/O channel pair count
Definition: pluginbase.h:162
bool compareSelectedString(int32_t controlID, const char *compareString)
helper function to compare a PluginParameter's value with a string version of it
Definition: pluginbase.cpp:1013
virtual bool updatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo &paramInfo)=0
void removePreset(uint32_t index)
remove a preset - NOTE: does not delete object
Definition: pluginbase.cpp:871
virtual bool setVectorJoystickParameters(const VectorJoystickData &vectorJoysickData)
Definition: pluginbase.h:104
IPluginHostConnector * pluginHostConnector
created and destroyed on host
Definition: pluginbase.h:450
uint32_t getPIParamValueUInt(int32_t controlID)
value-as-uint
Definition: pluginbase.cpp:536
uint32_t numOutboundPluginParameters
total number of outbound (meter) parameters
Definition: pluginbase.h:440
const char * getPluginName()
Description query: name.
Definition: pluginbase.h:300
PluginParameter ** outboundPluginParameters
old-fashioned C-arrays of pointers for outbound (meter) parameters
Definition: pluginbase.h:439
virtual bool processMIDIEvent(midiEvent &event)
Definition: pluginbase.h:95
PluginDescriptor pluginDescriptor
description strings
Definition: pluginbase.h:415
uint32_t numPluginParameters
total number of parameters
Definition: pluginbase.h:431
int32_t getChannelInputFormat(uint32_t ioConfigIndex)
get input cj
Definition: pluginbase.h:174
int32_t getChannelOutputFormat(uint32_t ioConfigIndex)
get I/O channel pair count
Definition: pluginbase.h:180
void removeAllPresets()
remove all presets - NOTE: does not delete objects
Definition: pluginbase.cpp:888
int getFourCharCode()
Description query: 4-char code.
Definition: pluginbase.h:335
const char * getShortPluginName()
Description query: short name (AAX)
Definition: pluginbase.h:307
size_t getPluginParameterCount()
Definition: pluginbase.h:113
bool hasSidechain()
Description query: sidechain.
Definition: pluginbase.h:258
virtual bool processMessage(MessageInfo &messageInfo)
Definition: pluginbase.h:92
void initPluginParameterArray()
called at the end of the initialization phase, this function creates the various non map-versions of ...
Definition: pluginbase.cpp:918
float getPIParamValueFloat(int32_t controlID)
value-as-float
Definition: pluginbase.cpp:505
bool wantsVST3SampleAccurateAutomation()
Description query: VST Sample Accurate Automation.
Definition: pluginbase.h:384
double getLatencyInSamples()
Description query: latency.
Definition: pluginbase.h:279
std::vector< PluginParameter * > pluginParameters
vector version of parameter list
Definition: pluginbase.h:443
virtual bool reset(ResetInfo &resetInfo)
initialize object for a new run of audio; called just before audio streams
Definition: pluginbase.cpp:71
double getPIParamValueDouble(int32_t controlID)
value-as-double
Definition: pluginbase.cpp:490
PresetInfo * getPreset(uint32_t index)
get a preset
Definition: pluginbase.cpp:906
const char * getAAXEffectID()
Description query: AAX Effect ID.
Definition: pluginbase.h:363
std::map< uint32_t, PluginParameter * > pluginParameterControlIDMap
map version of parameter list
Definition: pluginbase.h:446
APISpecificInfo apiSpecificInfo
description strings, API specific
Definition: pluginbase.h:416
bool hasSupportedInputChannelFormat(uint32_t channelFormat)
check to see if plugin support a given input channel format
Definition: pluginbase.cpp:648
The PluginParameter object stores all of the data needed for any type of plugin parameter....
Definition: pluginparameter.h:52
channelFormat
Use this enum to identify plugin channel formats. Steinberg calls these "speaker arrangements".
Definition: pluginstructures.h:115
controlVariableType
Use this strongly typed enum to easily set the control's behavior; this tells the PluginParameter obj...
Definition: guiconstants.h:288
base class interface file for ASPiK pluginparameter object
Identifiers, GUIDs and other strings and number id values, API specific.
Definition: pluginstructures.h:207
uint32_t aaxManufacturerID
aax manu ID
Definition: pluginstructures.h:244
std::string auBundleName
AU bundle name /* MacOS only: this MUST match the bundle name which is the same as the project name *...
Definition: pluginstructures.h:261
std::string auBundleID
AU bundle ID /* MacOS only: this MUST match the bundle identifier in your info.plist file *‍/.
Definition: pluginstructures.h:260
uint32_t aaxProductID
aax ID
Definition: pluginstructures.h:245
std::string aaxEffectID
aax Effect ID
Definition: pluginstructures.h:246
std::string aaxBundleID
AAX bundle /* MacOS only: this MUST match the bundle identifier in your info.plist file *‍/.
Definition: pluginstructures.h:247
uint32_t vst3SampleAccurateGranularity
sample accuracy granularity (update interval)
Definition: pluginstructures.h:256
uint32_t aaxPluginCategoryCode
aax plugin category
Definition: pluginstructures.h:248
std::string vst3BundleID
VST bundle ID /* MacOS only: this MUST match the bundle identifier in your info.plist file *‍/.
Definition: pluginstructures.h:257
bool enableVST3SampleAccurateAutomation
flag for sample accurate automation
Definition: pluginstructures.h:255
int fourCharCode
the mystic and ancient 4-character code (oooh)
Definition: pluginstructures.h:251
std::string vst3FUID
VST GUID.
Definition: pluginstructures.h:254
Information package about the current DAW session. Sample rate and bit-depth of audio.
Definition: pluginstructures.h:1217
double sampleRate
sample rate
Definition: pluginstructures.h:1237
Information about auxilliary parameter details - purely customizeable. This uses the attributeValue u...
Definition: pluginstructures.h:923
Structure of a pair of channel format enumerators that set an input/output channel I/O capability.
Definition: pluginstructures.h:524
uint32_t inputChannelFormat
input format for this I/O pair
Definition: pluginstructures.h:545
uint32_t outputChannelFormat
output format for this I/O pair
Definition: pluginstructures.h:546
Information that includes the message code as well as the message data.
Definition: pluginstructures.h:706
Information about a paraemeter being updated. Used when bound variables are updated....
Definition: pluginstructures.h:835
Information package about the plugin itself, consisting mainly of simple strings and ID values.
Definition: pluginstructures.h:1254
bool infiniteTailVST3
VST3 infinite tail flag.
Definition: pluginstructures.h:1285
uint32_t pluginTypeCode
FX or synth.
Definition: pluginstructures.h:1277
bool hasCustomGUI
default on
Definition: pluginstructures.h:1282
uint32_t numSupportedIOCombinations
should support at least main 3 combos
Definition: pluginstructures.h:1287
std::string shortPluginName
name (up to 15 chars)
Definition: pluginstructures.h:1275
double tailTimeInMSec
tail time
Definition: pluginstructures.h:1284
uint32_t getDefaultChannelIOConfigForChannelCount(uint32_t channelCount)
Definition: pluginstructures.h:1294
std::string vendorName
manufacturer name
Definition: pluginstructures.h:1276
std::string pluginName
name (up to 31 chars)
Definition: pluginstructures.h:1274
bool wantsMIDI
want MIDI (don't need to actually use it)
Definition: pluginstructures.h:1281
bool hasSidechain
sidechain flag
Definition: pluginstructures.h:1279
uint32_t latencyInSamples
latency
Definition: pluginstructures.h:1283
Structure that is used during the base class initilize( ) funciton call, after object instantiation i...
Definition: pluginstructures.h:754
Definition: pluginstructures.h:407
Structure for setting up block processing.
Definition: pluginstructures.h:1063
Information package that arrives with each new audio buffer process cycle. Contains everything needed...
Definition: pluginstructures.h:1123
Information package that arrives with each new audio frame; called internally from the buffer process...
Definition: pluginstructures.h:1177
Sample rate and bit-depth information that is passed during the reset( ) function.
Definition: pluginstructures.h:181
Incoming data from a vector joystick.
Definition: pluginstructures.h:277
Information about a MIDI event.
Definition: pluginstructures.h:562