ASPiK SDK
PluginCore Class Reference

The PluginCore object is the default PluginBase derived object for ASPiK projects. Note that you are fre to change the name of this object (as long as you change it in the compiler settings, etc...) More...

#include <plugincore.h>

Inheritance diagram for PluginCore:
PluginBase

Public Member Functions

 PluginCore ()
 PluginCore constructor is launching pad for object initialization. More...
 
virtual ~PluginCore ()
 
bool initPluginParameters ()
 create all of your plugin parameters here More...
 
virtual bool reset (ResetInfo &resetInfo)
 initialize object for a new run of audio; called just before audio streams More...
 
virtual bool preProcessAudioBuffers (ProcessBufferInfo &processInfo)
 do anything needed prior to arrival of audio buffers More...
 
virtual bool processAudioFrame (ProcessFrameInfo &processFrameInfo)
 frame-processing method More...
 
virtual bool postProcessAudioBuffers (ProcessBufferInfo &processInfo)
 do anything needed prior to arrival of audio buffers More...
 
virtual bool updatePluginParameter (int32_t controlID, double controlValue, ParameterUpdateInfo &paramInfo)
 update the PluginParameter's value based on GUI control, preset, or data smoothing (thread-safe) More...
 
virtual bool updatePluginParameterNormalized (int32_t controlID, double normalizedValue, ParameterUpdateInfo &paramInfo)
 update the PluginParameter's value based on normlaized GUI control, preset, or data smoothing (thread-safe) More...
 
virtual bool postUpdatePluginParameter (int32_t controlID, double controlValue, ParameterUpdateInfo &paramInfo)
 perform any operations after the plugin parameter has been updated; this is one paradigm for transferring control information into vital plugin variables or member objects. If you use this method you can decode the control ID and then do any cooking that is needed. NOTE: do not overwrite bound variables here - this is ONLY for any extra cooking that is required to convert the GUI data to meaninful coefficients or other specific modifiers. More...
 
virtual bool guiParameterChanged (int32_t controlID, double actualValue)
 has nothing to do with actual variable or updated variable (binding) More...
 
virtual bool processMessage (MessageInfo &messageInfo)
 For Custom View and Custom Sub-Controller Operations. More...
 
virtual bool processMIDIEvent (midiEvent &event)
 process a MIDI event More...
 
virtual bool setVectorJoystickParameters (const VectorJoystickData &vectorJoysickData)
 (for future use - NOT linked to RackAFX either!) More...
 
bool initPluginPresets ()
 use this method to add new presets to the list More...
 
bool initPluginDescriptors ()
 setup the plugin description strings, flags and codes; this is ordinarily done through the ASPiKreator or CMake More...
 
- Public Member Functions inherited from PluginBase
 PluginBase ()
 PluginBase constructor. More...
 
virtual ~PluginBase ()
 PluginBase destructor. More...
 
void syncInBoundVariables ()
 initialize object for a new run of audio; called just before audio streams More...
 
virtual bool processAudioBuffers (ProcessBufferInfo &processInfo)
 THE buffer processing function. More...
 
bool updateOutBoundVariables ()
 copy newly updated metering variables into GUI parameters for display More...
 
void doSampleAccurateParameterUpdates ()
 combines parameter smoothing and VST3 sample accurate updates More...
 
int32_t addPluginParameter (PluginParameter *piParam, double sampleRate=44100)
 adds a new plugin parameter to the parameter map More...
 
void setParamAuxAttribute (uint32_t controlID, const AuxParameterAttribute &auxAttribute)
 adds an auxilliary attribute to the plugin parameter; you can have as many auxilliary attributes as you like for each parameter. More...
 
size_t getPluginParameterCount ()
 
PluginParametergetPluginParameterByIndex (int32_t index)
 get a parameter by index location in vector or array More...
 
PluginParametergetPluginParameterByControlID (int32_t controlID)
 get a parameter by control ID - uses map (slowest) More...
 
PluginParametergetNextParameterOfType (int32_t &startIndex, controlVariableType controlType)
 get a parameter by type More...
 
double getPIParamValueDouble (int32_t controlID)
 value-as-double More...
 
float getPIParamValueFloat (int32_t controlID)
 value-as-float More...
 
int getPIParamValueInt (int32_t controlID)
 value-as-int More...
 
uint32_t getPIParamValueUInt (int32_t controlID)
 value-as-uint More...
 
bool hasProToolsGRMeters ()
 checks for at least one meter parameter that has the pro tools GR meter flag set More...
 
