ASPiK SDK
pluginbase.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // ASPiK Plugin Kernel File: pluginbase.h
3 //
12 // -----------------------------------------------------------------------------
207 #ifndef __PluginBase__
208 #define __PluginBase__
209 
210 #include "pluginparameter.h"
211 
212 #include <map>
213 
237 {
238 public:
239  PluginBase();
240  virtual ~PluginBase();
241 
242  // --- PURE VIRTUAL FUNCTIONS ---------------------------------------------------------------------------------------------------- //
244  virtual bool processAudioFrame(ProcessFrameInfo& processFrameInfo) = 0;
245 
247  virtual bool updatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo& paramInfo) = 0;
248 
250  virtual bool updatePluginParameterNormalized(int32_t controlID, double normalizedValue, ParameterUpdateInfo& paramInfo) = 0;
251 
253  virtual bool postUpdatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo& paramInfo) = 0;
254 
256  virtual bool preProcessAudioBuffers(ProcessBufferInfo& processInfo) = 0;
257 
259  virtual bool postProcessAudioBuffers(ProcessBufferInfo& processInfo) = 0;
260  // ----------------------------------------------------------------------------------------------------------------------------- //
261 
263  virtual bool reset(ResetInfo& resetInfo);
264 
266  void syncInBoundVariables();
267 
269  virtual bool processAudioBuffers(ProcessBufferInfo& processInfo);
270 
273 
275  virtual bool guiParameterChanged(int32_t controlID, double actualValue) { return true; }
276 
278  virtual bool processMessage(MessageInfo& messageInfo) { return true; }
279 
281  virtual bool processMIDIEvent(midiEvent& event) { return true; }
282 
285 
287  virtual bool setVectorJoystickParameters(const VectorJoystickData& vectorJoysickData) { return true; }
288 
290  int32_t addPluginParameter(PluginParameter* piParam, double sampleRate = 44100);
291 
293  void setParamAuxAttribute(uint32_t controlID, const AuxParameterAttribute& auxAttribute);
294 
296  size_t getPluginParameterCount(){ return pluginParameters.size(); }
297 
305  PluginParameter* getPluginParameterByIndex(int32_t index) { return pluginParameters[index]; }
306 
314  PluginParameter* getPluginParameterByControlID(int32_t controlID) { return pluginParameterMap[controlID]; }
315 
317  PluginParameter* getNextParameterOfType(int32_t& startIndex, controlVariableType controlType);
318 
320  double getPIParamValueDouble(int32_t controlID);
321 
323  float getPIParamValueFloat(int32_t controlID);
324 
326  int getPIParamValueInt(int32_t controlID);
327 
329  uint32_t getPIParamValueUInt(int32_t controlID);
330 
332  bool hasProToolsGRMeters();
333 
335  double getProToolsGRValue();
336 
338  uint32_t addSupportedIOCombination(ChannelIOConfig ioConfig);
339 
342 
348 
351 
354 
359  int32_t getChannelInputFormat(uint32_t ioConfigIndex) {return pluginDescriptor.supportedIOCombinations[ioConfigIndex].inputChannelFormat;}
360 
365  int32_t getChannelOutputFormat(uint32_t ioConfigIndex) {return pluginDescriptor.supportedIOCombinations[ioConfigIndex].outputChannelFormat;}
366 
368  uint32_t getInputChannelCount(uint32_t ioConfigIndex);
369 
371  uint32_t getOutputChannelCount(uint32_t ioConfigIndex);
372 
381 
383  void setPIParamValue(uint32_t _controlID, double _controlValue);
384 
386  double setPIParamValueNormalized(uint32_t _controlID, double _normalizedValue, bool applyTaper = true);
387 
389  bool updatePIParamBoundValue(uint32_t _controlID);
390 
392  void clearUpdateGUIParameters(std::vector<GUIParameter*>& guiParameters);
393 
395  std::vector<PluginParameter*>* makePluginParameterVectorCopy(bool disableSmoothing = true);
396 
398  bool initPresetParameters(std::vector<PresetParameter>& presetParameters, bool disableSmoothing = true);
399 
401  bool setPresetParameter(std::vector<PresetParameter>& presetParameters, uint32_t _controlID, double _controlValue);
402 
408  void setPluginHostConnector(IPluginHostConnector* _pluginHostConnector){pluginHostConnector = _pluginHostConnector;}
409 
415  size_t getPresetCount(){return presets.size();}
416 
418  const char* getPresetName(uint32_t index);
419 
421  size_t addPreset(PresetInfo* preset);
422 
424  void removePreset(uint32_t index);
425 
427  void removeAllPresets();
428 
430  PresetInfo* getPreset(uint32_t index);
431 
434 
436  bool compareSelectedString(int32_t controlID, const char* compareString);
437 
444 
451 
458 
465 
472 
479 
485  const char* getPluginName() { return pluginDescriptor.pluginName.c_str(); }
486 
492  const char* getShortPluginName() { return pluginDescriptor.shortPluginName.c_str(); }
493 
499  const char* getVendorName() { return pluginDescriptor.vendorName.c_str(); }
500 
507 
514 
521 
528 
534  const uint32_t getAAXProductID() { return apiSpecificInfo.aaxProductID; }
535 
541  const char* getAAXBundleID() { return apiSpecificInfo.aaxBundleID.c_str(); }
542 
548  const char* getAAXEffectID() { return apiSpecificInfo.aaxEffectID.c_str(); }
549 
556 
562  const char* getVST3_FUID() { return apiSpecificInfo.vst3FUID.c_str(); }
563 
570 
577 
583  const char* getVST3BundleID() { return apiSpecificInfo.vst3BundleID.c_str(); }
584 
590  const char* getAUBundleID() { return apiSpecificInfo.auBundleID.c_str(); }
591 
597  const char* getAUBundleName() { return apiSpecificInfo.auBundleName.c_str(); }
598 
599 protected:
603 
604  // --- arrays for frame processing
605  float inputFrame[MAX_CHANNEL_COUNT];
606  float outputFrame[MAX_CHANNEL_COUNT];
607  float auxInputFrame[MAX_CHANNEL_COUNT];
608  float auxOutputFrame[MAX_CHANNEL_COUNT];
609 
610  // --- ultra-fast access for real-time audio processing
612  uint32_t numPluginParameters = 0;
617 
618  // --- vectorized version of pluginParameterMap for fast iteration when key not needed
619  std::vector<PluginParameter*> pluginParameters;
620 
621  // --- map<controlID , PluginParameter*>
622  typedef std::map<uint32_t, PluginParameter*> pluginParameterControlIDMap;
624 
625  // --- plugin core -> host (wrap) connector
627 
628  // --- PRESETS
629  std::vector<PresetInfo*> presets;
630 };
631 
632 #endif /* defined(__PluginBase__) */
uint32_t aaxManufacturerID
aax manu ID
Definition: pluginstructures.h:221
uint32_t numSupportedIOCombinations
should support at least main 3 combos
Definition: pluginstructures.h:967
std::string shortPluginName
name (up to 15 chars)
Definition: pluginstructures.h:955
Information package about the current DAW session. Sample rate and bit-depth of audio.
Definition: pluginstructures.h:906
int32_t getChannelInputFormat(uint32_t ioConfigIndex)
get input cj
Definition: pluginbase.h:359
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:238
Information that includes the message code as well as the message data.
Definition: pluginstructures.h:545
uint32_t addSupportedIOCombination(ChannelIOConfig ioConfig)
add a new I/O configuration pair
Definition: pluginbase.cpp:463
PluginParameter * getPluginParameterByControlID(int32_t controlID)
get a parameter by control ID - uses map (slowest)
Definition: pluginbase.h:314
std::string vst3BundleID
VST bundle ID /* MacOS only: this MUST match the bundle identifier in your info.plist file */...
Definition: pluginstructures.h:234
bool hasCustomGUI
default on
Definition: pluginstructures.h:962
virtual bool preProcessAudioBuffers(ProcessBufferInfo &processInfo)=0
uint32_t getPluginType()
Description query: plugin type.
Definition: pluginbase.h:506
float outputFrame[MAX_CHANNEL_COUNT]
output array for frame processing
Definition: pluginbase.h:606
PluginParameter * getNextParameterOfType(int32_t &startIndex, controlVariableType controlType)
get a parameter by type
Definition: pluginbase.cpp:335
void clearUpdateGUIParameters(std::vector< GUIParameter *> &guiParameters)
delete GUI update structures in a list
Definition: pluginbase.cpp:630
int32_t addPluginParameter(PluginParameter *piParam, double sampleRate=44100)
adds a new plugin parameter to the parameter map
Definition: pluginbase.cpp:299
virtual bool updatePluginParameterNormalized(int32_t controlID, double normalizedValue, ParameterUpdateInfo &paramInfo)=0
uint32_t pluginTypeCode
FX or synth.
Definition: pluginstructures.h:957
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:408
virtual bool reset(ResetInfo &resetInfo)
initialize object for a new run of audio; called just before audio streams
Definition: pluginbase.cpp:70
bool wantsMIDI
want MIDI (don&#39;t need to actually use it)
Definition: pluginstructures.h:961
Information package that arrives with each new audio frame; called internally from the buffer process...
Definition: pluginstructures.h:866
virtual bool setVectorJoystickParameters(const VectorJoystickData &vectorJoysickData)
Definition: pluginbase.h:287
int fourCharCode
the mystic and ancient 4-character code (oooh)
Definition: pluginstructures.h:228
uint32_t numSmoothablePluginParameters
number of smoothable parameters only
Definition: pluginbase.h:614
uint32_t vst3SampleAccurateGranularity
sample accuracy granularity (update interval)
Definition: pluginstructures.h:233
void removeAllPresets()
remove all presets - NOTE: does not delete objects
Definition: pluginbase.cpp:759
pluginParameterControlIDMap pluginParameterMap
member map of parameter list
Definition: pluginbase.h:623
The PluginBase object is the base class for the Plugin Core object.
Definition: pluginbase.h:236
virtual bool updatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo &paramInfo)=0
bool enableVST3SampleAccurateAutomation
flag for sample accurate automation
Definition: pluginstructures.h:232
double getLatencyInSamples()
Description query: latency.
Definition: pluginbase.h:464
IPluginHostConnector * pluginHostConnector
created and destroyed on host
Definition: pluginbase.h:626
uint32_t getAAXPluginCategory()
Description query: AAX Category.
Definition: pluginbase.h:555
double getTailTimeInMSec()
Description query: tail time.
Definition: pluginbase.h:471
float inputFrame[MAX_CHANNEL_COUNT]
input array for frame processing
Definition: pluginbase.h:605
uint32_t numOutboundPluginParameters
total number of outbound (meter) parameters
Definition: pluginbase.h:616
std::string pluginName
name (up to 31 chars)
Definition: pluginstructures.h:954
const char * getShortPluginName()
Description query: short name (AAX)
Definition: pluginbase.h:492
uint32_t numPluginParameters
total number of parameters
Definition: pluginbase.h:612
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:380
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:319
bool hasCustomGUI()
Description query: has GUI.
Definition: pluginbase.h:457
std::string vendorName
manufacturer name
Definition: pluginstructures.h:956
size_t getPluginParameterCount()
Definition: pluginbase.h:296
void doSampleAccurateParameterUpdates()
combines parameter smoothing and VST3 sample accurate updates
Definition: pluginbase.cpp:232
virtual bool processMessage(MessageInfo &messageInfo)
Definition: pluginbase.h:278
uint32_t getInputChannelCount(uint32_t ioConfigIndex)
get the number of input channels for a configuration at a given index
Definition: pluginbase.cpp:553
Information about a paraemeter being updated. Used when bound variables are updated. Multiple advanced uses.
Definition: pluginstructures.h:615
PresetInfo * getPreset(uint32_t index)
get a preset
Definition: pluginbase.cpp:777
Sample rate and bit-depth information that is passed during the reset( ) function.
Definition: pluginstructures.h:180
double sampleRate
sample rate
Definition: pluginstructures.h:917
int getFourCharCode()
Description query: 4-char code.
Definition: pluginbase.h:520
float getPIParamValueFloat(int32_t controlID)
value-as-float
Definition: pluginbase.cpp:376
bool hasSupportedOutputChannelFormat(uint32_t channelFormat)
check to see if plugin support a given output channel format
Definition: pluginbase.cpp:536
virtual bool processAudioBuffers(ProcessBufferInfo &processInfo)
THE buffer processing function.
Definition: pluginbase.cpp:120
uint32_t latencyInSamples
latency
Definition: pluginstructures.h:963
virtual bool postProcessAudioBuffers(ProcessBufferInfo &processInfo)=0
uint32_t inputChannelFormat
input format for this I/O pair
Definition: pluginstructures.h:433
Information package that arrives with each new audio buffer process cycle. Contains everything needed...
Definition: pluginstructures.h:812
virtual bool processMIDIEvent(midiEvent &event)
Definition: pluginbase.h:281
AudioProcDescriptor audioProcDescriptor
current audio processing description
Definition: pluginbase.h:602
void syncInBoundVariables()
initialize object for a new run of audio; called just before audio streams
Definition: pluginbase.cpp:90
controlVariableType
Use this strongly typed enum to easily set the control&#39;s behavior; this tells the PluginParameter obj...
Definition: guiconstants.h:270
std::vector< PresetInfo * > presets
preset list
Definition: pluginbase.h:629
size_t getPresetCount()
get number of stored presets
Definition: pluginbase.h:415
virtual bool guiParameterChanged(int32_t controlID, double actualValue)
Definition: pluginbase.h:275
uint32_t getVST3SampleAccuracyGranularity()
Description query: VST Sample Accurate Automation granularity.
Definition: pluginbase.h:576
bool hasSupportedInputChannelFormat(uint32_t channelFormat)
check to see if plugin support a given input channel format
Definition: pluginbase.cpp:519
Incoming data from a vector joystick.
Definition: pluginstructures.h:253
bool wantsVST3SampleAccurateAutomation()
Description query: VST Sample Accurate Automation.
Definition: pluginbase.h:569
const uint32_t getAAXProductID()
Description query: AAX Prod ID.
Definition: pluginbase.h:534
Information package about the plugin itself, consisting mainly of simple strings and ID values...
Definition: pluginstructures.h:933
std::map< uint32_t, PluginParameter * > pluginParameterControlIDMap
map version of parameter list
Definition: pluginbase.h:622
int getPIParamValueInt(int32_t controlID)
value-as-int
Definition: pluginbase.cpp:392
Definition: pluginstructures.h:343
bool wantsMIDI()
Description query: MIDI.
Definition: pluginbase.h:450
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:645
uint32_t getOutputChannelCount(uint32_t ioConfigIndex)
get the number of output channels for a configuration at a given index
Definition: pluginbase.cpp:568
bool updateOutBoundVariables()
copy newly updated metering variables into GUI parameters for display
Definition: pluginbase.cpp:202
bool hasSidechain
sidechain flag
Definition: pluginstructures.h:959
APISpecificInfo apiSpecificInfo
description strings, API specific
Definition: pluginbase.h:601
const char * getAUBundleName()
Description query: AU Bundle Name.
Definition: pluginbase.h:597
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:671
void initPluginParameterArray()
called at the end of the initialization phase, this function creates the various non map-versions of ...
Definition: pluginbase.cpp:789
virtual ~PluginBase()
PluginBase destructor.
Definition: pluginbase.cpp:41
Structure of a pair of channel format enumerators that set an input/output channel I/O capability...
Definition: pluginstructures.h:422
const uint32_t getAAXManufacturerID()
Description query: AAX Man ID.
Definition: pluginbase.h:527
void setPIParamValue(uint32_t _controlID, double _controlValue)
set a parameter&#39;s value with the actual value (as double)
Definition: pluginbase.cpp:583
PluginDescriptor pluginDescriptor
description strings
Definition: pluginbase.h:600
Identifiers, GUIDs and other strings and number id values, API specific.
Definition: pluginstructures.h:206
uint32_t getPIParamValueUInt(int32_t controlID)
value-as-uint
Definition: pluginbase.cpp:407
uint32_t aaxProductID
aax ID
Definition: pluginstructures.h:222
base class interface file for ASPiK pluginparameter object
float auxOutputFrame[MAX_CHANNEL_COUNT]
aux output array for frame processing
Definition: pluginbase.h:608
double tailTimeInMSec
tail time
Definition: pluginstructures.h:964
uint32_t addSupportedAuxIOCombination(ChannelIOConfig ioConfig)
add a new I/O configuration pair
Definition: pluginbase.cpp:491
double getPIParamValueDouble(int32_t controlID)
value-as-double
Definition: pluginbase.cpp:361
std::string vst3FUID
VST GUID.
Definition: pluginstructures.h:231
Information about auxilliary parameter details - purely customizeable. This uses the attributeValue u...
Definition: pluginstructures.h:688
PluginParameter ** pluginParameterArray
old-fashioned C-arrays of pointers for ultra-fast access for real-time audio processing ...
Definition: pluginbase.h:611
virtual bool processAudioFrame(ProcessFrameInfo &processFrameInfo)=0
channelFormat
Use this enum to identify plugin channel formats. Steinberg calls these "speaker arrangements".
Definition: pluginstructures.h:114
const char * getVST3BundleID()
Description query: VST3 Bundle ID.
Definition: pluginbase.h:583
size_t addPreset(PresetInfo *preset)
add a new preset
Definition: pluginbase.cpp:731
PluginParameter ** outboundPluginParameters
old-fashioned C-arrays of pointers for outbound (meter) parameters
Definition: pluginbase.h:615
const char * getPresetName(uint32_t index)
gets name as a const char* for connecting with all APIs at some level
Definition: pluginbase.cpp:715
double getSampleRate()
Description query: sample rate.
Definition: pluginbase.h:513
const char * getAAXBundleID()
Description query: AAX Bundle ID.
Definition: pluginbase.h:541
bool hasSidechain()
Description query: sidechain.
Definition: pluginbase.h:443
The PluginParameter object stores all of the data needed for any type of plugin parameter. It is a large object, but it is not complex as it really just stores LOTS of information about plugin parameters.
Definition: pluginparameter.h:51
const char * getVST3_FUID()
Description query: VST3 FUID.
Definition: pluginbase.h:562
const char * getAUBundleID()
Description query: AU Bundle ID.
Definition: pluginbase.h:590
std::string aaxBundleID
AAX bundle /* MacOS only: this MUST match the bundle identifier in your info.plist file */...
Definition: pluginstructures.h:224
float auxInputFrame[MAX_CHANNEL_COUNT]
aux input array for frame processing
Definition: pluginbase.h:607
std::string aaxEffectID
aax Effect ID
Definition: pluginstructures.h:223
std::vector< PluginParameter * > pluginParameters
vector version of parameter list
Definition: pluginbase.h:619
bool setPresetParameter(std::vector< PresetParameter > &presetParameters, uint32_t _controlID, double _controlValue)
set a new value for a preset
Definition: pluginbase.cpp:693
virtual bool postUpdatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo &paramInfo)=0
uint32_t outputChannelFormat
output format for this I/O pair
Definition: pluginstructures.h:434
bool updatePIParamBoundValue(uint32_t _controlID)
update a bound-variable with a parameter&#39;s control value; this is the essence of the variable binding...
Definition: pluginbase.cpp:615
bool wantsInfiniteTailVST3()
Description query: infinite tail (VST3 only)
Definition: pluginbase.h:478
double getProToolsGRValue()
pro tools GR meter is only ever observed to be single meter; this merges all meter values for meters ...
Definition: pluginbase.cpp:437
bool infiniteTailVST3
VST3 infinite tail flag.
Definition: pluginstructures.h:965
uint32_t aaxPluginCategoryCode
aax plugin category
Definition: pluginstructures.h:225
uint32_t getDefaultChannelIOConfigForChannelCount(uint32_t channelCount)
Definition: pluginstructures.h:974
PluginBase()
PluginBase constructor.
Definition: pluginbase.cpp:23
Custom interface to send the plugin shell a message from plugin core.
Definition: pluginstructures.h:1289
int32_t getChannelOutputFormat(uint32_t ioConfigIndex)
get I/O channel pair count
Definition: pluginbase.h:365
void removePreset(uint32_t index)
remove a preset - NOTE: does not delete object
Definition: pluginbase.cpp:742
bool compareSelectedString(int32_t controlID, const char *compareString)
helper function to compare a PluginParameter&#39;s value with a string version of it
Definition: pluginbase.cpp:853
PluginParameter * getPluginParameterByIndex(int32_t index)
get a parameter by index location in vector or array
Definition: pluginbase.h:305
PluginParameter ** smoothablePluginParameters
old-fashioned C-arrays of pointers for smoothable parameters
Definition: pluginbase.h:613
const char * getPluginName()
Description query: name.
Definition: pluginbase.h:485
uint32_t getNumSupportedIOCombinations()
get I/O channel pair count
Definition: pluginbase.h:347
const char * getVendorName()
Description query:vendor name.
Definition: pluginbase.h:499
std::string auBundleID
AU bundle ID /* MacOS only: this MUST match the bundle identifier in your info.plist file */...
Definition: pluginstructures.h:237
double setPIParamValueNormalized(uint32_t _controlID, double _normalizedValue, bool applyTaper=true)
set a parameter&#39;s value with the normalied value (as double)
Definition: pluginbase.cpp:599
bool hasProToolsGRMeters()
checks for at least one meter parameter that has the pro tools GR meter flag set
Definition: pluginbase.cpp:420
const char * getAAXEffectID()
Description query: AAX Effect ID.
Definition: pluginbase.h:548
Information about a MIDI event.
Definition: pluginstructures.h:449