22#ifndef AAX_PARAMETERS_H
23#define AAX_PARAMETERS_H
25#include "AAX_CEffectParameters.h"
26#pragma warning(disable : 4985)
28#include "AAX_CAtomicQueue.h"
29#include "AAX_IParameter.h"
30#include "AAX_IMIDINode.h"
31#include "AAX_IString.h"
32#include "AAX_IEffectDescriptor.h"
33#include "AAX_IComponentDescriptor.h"
34#include "AAX_IPropertyMap.h"
46#include <CoreFoundation/CoreFoundation.h>
120 float** inputBufferPtrs;
121 float** outputBufferPtrs;
122 int32_t* bufferLength;
128 int32_t* sidechainChannel;
132 AAX_IMIDINode* midiInputNode;
133 AAX_IMIDINode* midiTransportNode;
136 int64_t* currentStateNum;
140#define kMaxAdditionalMIDINodes 15
141#define kMaxAuxOutputStems 32
153#define kSynchronizedParameterQueueSize 64
162typedef std::pair<AAX_CParamID const, const AAX_IParameterValue*>
TParamValPair;
183 static AAX_CEffectParameters* AAX_CALLBACK
Create();
194 virtual AAX_Result
ResetFieldData (AAX_CFieldIndex inFieldIndex,
void * oData, uint32_t iDataSize)
const AAX_OVERRIDE;
203 static AAX_Result
StaticDescribe(AAX_IComponentDescriptor& outDesc);
206 virtual AAX_Result
GetCustomData(AAX_CTypeID iDataBlockID, uint32_t iDataSize,
void* oData, uint32_t* oDataWritten)
const AAX_OVERRIDE;
252 AAX_ASSERT(sCap > mSize);
255 mElem[mSize++] = inElem;
261 AAX_ASSERT(sCap >= mSize + inOther.mSize);
262 for (int32_t i = 0; i < inOther.mSize; ++i)
264 Add(inOther.mElem[i]);
268 void Append(
const std::list<TParamValPair*>& inOther)
270 AAX_ASSERT(sCap >= mSize + (int64_t)inOther.size());
271 for (std::list<TParamValPair*>::const_iterator iter = inOther.begin(); iter != inOther.end(); ++iter)
277 void Merge(AAX_IPointerQueue<TParamValPair>& inOther)
282 if (NULL == val) {
break; }
289 std::memset(mElem, 0x0,
sizeof(mElem));
298 typedef std::set<const AAX_IParameter*> TParamSet;
299 typedef std::pair<int64_t, std::list<TParamValPair*> > TNumberedParamStateList;
300 typedef AAX_CAtomicQueue<TNumberedParamStateList, 256> TNumberedStateListQueue;
302 typedef AAX_CAtomicQueue<const TParamValPair, 16*kSynchronizedParameterQueueSize> TParamValPairQueue;
305 void DeleteUsedParameterChanges();
306 std::set<std::string> mSynchronizedParameters;
307 int64_t mStateCounter;
308 TParamSet mDirtyParameters;
309 TNumberedStateListQueue mQueuedParameterChanges;
310 TNumberedStateListQueue mFinishedParameterChanges;
311 TParamValPairQueue mFinishedParameterValues;
312 int64_t mCurrentStateNum;
315 bool softBypass =
false;
322 AAX_CParameterManager mMeterParameterManager;
324 AAX_Result SetMeterParameterNormalizedValue (AAX_CParamID iParameterID,
double aValue)
326 AAX_IParameter* parameter = mMeterParameterManager.GetParameterByID(iParameterID);
328 return AAX_ERROR_INVALID_PARAMETER_ID;
330 parameter->SetNormalizedValue ( aValue );
335 uint32_t getChannelFormatForAAXStemFormat(AAX_EStemFormat format)
339 case AAX_eStemFormat_None: {
342 case AAX_eStemFormat_Mono: {
345 case AAX_eStemFormat_Stereo: {
348 case AAX_eStemFormat_LCR: {
351 case AAX_eStemFormat_LCRS: {
354 case AAX_eStemFormat_Quad: {
357 case AAX_eStemFormat_5_0: {
360 case AAX_eStemFormat_5_1: {
363 case AAX_eStemFormat_6_0: {
366 case AAX_eStemFormat_6_1: {
369 case AAX_eStemFormat_7_0_SDDS: {
372 case AAX_eStemFormat_7_0_DTS: {
375 case AAX_eStemFormat_7_1_SDDS: {
378 case AAX_eStemFormat_7_1_DTS: {
381 case AAX_eStemFormat_7_1_2: {
382 return kCF7p1Proximity; }
390#if defined _WINDOWS || defined _WINDLL
391 wchar_t* convertCharArrayToLPCWSTR(
const char* charArray)
393 wchar_t* wString =
new wchar_t[4096];
394 MultiByteToWideChar(CP_ACP, 0, charArray, -1, wString, 4096);
399 char* getMyDLLDirectory(
const char* dllName)
401 wchar_t* cPluginName = convertCharArrayToLPCWSTR(dllName);
402 HMODULE hmodule = GetModuleHandle(cPluginName);
405 memset(&dir[0], 0, MAX_PATH*
sizeof(TCHAR));
406 dir[MAX_PATH-1] =
'\0';
409 GetModuleFileName(hmodule, &dir[0], MAX_PATH);
414 std::wstring backslash(L
"\\");
415 std::wstring strPlugin(cPluginName);
416 std::wstring strDir(&dir[0]);
417 int pathLen = strDir.size() - strPlugin.size() - backslash.size();
420 std::wstring strPath = strDir.substr(0, pathLen);
421 char* str =
new char[MAX_PATH];
422 sprintf(str,
"%ls", strPath.c_str());
423 delete[] cPluginName;
431 char* getMyComponentDirectory(CFStringRef bundleID)
433 if (bundleID !=
nullptr)
435 CFBundleRef helixBundle = CFBundleGetBundleWithIdentifier( bundleID );
436 if(helixBundle !=
nullptr)
438 CFURLRef bundleURL = CFBundleCopyBundleURL ( helixBundle );
439 if(bundleURL !=
nullptr)
441 CFURLRef componentFolderPathURL = CFURLCreateCopyDeletingLastPathComponent(
nullptr, bundleURL);
443 CFStringRef myComponentPath = CFURLCopyFileSystemPath(componentFolderPathURL, kCFURLPOSIXPathStyle);
444 CFRelease(componentFolderPathURL);
446 if(myComponentPath !=
nullptr)
448 int nSize = CFStringGetLength(myComponentPath);
449 char* path =
new char[nSize+1];
450 memset(path, 0, (nSize+1)*
sizeof(
char));
452 bool success = CFStringGetCString(myComponentPath, path, nSize+1, kCFStringEncodingASCII);
453 CFRelease(myComponentPath);
455 if(success)
return path;
458 CFRelease(bundleURL);
492 switch(hostMessageInfo.hostMessage)
498 for (uint32_t i = 0; i < guiUpdateData.
guiParameters.size(); i++)
502 std::stringstream str;
504 AAX_IParameter* oParameter;
505 AAX_Result result =
aaxParameters->GetParameter(str.str().c_str(), &oParameter);
506 if(AAX_SUCCESS == result)
508 oParameter->SetValueWithDouble(guiParam.
actualValue);
513 for (uint32_t i = 0; i < guiUpdateData.
guiParameters.size(); i++)
612 for (customViewControllerMap::const_iterator it = customViewMap.begin(), end = customViewMap.end(); it != end; ++it)
630 std::stringstream str;
631 str << controlID + 1;
634 if(AAX_SUCCESS == result)
644 std::stringstream str;
645 str << controlID + 1;
646 aaxParameters->SetParameterNormalizedValue(str.str().c_str(), value);
654 std::stringstream str;
665 std::stringstream str;
689 MessageInfo info(PLUGINGUI_REGISTER_SUBCONTROLLER);
707 MessageInfo info(PLUGINGUI_DE_REGISTER_SUBCONTROLLER);
724 customViewControllerMap::const_iterator it = customViewMap.find(customViewName);
725 if (it != customViewMap.end())
733 customViewMap.insert(std::make_pair(customViewName, pCVC));
755 MessageInfo info(PLUGINGUI_DE_REGISTER_CUSTOMVIEW);
779 for (customViewControllerMap::const_iterator it = customViewMap.begin(), end = customViewMap.end(); it != end; ++it)
781 it->second->clearCustomViewPtr();
785 it->second->clearCustomViewPtr();
824 for (customViewControllerMap::const_iterator it = customViewMap.begin(), end = customViewMap.end(); it != end; ++it)
826 if (it->second->getCustomViewPtr() == customViewConnector)
839 if (it->second->getCustomViewPtr() == customViewConnector)
877 void setMIDIpackets(
const AAX_CMidiPacket*& _ioPacketPtr, uint32_t& _midiBuffersize)
895 const uint8_t uMessage = (
ioPacketPtr->mData[0] & 0xF0);
896 const uint8_t uChannel = (
ioPacketPtr->mData[0] & 0x0F);
900 event.midiChannel = (
unsigned int)uChannel;
901 event.midiData1 = (
unsigned int)
ioPacketPtr->mData[1];
903 event.midiSampleOffset = sampleOffset;
const unsigned int meterTapCount
number of gr meters (we've only ever seen one on any AVID surface/SW)
Definition: AAXPluginParameters.h:59
const AAX_CTypeID PLUGIN_CUSTOMDATA_ID
custom data parameter number (we only need one)
Definition: AAXPluginParameters.h:55
const AAX_CTypeID GR_MeterID
pro tools gr meter id
Definition: AAXPluginParameters.h:58
The AAXMIDIEventQueue interface queues incoming MIDI messages and blasts them out during the buffer p...
Definition: AAXPluginParameters.h:864
virtual bool fireMidiEvents(unsigned int sampleOffset)
Definition: AAXPluginParameters.h:891
AAXMIDIEventQueue(PluginCore *_pluginCore)
Definition: AAXPluginParameters.h:867
PluginCore * pluginCore
core
Definition: AAXPluginParameters.h:916
const AAX_CMidiPacket * ioPacketPtr
array of packets
Definition: AAXPluginParameters.h:917
void setMIDIpackets(const AAX_CMidiPacket *&_ioPacketPtr, uint32_t &_midiBuffersize)
Definition: AAXPluginParameters.h:877
virtual unsigned int getEventCount()
Definition: AAXPluginParameters.h:885
uint32_t midiBuffersize
midi buffer size for each bunch of packets
Definition: AAXPluginParameters.h:918
The AAXPluginParameters object implements the monolithic parameters AAX plugin programming paradigm w...
Definition: AAXPluginParameters.h:177
static AAX_CEffectParameters *AAX_CALLBACK Create()
creation mechanism for this object
Definition: AAXPluginParameters.cpp:59
virtual ~AAXPluginParameters()
object destructor; this destroys the ASPiK core and all of its required interfaces.
Definition: AAXPluginParameters.cpp:138
virtual AAX_Result UpdateParameterNormalizedValue(AAX_CParamID iParameterID, double iValue, AAX_EUpdateSource iSource)
called when a parameter needs to be updated (aka it is "dirty") as part of the AAX monolithic paramet...
Definition: AAXPluginParameters.cpp:763
void ProcessAudio(AAXAlgorithm *ioRenderInfo, const TParamValPair *inSynchronizedParamValues[], int32_t inNumSynchronizedParamValues)
audio processing function; note that ALL algorithms point to this function so we have to decode chann...
Definition: AAXPluginParameters.cpp:478
void AddSynchronizedParameter(const AAX_IParameter &inParameter)
called to add parameters to the synchronized list; this is only called once during EffectInit( ) as p...
Definition: AAXPluginParameters.cpp:742
void UpdatePluginParameters(const TParamValPair *inSynchronizedParamValues[], int32_t inNumSynchronizedParamValues)
called once per buffer process operation to update any parameters that changed during the buffer fill
Definition: AAXPluginParameters.cpp:401
void updateHostInfo(AAXAlgorithm *ioRenderInfo, HostInfo *hostInfo)
called once per buffer process operation to set the host information structure for the core
Definition: AAXPluginParameters.cpp:434
virtual AAX_Result TimerWakeup() AAX_OVERRIDE
AAX Override.
Definition: AAXPluginParameters.cpp:906
virtual AAX_Result EffectInit() AAX_OVERRIDE
AAX Override.
Definition: AAXPluginParameters.cpp:185
virtual AAX_Result GenerateCoefficients() AAX_OVERRIDE
AAX Override.
Definition: AAXPluginParameters.cpp:696
virtual AAX_Result GetCustomData(AAX_CTypeID iDataBlockID, uint32_t iDataSize, void *oData, uint32_t *oDataWritten) const AAX_OVERRIDE
note the data that is transferred to GUI; the core is ONLY used for initialization and then it is unu...
Definition: AAXPluginParameters.cpp:159
AAX_Result GetParameterNormalizedValue(AAX_CParamID iParameterID, double *oValuePtr) const AAX_OVERRIDE
allows threadsafe getting of parameters for GUI; modified to differentiate beteen meters to prevent a...
Definition: AAXPluginParameters.cpp:924
static void AAX_CALLBACK StaticRenderAudio(AAXAlgorithm *const inInstancesBegin[], const void *inInstancesEnd)
static callback function that exists as an object member and is part of the monolithic programming pa...
Definition: AAXPluginParameters.cpp:597
AAXPluginParameters()
object constructor; this creates the ASPiK core and all of its required interfaces.
Definition: AAXPluginParameters.cpp:75
void updateOutboundAAXParameters()
threadsafe update of outbound parameters (meter variables) for GUI.
Definition: AAXPluginParameters.cpp:959
virtual AAX_Result ResetFieldData(AAX_CFieldIndex inFieldIndex, void *oData, uint32_t iDataSize) const AAX_OVERRIDE
AAX Override.
Definition: AAXPluginParameters.cpp:797
static AAX_Result StaticDescribe(AAX_IComponentDescriptor &outDesc)
static describe function that exists as an object member and is part of the monolithic programming pa...
Definition: AAXPluginParameters.cpp:635
The CustomViewController is part of the safe ICustomView feature in ASPiK. The CustomViewController m...
Definition: AAXPluginParameters.h:540
virtual void pushDataValue(double data)
Definition: AAXPluginParameters.h:554
const ICustomView * getCustomViewPtr()
Definition: AAXPluginParameters.h:571
void setCustomViewPtr(ICustomView *_customViewIF)
Definition: AAXPluginParameters.h:568
CustomViewController(ICustomView *_customViewIF)
Definition: AAXPluginParameters.h:543
virtual void sendMessage(void *data)
Definition: AAXPluginParameters.h:561
virtual void updateView()
Definition: AAXPluginParameters.h:547
void clearCustomViewPtr()
Definition: AAXPluginParameters.h:574
The GUIPluginConnector interface creates a safe message mechanism for the GUI to issue requests to th...
Definition: AAXPluginParameters.h:600
virtual bool deRegisterCustomView(ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:747
std::map< std::string, CustomViewController * > customViewControllerMap
map of custom view controllers
Definition: AAXPluginParameters.h:818
virtual void beginParameterChangeGesture(int controlTag)
Definition: AAXPluginParameters.h:650
AAXPluginParameters * aaxParameters
the parent object
Definition: AAXPluginParameters.h:814
virtual bool checkNonBoundValueChange(int tag, float normalizedValue)
Definition: AAXPluginParameters.h:801
virtual bool registerSubcontroller(std::string subcontrollerName, ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:672
GUIPluginConnector(AAXPluginParameters *_aaxParameters, PluginCore *_pluginCore)
Definition: AAXPluginParameters.h:603
virtual double getNormalizedPluginParameter(int32_t controlID)
Definition: AAXPluginParameters.h:626
virtual bool deRregisterSubcontroller(ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:700
virtual bool guiWillClose()
Definition: AAXPluginParameters.h:775
virtual void parameterChanged(int32_t controlID, double actualValue, double)
Definition: AAXPluginParameters.h:619
virtual bool guiTimerPing()
Definition: AAXPluginParameters.h:793
CustomViewController * getCustomViewController(ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:822
virtual ~GUIPluginConnector()
Definition: AAXPluginParameters.h:606
virtual void setNormalizedPluginParameter(int32_t controlID, double value)
Definition: AAXPluginParameters.h:641
customViewControllerMap customSubControllerMap
map of custom sub-controllers
Definition: AAXPluginParameters.h:833
CustomViewController * getCustomSubController(ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:835
virtual bool guiDidOpen()
Definition: AAXPluginParameters.h:767
PluginCore * pluginCore
the core object
Definition: AAXPluginParameters.h:812
virtual void endParameterChangeGesture(int controlTag)
Definition: AAXPluginParameters.h:661
virtual bool registerCustomView(std::string customViewName, ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:719
Custom View interface to allow plugin core to create safe communication channels with GUI custom view...
Definition: pluginstructures.h:1462
virtual void updateView()=0
virtual void pushDataValue(double data)
Definition: pluginstructures.h:1472
virtual void sendMessage(void *data)
Definition: pluginstructures.h:1482
Custom interface so that GUI can pass information to plugin shell in a thread-safe manner.
Definition: pluginstructures.h:1540
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 PluginCore object is the default PluginBase derived object for ASPiK projects....
Definition: plugincore.h:44
virtual bool guiParameterChanged(int32_t controlID, double actualValue)
has nothing to do with actual variable or updated variable (binding)
Definition: plugincore.cpp:517
virtual bool processMIDIEvent(midiEvent &event)
process a MIDI event
Definition: plugincore.cpp:606
virtual bool processMessage(MessageInfo &messageInfo)
For Custom View and Custom Sub-Controller Operations.
Definition: plugincore.cpp:546
The PluginHostConnector implements the IPluginHostConnector interface for the plugin shell object....
Definition: AAXPluginParameters.h:480
virtual void sendHostMessage(const HostMessageInfo &hostMessageInfo)
process a message; by default it processes sendGUIUpdate to safely send a parameter change event but ...
Definition: AAXPluginParameters.h:490
AAX_IEffectParameters * aaxParameters
parent parameters; lifelong existence
Definition: AAXPluginParameters.h:524
interface file for ASPiK custom control objects (knobs, buttons, meters, etc...)
#define kSynchronizedParameterQueueSize
This is the maximum size of the plugin-core's parameter list; make sure to adjust itg if your core ne...
Definition: AAXPluginParameters.h:153
std::pair< AAX_CParamID const, const AAX_IParameterValue * > TParamValPair
Defines a parameter-value pair for the monolithic parameters AAX programming paradigm; this is very w...
Definition: AAXPluginParameters.h:162
base class interface file for ASPiK plugincore object
Processing structure; this is described in detail in Designing Audio Effects in C++ 2nd Ed....
Definition: AAXPluginParameters.h:117
See AAX_CMonolithicParameters in SDK; this is part of the strict parameter synchronization in monolit...
Definition: AAXPluginParameters.h:232
Information that defines a single GUI parameter's possible values and ID.
Definition: pluginstructures.h:332
double actualValue
actual value
Definition: pluginstructures.h:353
uint32_t controlID
ID value.
Definition: pluginstructures.h:352
Information about a GUI update message; this is for sending GUI control information from the plugin c...
Definition: pluginstructures.h:444
std::vector< GUIParameter > guiParameters
list of updates
Definition: pluginstructures.h:461
Information from the host that is updated on each buffer process cycle; includes BPM,...
Definition: pluginstructures.h:974
Definition: pluginstructures.h:486
Information that includes the message code as well as the message data.
Definition: pluginstructures.h:706
void * inMessageData
incoming message data (interpretation depends on message)
Definition: pluginstructures.h:733
std::string inMessageString
incoming message data as a std::string (interpretation depends on message)
Definition: pluginstructures.h:736
Information about a MIDI event.
Definition: pluginstructures.h:562
uint32_t midiMessage
BYTE message as UINT.
Definition: pluginstructures.h:641
uint32_t midiData2
BYTE data 2 as UINT.
Definition: pluginstructures.h:644
Structure of data that is passed to GUI object once at creation time.
Definition: AAXPluginParameters.h:79
Back-pointer to the parameters; this is described in detail in Designing Audio Effects in C++ 2nd Ed....
Definition: AAXPluginParameters.h:98