double getProToolsGRValue ()
 pro tools GR meter is only ever observed to be single meter; this merges all meter values for meters designated as Pro Tools meter More...
 
uint32_t addSupportedIOCombination (ChannelIOConfig ioConfig)
 add a new I/O configuration pair More...
 
uint32_t addSupportedAuxIOCombination (ChannelIOConfig ioConfig)
 add a new I/O configuration pair More...
 
uint32_t getNumSupportedIOCombinations ()
 get I/O channel pair count More...
 
bool hasSupportedInputChannelFormat (uint32_t channelFormat)
 check to see if plugin support a given input channel format More...
 
bool hasSupportedOutputChannelFormat (uint32_t channelFormat)
 check to see if plugin support a given output channel format More...
 
int32_t getChannelInputFormat (uint32_t ioConfigIndex)
 get input cj More...
 
int32_t getChannelOutputFormat (uint32_t ioConfigIndex)
 get I/O channel pair count More...
 
uint32_t getInputChannelCount (uint32_t ioConfigIndex)
 get the number of input channels for a configuration at a given index More...
 
uint32_t getOutputChannelCount (uint32_t ioConfigIndex)
 get the number of output channels for a configuration at a given index More...
 
uint32_t getDefaultChannelIOConfigForChannelCount (uint32_t channelCount)
 get the configuration (e.g. kCFStereo) for a given channel count; mainly for AU that does not discriminate between formats with same channel counts (e.g. Sony 7.1 vs DTS 7.1 which have same channel count) More...
 
void setPIParamValue (uint32_t _controlID, double _controlValue)
 set a parameter's value with the actual value (as double) More...
 
double setPIParamValueNormalized (uint32_t _controlID, double _normalizedValue, bool applyTaper=true)
 set a parameter's value with the normalied value (as double) More...
 
bool updatePIParamBoundValue (uint32_t _controlID)
 update a bound-variable with a parameter's control value; this is the essence of the variable binding operation More...
 
void clearUpdateGUIParameters (std::vector< GUIParameter *> &guiParameters)
 delete GUI update structures in a list More...
 
std::vector< PluginParameter * > * makePluginParameterVectorCopy (bool disableSmoothing=true)
 copies parameters into a new list; used to initialize the GUI - note that this makes true, disconnected copies More...
 
bool initPresetParameters (std::vector< PresetParameter > &presetParameters, bool disableSmoothing=true)
 creates the preset parameter ID/Value pair PresetParameter objects and adds them to supplied list More...
 
bool setPresetParameter (std::vector< PresetParameter > &presetParameters, uint32_t _controlID, double _controlValue)
 set a new value for a preset More...
 
void setPluginHostConnector (IPluginHostConnector *_pluginHostConnector)
 store the plugin host interface pointer: this pointer will never go out of scope or be invalid once stored! More...
 
size_t getPresetCount ()
 get number of stored presets More...
 
const char * getPresetName (uint32_t index)
 gets name as a const char* for connecting with all APIs at some level More...
 
size_t addPreset (PresetInfo *preset)
 add a new preset More...
 
void removePreset (uint32_t index)
 remove a preset - NOTE: does not delete object More...
 
void removeAllPresets ()
 remove all presets - NOTE: does not delete objects More...
 
PresetInfogetPreset (uint32_t index)
 get a preset More...
 
void initPluginParameterArray ()
 called at the end of the initialization phase, this function creates the various non map-versions of the parameter lists
and initializes the parameters; this is the final step of construction More...
 
bool compareSelectedString (int32_t controlID, const char *compareString)
 helper function to compare a PluginParameter's value with a string version of it More...
 
bool hasSidechain ()
 Description query: sidechain. More...
 
bool wantsMIDI ()
 Description query: MIDI. More...
 
bool hasCustomGUI ()
 Description query: has GUI. More...
 
double getLatencyInSamples ()
 Description query: latency. More...
 
double getTailTimeInMSec ()
 Description query: tail time. More...
 
bool wantsInfiniteTailVST3 ()
 Description query: infinite tail (VST3 only) More...
 
const char * getPluginName ()
 Description query: name. More...
 
const char * getShortPluginName ()
 Description query: short name (AAX) More...
 
const char * getVendorName ()
 Description query:vendor name. More...
 
uint32_t getPluginType ()
 Description query: plugin type. More...
 
double getSampleRate ()
 Description query: sample rate. More...
 
