22 #ifndef RACKAFX_PARAMETERS_H 23 #define RACKAFX_PARAMETERS_H 25 #include "AAX_CEffectParameters.h" 26 #pragma warning(disable : 4985) // --- 'ceil': attributes not present on previous declaration NOTE: for VS2008 only, see the google for more info 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" 42 #include "plugincore.h" 43 #include "customcontrols.h" 46 #include <CoreFoundation/CoreFoundation.h> 55 const AAX_CTypeID PLUGIN_CUSTOMDATA_ID = 0;
58 const AAX_CTypeID GR_MeterID =
'grMT';
59 const unsigned int meterTapCount = 1;
120 float** inputBufferPtrs;
121 float** outputBufferPtrs;
122 int32_t* bufferLength;
127 #ifdef WANT_SIDECHAIN 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 162 typedef 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;
202 static AAX_Result
StaticDescribe(AAX_IComponentDescriptor& outDesc);
205 virtual AAX_Result
GetCustomData(AAX_CTypeID iDataBlockID, uint32_t iDataSize,
void* oData, uint32_t* oDataWritten)
const;
251 AAX_ASSERT(sCap > mSize);
254 mElem[mSize++] = inElem;
258 void Append(
const SParamValList& inOther)
260 AAX_ASSERT(sCap >= mSize + inOther.mSize);
261 for (int32_t i = 0; i < inOther.mSize; ++i)
263 Add(inOther.mElem[i]);
267 void Append(
const std::list<TParamValPair*>& inOther)
269 AAX_ASSERT(sCap >= mSize + (int64_t)inOther.size());
270 for (std::list<TParamValPair*>::const_iterator iter = inOther.begin(); iter != inOther.end(); ++iter)
276 void Merge(AAX_IPointerQueue<TParamValPair>& inOther)
281 if (NULL == val) {
break; }
288 std::memset(mElem, 0x0,
sizeof(mElem));
297 typedef std::set<const AAX_IParameter*> TParamSet;
298 typedef std::pair<int64_t, std::list<TParamValPair*> > TNumberedParamStateList;
299 typedef AAX_CAtomicQueue<TNumberedParamStateList, 256> TNumberedStateListQueue;
301 typedef AAX_CAtomicQueue<const TParamValPair, 16*kSynchronizedParameterQueueSize> TParamValPairQueue;
303 SParamValList GetUpdatesForState(int64_t inTargetStateNum);
304 void DeleteUsedParameterChanges();
305 std::set<std::string> mSynchronizedParameters;
306 int64_t mStateCounter;
307 TParamSet mDirtyParameters;
308 TNumberedStateListQueue mQueuedParameterChanges;
309 TNumberedStateListQueue mFinishedParameterChanges;
310 TParamValPairQueue mFinishedParameterValues;
311 int64_t mCurrentStateNum;
314 bool softBypass =
false;
323 uint32_t getChannelFormatForAAXStemFormat(AAX_EStemFormat format)
327 case AAX_eStemFormat_None: {
330 case AAX_eStemFormat_Mono: {
333 case AAX_eStemFormat_Stereo: {
336 case AAX_eStemFormat_LCR: {
339 case AAX_eStemFormat_LCRS: {
342 case AAX_eStemFormat_Quad: {
345 case AAX_eStemFormat_5_0: {
348 case AAX_eStemFormat_5_1: {
351 case AAX_eStemFormat_6_0: {
354 case AAX_eStemFormat_6_1: {
357 case AAX_eStemFormat_7_0_SDDS: {
360 case AAX_eStemFormat_7_0_DTS: {
363 case AAX_eStemFormat_7_1_SDDS: {
366 case AAX_eStemFormat_7_1_DTS: {
369 case AAX_eStemFormat_7_1_2: {
370 return kCF7p1Proximity; }
378 #if defined _WINDOWS || defined _WINDLL 379 wchar_t* convertCharArrayToLPCWSTR(
const char* charArray)
381 wchar_t* wString =
new wchar_t[4096];
382 MultiByteToWideChar(CP_ACP, 0, charArray, -1, wString, 4096);
387 char* getMyDLLDirectory(
const char* dllName)
389 wchar_t* cPluginName = convertCharArrayToLPCWSTR(dllName);
390 HMODULE hmodule = GetModuleHandle(cPluginName);
393 memset(&dir[0], 0, MAX_PATH*
sizeof(TCHAR));
394 dir[MAX_PATH-1] =
'\0';
397 GetModuleFileName(hmodule, &dir[0], MAX_PATH);
402 std::wstring backslash(L
"\\");
403 std::wstring strPlugin(cPluginName);
404 std::wstring strDir(&dir[0]);
405 int pathLen = strDir.size() - strPlugin.size() - backslash.size();
408 std::wstring strPath = strDir.substr(0, pathLen);
409 char* str =
new char[MAX_PATH];
410 sprintf(str,
"%ls", strPath.c_str());
411 delete[] cPluginName;
419 char* getMyComponentDirectory(CFStringRef bundleID)
421 if (bundleID !=
nullptr)
423 CFBundleRef helixBundle = CFBundleGetBundleWithIdentifier( bundleID );
424 if(helixBundle !=
nullptr)
426 CFURLRef bundleURL = CFBundleCopyBundleURL ( helixBundle );
427 if(bundleURL !=
nullptr)
429 CFURLRef componentFolderPathURL = CFURLCreateCopyDeletingLastPathComponent(
nullptr, bundleURL);
431 CFStringRef myComponentPath = CFURLCopyFileSystemPath(componentFolderPathURL, kCFURLPOSIXPathStyle);
432 CFRelease(componentFolderPathURL);
434 if(myComponentPath !=
nullptr)
436 int nSize = CFStringGetLength(myComponentPath);
437 char* path =
new char[nSize+1];
438 memset(path, 0, (nSize+1)*
sizeof(
char));
440 bool success = CFStringGetCString(myComponentPath, path, nSize+1, kCFStringEncodingASCII);
441 CFRelease(myComponentPath);
443 if(success)
return path;
446 CFRelease(bundleURL);
480 switch(hostMessageInfo.hostMessage)
486 for (uint32_t i = 0; i < guiUpdateData.
guiParameters.size(); i++)
490 std::stringstream str;
492 AAX_IParameter* oParameter;
493 AAX_Result result =
aaxParameters->GetParameter(str.str().c_str(), &oParameter);
494 if(AAX_SUCCESS == result)
496 oParameter->SetValueWithDouble(guiParam.
actualValue);
501 for (uint32_t i = 0; i < guiUpdateData.
guiParameters.size(); i++)
600 for (customViewControllerMap::const_iterator it = customViewMap.begin(), end = customViewMap.end(); it != end; ++it)
617 std::stringstream str;
618 str << controlID + 1;
620 AAX_Result result =
aaxParameters->GetParameterNormalizedValue(str.str().c_str(), ¶m);
621 if(AAX_SUCCESS == result)
631 std::stringstream str;
632 str << controlID + 1;
633 aaxParameters->SetParameterNormalizedValue(str.str().c_str(), value);
641 std::stringstream str;
652 std::stringstream str;
676 MessageInfo info(PLUGINGUI_REGISTER_SUBCONTROLLER);
694 MessageInfo info(PLUGINGUI_DE_REGISTER_SUBCONTROLLER);
711 customViewControllerMap::const_iterator it = customViewMap.find(customViewName);
712 if (it != customViewMap.end())
720 customViewMap.insert(std::make_pair(customViewName, pCVC));
742 MessageInfo info(PLUGINGUI_DE_REGISTER_CUSTOMVIEW);
766 for (customViewControllerMap::const_iterator it = customViewMap.begin(), end = customViewMap.end(); it != end; ++it)
768 it->second->clearCustomViewPtr();
772 it->second->clearCustomViewPtr();
810 for (customViewControllerMap::const_iterator it = customViewMap.begin(), end = customViewMap.end(); it != end; ++it)
812 if (it->second->getCustomViewPtr() == customViewConnector)
825 if (it->second->getCustomViewPtr() == customViewConnector)
863 void setMIDIpackets(
const AAX_CMidiPacket*& _ioPacketPtr, uint32_t& _midiBuffersize)
881 const uint8_t uMessage = (
ioPacketPtr->mData[0] & 0xF0);
882 const uint8_t uChannel = (
ioPacketPtr->mData[0] & 0x0F);
886 event.midiChannel = (
unsigned int)uChannel;
887 event.midiData1 = (
unsigned int)
ioPacketPtr->mData[1];
889 event.midiSampleOffset = sampleOffset;
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
Information that includes the message code as well as the message data.
Definition: pluginstructures.h:705
CustomViewController * getCustomViewController(ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:808
The AAXPluginParameters object implements the monolithic parameters AAX plugin programming paradigm w...
Definition: AAXPluginParameters.h:176
uint32_t midiBuffersize
midi buffer size for each bunch of packets
Definition: AAXPluginParameters.h:904
virtual bool guiWillClose()
Definition: AAXPluginParameters.h:762
std::vector< GUIParameter > guiParameters
list of updates
Definition: pluginstructures.h:461
void setMIDIpackets(const AAX_CMidiPacket *&_ioPacketPtr, uint32_t &_midiBuffersize)
Definition: AAXPluginParameters.h:863
The CustomViewController is part of the safe ICustomView feature in ASPiK. The CustomViewController m...
Definition: AAXPluginParameters.h:527
virtual void updateView()
Definition: AAXPluginParameters.h:535
virtual bool processMIDIEvent(midiEvent &event)
process a MIDI event
Definition: plugincore.cpp:415
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:399
virtual void pushDataValue(double data)
Definition: AAXPluginParameters.h:542
GUIPluginConnector(AAX_IEffectParameters *_aaxParameters, PluginCore *_pluginCore)
Definition: AAXPluginParameters.h:591
PluginCore * pluginCore
core
Definition: AAXPluginParameters.h:902
#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
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:761
virtual bool deRregisterSubcontroller(ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:687
uint32_t controlID
ID value.
Definition: pluginstructures.h:352
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:633
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:595
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:740
void clearCustomViewPtr()
Definition: AAXPluginParameters.h:562
virtual bool processMessage(MessageInfo &messageInfo)
For Custom View and Custom Sub-Controller Operations.
Definition: plugincore.cpp:355
virtual bool registerCustomView(std::string customViewName, ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:706
virtual bool checkNonBoundValueChange(int tag, float normalizedValue)
Definition: AAXPluginParameters.h:788
CustomViewController(ICustomView *_customViewIF)
Definition: AAXPluginParameters.h:531
virtual AAX_Result ResetFieldData(AAX_CFieldIndex inFieldIndex, void *oData, uint32_t iDataSize) const
AAX Override.
Definition: AAXPluginParameters.cpp:795
void updateOutboundAAXParameters()
threadsafe update of outbound parameters (meter variables) for GUI.
Definition: AAXPluginParameters.cpp:921
Structure of data that is passed to GUI object once at creation time.
Definition: AAXPluginParameters.h:78
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:476
virtual unsigned int getEventCount()
Definition: AAXPluginParameters.h:871
uint32_t midiMessage
BYTE message as UINT.
Definition: pluginstructures.h:641
const AAX_CMidiPacket * ioPacketPtr
array of packets
Definition: AAXPluginParameters.h:903
Information about a GUI update message; this is for sending GUI control information from the plugin c...
Definition: pluginstructures.h:443
virtual bool deRegisterCustomView(ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:734
AAXPluginParameters()
object constructor; this creates the ASPiK core and all of its required interfaces.
Definition: AAXPluginParameters.cpp:75
Custom interface so that GUI can pass information to plugin shell in a thread-safe manner...
Definition: pluginstructures.h:1473
virtual AAX_Result TimerWakeup()
AAX Override.
Definition: AAXPluginParameters.cpp:904
PluginCore * pluginCore
the core object
Definition: AAXPluginParameters.h:799
Custom View interface to allow plugin core to create safe communication channels with GUI custom view...
Definition: pluginstructures.h:1395
void updateHostInfo(AAXAlgorithm *ioRenderInfo, HostInfo *hostInfo)
called once per buffer process operation to set the host information structure for the core ...
Definition: AAXPluginParameters.cpp:432
virtual void parameterChanged(int32_t controlID, double actualValue, double)
Definition: AAXPluginParameters.h:607
virtual void endParameterChangeGesture(int controlTag)
Definition: AAXPluginParameters.h:648
Definition: pluginstructures.h:485
AAXMIDIEventQueue(PluginCore *_pluginCore)
Definition: AAXPluginParameters.h:853
Double buffered queue for MIDI messages.
Definition: pluginstructures.h:1561
Processing structure; this is described in detail in Designing Audio Effects in C++ 2nd Ed...
Definition: AAXPluginParameters.h:116
virtual bool guiParameterChanged(int32_t controlID, double actualValue)
has nothing to do with actual variable or updated variable (binding)
Definition: plugincore.cpp:326
The GUIPluginConnector interface creates a safe message mechanism for the GUI to issue requests to th...
Definition: AAXPluginParameters.h:587
virtual void setNormalizedPluginParameter(int32_t controlID, double value)
Definition: AAXPluginParameters.h:628
std::map< std::string, CustomViewController * > customViewControllerMap
map of custom view controllers
Definition: AAXPluginParameters.h:804
AAX_IEffectParameters * aaxParameters
parent parameters; lifelong existence
Definition: AAXPluginParameters.h:512
Back-pointer to the parameters; this is described in detail in Designing Audio Effects in C++ 2nd Ed...
Definition: AAXPluginParameters.h:97
virtual double getNormalizedPluginParameter(int32_t controlID)
Definition: AAXPluginParameters.h:614
virtual AAX_Result EffectInit()
AAX Override.
Definition: AAXPluginParameters.cpp:185
virtual AAX_Result GenerateCoefficients()
AAX Override.
Definition: AAXPluginParameters.cpp:694
void * inMessageData
incoming message data (interpretation depends on message)
Definition: pluginstructures.h:733
The AAXMIDIEventQueue interface queues incoming MIDI messages and blasts them out during the buffer p...
Definition: AAXPluginParameters.h:849
virtual bool registerSubcontroller(std::string subcontrollerName, ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:659
uint32_t midiData2
BYTE data 2 as UINT.
Definition: pluginstructures.h:644
void setCustomViewPtr(ICustomView *_customViewIF)
Definition: AAXPluginParameters.h:556
CustomViewController * getCustomSubController(ICustomView *customViewConnector)
Definition: AAXPluginParameters.h:821
virtual bool guiDidOpen()
Definition: AAXPluginParameters.h:754
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...)
Definition: plugincore.h:43
virtual ~GUIPluginConnector()
Definition: AAXPluginParameters.h:594
virtual void sendMessage(void *data)
Definition: pluginstructures.h:1416
virtual AAX_Result GetCustomData(AAX_CTypeID iDataBlockID, uint32_t iDataSize, void *oData, uint32_t *oDataWritten) const
note the data that is transferred to GUI; the core is ONLY used for initialization and then it is unu...
Definition: AAXPluginParameters.cpp:159
Information that defines a single GUI parameter's possible values and ID.
Definition: pluginstructures.h:331
virtual bool fireMidiEvents(unsigned int sampleOffset)
Definition: AAXPluginParameters.h:877
double actualValue
actual value
Definition: pluginstructures.h:353
Information from the host that is updated on each buffer process cycle; includes BPM, time signature, SMPTE and other data. The values in the stock structure are consistent across most APIs, however others may be added (commnted out here)
Definition: pluginstructures.h:973
virtual void updateView()=0
std::string inMessageString
incoming message data as a std::string (interpretation depends on message)
Definition: pluginstructures.h:736
Custom interface to send the plugin shell a message from plugin core.
Definition: pluginstructures.h:1543
The PluginHostConnector implements the IPluginHostConnector interface for the plugin shell object...
Definition: AAXPluginParameters.h:467
static AAX_CEffectParameters *AAX_CALLBACK Create()
creation mechanism for this object
Definition: AAXPluginParameters.cpp:59
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:478
virtual void beginParameterChangeGesture(int controlTag)
Definition: AAXPluginParameters.h:637
const ICustomView * getCustomViewPtr()
Definition: AAXPluginParameters.h:559
customViewControllerMap customSubControllerMap
map of custom sub-controllers
Definition: AAXPluginParameters.h:819
AAX_IEffectParameters * aaxParameters
the parent object
Definition: AAXPluginParameters.h:800
virtual void pushDataValue(double data)
Definition: pluginstructures.h:1406
virtual void sendMessage(void *data)
Definition: AAXPluginParameters.h:549
virtual bool guiTimerPing()
Definition: AAXPluginParameters.h:780
virtual ~AAXPluginParameters()
object destructor; this destroys the ASPiK core and all of its required interfaces.
Definition: AAXPluginParameters.cpp:138
Information about a MIDI event.
Definition: pluginstructures.h:561