int getFourCharCode ()
 Description query: 4-char code. More...
 
const uint32_t getAAXManufacturerID ()
 Description query: AAX Man ID. More...
 
const uint32_t getAAXProductID ()
 Description query: AAX Prod ID. More...
 
const char * getAAXBundleID ()
 Description query: AAX Bundle ID. More...
 
const char * getAAXEffectID ()
 Description query: AAX Effect ID. More...
 
uint32_t getAAXPluginCategory ()
 Description query: AAX Category. More...
 
const char * getVST3_FUID ()
 Description query: VST3 FUID. More...
 
bool wantsVST3SampleAccurateAutomation ()
 Description query: VST Sample Accurate Automation. More...
 
uint32_t getVST3SampleAccuracyGranularity ()
 Description query: VST Sample Accurate Automation granularity. More...
 
const char * getVST3BundleID ()
 Description query: VST3 Bundle ID. More...
 
const char * getAUBundleID ()
 Description query: AU Bundle ID. More...
 
const char * getAUBundleName ()
 Description query: AU Bundle Name. More...
 

Static Public Member Functions

static const char * getPluginName ()
 
static const char * getShortPluginName ()
 
static const char * getVendorName ()
 
static const char * getVendorURL ()
 
static const char * getVendorEmail ()
 
static const char * getAUCocoaViewFactoryName ()
 
static pluginType getPluginType ()
 
static const char * getVSTFUID ()
 
static int32_t getFourCharCode ()
 

Additional Inherited Members

- Protected Types inherited from PluginBase
typedef std::map< uint32_t, PluginParameter * > pluginParameterControlIDMap
 map version of parameter list
 
- Protected Attributes inherited from PluginBase
PluginDescriptor pluginDescriptor
 description strings
 
APISpecificInfo apiSpecificInfo
 description strings, API specific
 
AudioProcDescriptor audioProcDescriptor
 current audio processing description
 
float inputFrame [MAX_CHANNEL_COUNT]
 input array for frame processing
 
float outputFrame [MAX_CHANNEL_COUNT]
 output array for frame processing
 
float auxInputFrame [MAX_CHANNEL_COUNT]
 aux input array for frame processing
 
float auxOutputFrame [MAX_CHANNEL_COUNT]
 aux output array for frame processing
 
PluginParameter ** pluginParameterArray = nullptr
 old-fashioned C-arrays of pointers for ultra-fast access for real-time audio processing
 
uint32_t numPluginParameters = 0
 total number of parameters
 
PluginParameter ** smoothablePluginParameters = nullptr
 old-fashioned C-arrays of pointers for smoothable parameters
 
uint32_t numSmoothablePluginParameters = 0
 number of smoothable parameters only
 
PluginParameter ** outboundPluginParameters = nullptr
 old-fashioned C-arrays of pointers for outbound (meter) parameters
 
uint32_t numOutboundPluginParameters = 0
 total number of outbound (meter) parameters
 
std::vector< PluginParameter * > pluginParameters
 vector version of parameter list
 
pluginParameterControlIDMap pluginParameterMap
 member map of parameter list
 
IPluginHostConnectorpluginHostConnector = nullptr
 created and destroyed on host
 
std::vector< PresetInfo * > presets
 preset list
 

Detailed Description

The PluginCore object is the default PluginBase derived object for ASPiK projects. Note that you are fre to change the name of this object (as long as you change it in the compiler settings, etc...)

PluginCore Operations:

  • overrides the main processing functions from the base class
  • performs reset operation on sub-modules
  • processes audio
  • processes messages for custom views
  • performs pre and post processing functions on parameters and audio (if needed)
Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included in Designing Audio Effects Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2018 / 09 / 7

Constructor & Destructor Documentation

◆ PluginCore()

PluginCore::PluginCore ( )

PluginCore constructor is launching pad for object initialization.

Operations:

  • initialize the plugin description (strings, codes, numbers, see initPluginDescriptors())
  • setup the plugin's audio I/O channel support
  • create the PluginParameter objects that represent the plugin parameters (see FX book if needed)
  • create the presets

◆ ~PluginCore()

virtual PluginCore::~PluginCore ( )
inlinevirtual

Destructor: empty in default version

Member Function Documentation

◆ getAUCocoaViewFactoryName()

const char * PluginCore::getAUCocoaViewFactoryName ( )
static

static description: Cocoa View Factory Name

Returns
Cocoa View Factory Name as a const char*

◆ getFourCharCode()

int32_t PluginCore::getFourCharCode ( )
static

static description: 4-char code

Returns
4-char code as int

◆ getPluginName()

const char * PluginCore::getPluginName ( )
static

static description: name

Returns
name as a const char*

◆ getPluginType()

pluginType PluginCore::getPluginType ( )
static

static description: plugin type

Returns
type (FX or Synth)

◆ getShortPluginName()

const char * PluginCore::getShortPluginName ( )
static

static description: short name

Returns
short name as a const char*

◆ getVendorEmail()

const char * PluginCore::getVendorEmail ( )
static

static description: email

Returns
email address as a const char*

◆ getVendorName()

const char * PluginCore::getVendorName ( )
static

static description: vendor name

Returns
vendor name as a const char*

◆ getVendorURL()

const char * PluginCore::getVendorURL ( )
static

static description: URL

Returns
URL as a const char*

◆ getVSTFUID()

const char * PluginCore::getVSTFUID ( )
static

static description: VST3 GUID

Returns
VST3 GUID as a const char*

◆ guiParameterChanged()

bool PluginCore::guiParameterChanged ( int32_t  controlID,
double  actualValue 
)
virtual

has nothing to do with actual variable or updated variable (binding)

this is ony called when the user makes a GUI control change

CAUTION:

  • DO NOT update underlying variables here - this is only for sending GUI updates or letting you know that a parameter was changed; it should not change the state of your plugin.

WARNING:

  • THIS IS NOT THE PREFERRED WAY TO LINK OR COMBINE CONTROLS TOGETHER. THE PROPER METHOD IS TO USE A CUSTOM SUB-CONTROLLER THAT IS PART OF THE GUI OBJECT AND CODE. SEE http://www.willpirkle.com for more information
Parameters
controlIDthe control ID value of the parameter being updated
actualValuethe new control value
Returns
true if operation succeeds, false otherwise

not handled

Reimplemented from PluginBase.

◆ initPluginDescriptors()

bool PluginCore::initPluginDescriptors ( )

setup the plugin description strings, flags and codes; this is ordinarily done through the ASPiKreator or CMake

initalizer

Returns
true if operation succeeds, false otherwise

◆ initPluginParameters()

bool PluginCore::initPluginParameters ( )

create all of your plugin parameters here

this is the creation function for all plugin parameters

Returns
true if parameters were created, false if they already existed

◆ initPluginPresets()

bool PluginCore::initPluginPresets ( )

use this method to add new presets to the list

create the presets

NOTES:

  • see the SDK for examples of use
  • for non RackAFX users that have large paramter counts, there is a secret GUI control you can enable to write C++ code into text files, one per preset. See the SDK or http://www.willpirkle.com for details
Returns
true if operation succeeds, false otherwise

◆ postProcessAudioBuffers()

bool PluginCore::postProcessAudioBuffers ( ProcessBufferInfo processInfo)
virtual

do anything needed prior to arrival of audio buffers

preProcess: do any post-buffer processing required; default operation is to send metering data to GUI

Operation:

  • updateOutBoundVariables sends metering data to the GUI meters
Parameters
processInfostructure of information about buffer processing
Returns
true if operation succeeds, false otherwise

Implements PluginBase.

◆ postUpdatePluginParameter()

bool PluginCore::postUpdatePluginParameter ( int32_t  controlID,
double  controlValue,
ParameterUpdateInfo paramInfo 
)
virtual

perform any operations after the plugin parameter has been updated; this is one paradigm for transferring control information into vital plugin variables or member objects. If you use this method you can decode the control ID and then do any cooking that is needed. NOTE: do not overwrite bound variables here - this is ONLY for any extra cooking that is required to convert the GUI data to meaninful coefficients or other specific modifiers.

this can be called: 1) after bound variable has been updated or 2) after smoothing occurs

Parameters
controlIDthe control ID value of the parameter being updated
controlValuethe new control value
paramInfostructure of information about why this value is being udpated (e.g as a result of a preset being loaded vs. the top of a buffer process cycle)
Returns
true if operation succeeds, false otherwise

Implements PluginBase.

◆ preProcessAudioBuffers()

bool PluginCore::preProcessAudioBuffers ( ProcessBufferInfo processInfo)
virtual

do anything needed prior to arrival of audio buffers

Operation:

  • syncInBoundVariables when preProcessAudioBuffers is called, it is guaranteed that all GUI control change information has been applied to plugin parameters; this binds parameter changes to your underlying variables
  • NOTE: postUpdatePluginParameter( ) will be called for all bound variables that are acutally updated; if you need to process them individually, do so in that function
  • use this function to bulk-transfer the bound variable data into your plugin's member object variables
Parameters
processInfostructure of information about buffer processing
Returns
true if operation succeeds, false otherwise

Implements PluginBase.

◆ processAudioFrame()

bool PluginCore::processAudioFrame ( ProcessFrameInfo processFrameInfo)
virtual

frame-processing method

process frames of data

Operation:

  • decode the plugin type - for synth plugins, fill in the rendering code; for FX plugins, delete the if(synth) portion and add your processing code
  • note that MIDI events are fired for each sample interval so that MIDI is tightly sunk with audio
  • doSampleAccurateParameterUpdates will perform per-sample interval smoothing
Parameters
processFrameInfostructure of information about frame processing
Returns
true if operation succeeds, false otherwise

processed

processed

processed

processed

NOT processed

Implements PluginBase.

◆ processMessage()

bool PluginCore::processMessage ( MessageInfo messageInfo)
virtual

For Custom View and Custom Sub-Controller Operations.

processMessage: messaging system; currently used for custom/special GUI operations

NOTES:

  • this is for advanced users only to implement custom view and custom sub-controllers
  • see the SDK for examples of use
Parameters
messageInfoa structure containing information about the incoming message
Returns
true if operation succeeds, false otherwise

not handled

Reimplemented from PluginBase.

◆ processMIDIEvent()

bool PluginCore::processMIDIEvent ( midiEvent event)
virtual

process a MIDI event

processMIDIEvent: MIDI event processing

NOTES:

  • MIDI events are 100% sample accurate; this function will be called repeatedly for every MIDI message
  • see the SDK for examples of use
Parameters
eventa structure containing the MIDI event data
Returns
true if operation succeeds, false otherwise

Reimplemented from PluginBase.

◆ reset()

bool PluginCore::reset ( ResetInfo resetInfo)
virtual

initialize object for a new run of audio; called just before audio streams

called when plugin is loaded, a new audio file is playing or sample rate changes

Operation:

  • store sample rate and bit depth on audioProcDescriptor - this information is globally available to all core functions
  • reset your member objects here
Parameters
resetInfostructure of information about current audio format
Returns
true if operation succeeds, false otherwise

Reimplemented from PluginBase.

◆ setVectorJoystickParameters()

bool PluginCore::setVectorJoystickParameters ( const VectorJoystickData vectorJoysickData)
virtual

(for future use - NOT linked to RackAFX either!)

specialized joystick servicing (currently not used)

NOTES:

  • MIDI events are 100% sample accurate; this function will be called repeatedly for every MIDI message
  • see the SDK for examples of use
Parameters
vectorJoysickDataa structure containing joystick data
Returns
true if operation succeeds, false otherwise

Reimplemented from PluginBase.

◆ updatePluginParameter()

bool PluginCore::updatePluginParameter ( int32_t  controlID,
double  controlValue,
ParameterUpdateInfo paramInfo 
)
virtual

update the PluginParameter's value based on GUI control, preset, or data smoothing (thread-safe)

called by host plugin at top of buffer proccess; this alters parameters prior to variable binding operation

Operation:

  • update the parameter's value (with smoothing this initiates another smoothing process)
  • call postUpdatePluginParameter to do any further processing
Parameters
controlIDthe control ID value of the parameter being updated
controlValuethe new control value
paramInfostructure of information about why this value is being udpated (e.g as a result of a preset being loaded vs. the top of a buffer process cycle)
Returns
true if operation succeeds, false otherwise

handled

Implements PluginBase.

◆ updatePluginParameterNormalized()

bool PluginCore::updatePluginParameterNormalized ( int32_t  controlID,
double  normalizedValue,
ParameterUpdateInfo paramInfo 
)
virtual

update the PluginParameter's value based on normlaized GUI control, preset, or data smoothing (thread-safe)

called by host plugin at top of buffer proccess; this alters parameters prior to variable binding operation

Operation:

  • update the parameter's value (with smoothing this initiates another smoothing process)
  • call postUpdatePluginParameter to do any further processing
Parameters
controlIDthe control ID value of the parameter being updated
normalizedValuethe new control value in normalized form
paramInfostructure of information about why this value is being udpated (e.g as a result of a preset being loaded vs. the top of a buffer process cycle)
Returns
true if operation succeeds, false otherwise

handled

Implements PluginBase.


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