AAX SDK 2.6.1
Avid Audio Extensions Development Kit
Loading...
Searching...
No Matches
AAX_CMonolithicParameters.h
Go to the documentation of this file.
1/*================================================================================================*/
2/*
3 * Copyright 2014-2016, 2019, 2023 Avid Technology, Inc.
4 * All rights reserved.
5 *
6 * CONFIDENTIAL: this document contains confidential information of Avid. Do
7 * not disclose to any third party. Use of the information contained in this
8 * document is subject to an Avid SDK license.
9 */
10
17/*================================================================================================*/
18
19
20#ifndef AAX_CMONOLITHICPARAMETERS_H
21#define AAX_CMONOLITHICPARAMETERS_H
22
23// AAX headers
24//
25// Parent class
27//
28// Describe
31#include "AAX_IPropertyMap.h"
32//
33// Utilities
34#include "AAX_CAtomicQueue.h"
35#include "AAX_IParameter.h"
36#include "AAX_IMIDINode.h"
37#include "AAX_IString.h"
38
39// Standard Includes
40#include <set>
41#include <list>
42#include <utility>
43
44
45// Max number of additional midi nodes is 15, for a grand total of 16 input midi nodes. We're not aware of any plug-in that uses more.
46#define kMaxAdditionalMIDINodes 15
47
48// You can increase this if you need, it is not a system limitation.
49#define kMaxAuxOutputStems 32
50
51// You can increase this if you need; it should be set to a value greater than or equal to the number of synchronized parameters in your plug-in
52#define kSynchronizedParameterQueueSize 32
53
54
61{
62 //Global MIDI Nodes
64 const char* mGlobalMIDINodeName;
66
67 //Input MIDI Nodes
69 const char* mInputMIDINodeName;
72
73 //Transport
76
77 //Meters
78 int32_t mNumMeters;
80
81 //Aux Output Stems Feature.
85
86 //AAX Hybrid
89
90
91 //General Properties
100
108
109
116 {
117 mNeedsGlobalMIDI = false;
118 mGlobalMIDINodeName = "GlobalMIDI";
119 mGlobalMIDIEventMask = 0xffff;
120 mNeedsInputMIDI = false;
121 mInputMIDINodeName = "InputMIDI";
122 mInputMIDIChannelMask = 0xffff;
124 mNeedsTransport = false;
125 mTransportMIDINodeName = "Transport";
126 mNumMeters = 0;
127 mMeterIDs = 0;
130 mUseHostGeneratedGUI = false;
131 mCanBypass = true;
132 mManufacturerID = 'none';
133 mProductID = 'none';
134 mPluginID = 'none';
135 mAudiosuiteID = 'none';
136 mMultiMonoSupport = true;
137
139 for (int32_t i=0; i<kMaxAuxOutputStems; i++)
140 {
141 mAuxOutputStemNames[i] = 0;
143 }
144
147 }
148};
149
150class AAX_CMonolithicParameters; //predefined for AAX_SInstrumentPrivateData
157{
165
166 //<DMT> Removed mOutputStemFormat. Adding it to this structure was not intentional. Please call Controller()->GetOutputStemFormat() from your RenderAudio call if you need this info.
167 //<DMT> Please note, nothing else should be added to this struct. All host information is accessible through the AAX_IController in the RenderAudio call.
168};
169
170
175{
176 float** mAudioInputs;
178 int32_t* mNumSamples;
180
185
187
188 float** mMeters;
189
191};
192
218{
219public:
222
223protected:
224 typedef std::pair<AAX_CParamID const, const AAX_IParameterValue*> TParamValPair;
225
241 virtual void RenderAudio(AAX_SInstrumentRenderInfo* ioRenderInfo, const TParamValPair* inSynchronizedParamValues[], int32_t inNumSynchronizedParamValues) {}
243
258 void AddSynchronizedParameter(const AAX_IParameter& inParameter);
260
261public:
268 // Overrides from \ref AAX_CEffectParameters
271 AAX_Result ResetFieldData (AAX_CFieldIndex iFieldIndex, void * oData, uint32_t iDataSize) const AAX_OVERRIDE;
281 static AAX_Result StaticDescribe (AAX_IEffectDescriptor * ioDescriptor, const AAX_SInstrumentSetupInfo & setupInfo);
290 static void AAX_CALLBACK StaticRenderAudio(AAX_SInstrumentRenderInfo* const inInstancesBegin [], const void* inInstancesEnd);
292
293private:
294 // This structure is used on the render thread to set up the contiguous array of TParamValPair* values
295 // which is passed to RenderAudio(). The values are drawn from lists of parameter value updates which
296 // were queued during GenerateCoefficients()
297 struct SParamValList
298 {
299 // Using 4x the preset queue size: the buffer must be large enough to accommodate the maximum
300 // number of updates that we expect to be queued between/before executions of the render callback.
301 // The maximum queuing that will likely ever occur is during a preset change (i.e. a call to
302 // SetChunk()), in which updates to all parameters may be queued in the same state frame. It is
303 // possible that the host would call SetChunk() on the plug-in more than once before the render
304 // callback executes, but probably not more than 2-3x. Therefore 4x seems like a safe upper limit
305 // for the capacity of this buffer.
306 static const int32_t sCap = 4*kSynchronizedParameterQueueSize;
307
308 TParamValPair* mElem[sCap];
309 int32_t mSize;
310
311 SParamValList()
312 {
313 Clear();
314 }
315
316 void Add(TParamValPair* inElem)
317 {
318 AAX_ASSERT(sCap > mSize);
319 if (sCap > mSize)
320 {
321 mElem[mSize++] = inElem;
322 }
323 }
324
325 void Append(const SParamValList& inOther)
326 {
327 AAX_ASSERT(sCap >= mSize + inOther.mSize);
328 for (int32_t i = 0; i < inOther.mSize; ++i)
329 {
330 Add(inOther.mElem[i]);
331 }
332 }
333
334 void Append(const std::list<TParamValPair*>& inOther)
335 {
336 AAX_ASSERT(sCap >= mSize + (int64_t)inOther.size());
337 for (std::list<TParamValPair*>::const_iterator iter = inOther.begin(); iter != inOther.end(); ++iter)
338 {
339 Add(*iter);
340 }
341 }
342
343 void Merge(AAX_IPointerQueue<TParamValPair>& inOther)
344 {
345 do
346 {
347 TParamValPair* const val = inOther.Pop();
348 if (NULL == val) { break; }
349 Add(val);
350 } while (1);
351 }
352
353 void Clear()
354 {
355 std::memset(mElem, 0x0, sizeof(mElem));
356 mSize = 0;
357 }
358 };
359
360 typedef std::set<const AAX_IParameter*> TParamSet;
361 typedef std::pair<int64_t, std::list<TParamValPair*> > TNumberedParamStateList;
362 typedef AAX_CAtomicQueue<TNumberedParamStateList, 256> TNumberedStateListQueue;
364
365
366 SParamValList GetUpdatesForState(int64_t inTargetStateNum);
367 void DeleteUsedParameterChanges();
368
369private:
370 std::set<std::string> mSynchronizedParameters;
371 int64_t mStateCounter;
372 TParamSet mDirtyParameters;
373 TNumberedStateListQueue mQueuedParameterChanges;
374 TNumberedStateListQueue mFinishedParameterChanges; // Parameter changes ready for deletion
375 TParamValPairQueue mFinishedParameterValues; // Parameter values ready for deletion
376};
377
378
379
380
381
382#endif // AAX_CMONOLITHICPARAMETERS_H
AAX_EUpdateSource
Source for values passed into UpdateParameterNormalizedValue().
Definition: AAX_Enums.h:1049
AAX_EStemFormat
Stem format definitions.
Definition: AAX_Enums.h:230
@ AAX_eStemFormat_Mono
M.
Definition: AAX_Enums.h:232
@ AAX_eStemFormat_None
Definition: AAX_Enums.h:274
Description interface for an AAX plug-in algorithm.
Generic plug-in description property map.
const char * AAX_CParamID
Parameter identifier.
Definition: AAX.h:349
int32_t AAX_Result
Definition: AAX.h:334
uint8_t AAX_CBoolean
Cross-compiler boolean type used by AAX interfaces.
Definition: AAX.h:326
#define AAX_CALLBACK
Definition: AAX.h:282
int64_t AAX_CTimestamp
Time stamp value. Measured against the DAE clock (see AAX_IComponentDescriptor::AddClock() )
Definition: AAX.h:328
#define AAX_OVERRIDE
override keyword macro
Definition: AAX.h:151
uint32_t AAX_CTypeID
Matches type of OSType used in classic plugins.
Definition: AAX.h:333
AAX_CIndex AAX_CFieldIndex
Not used by AAX plug-ins (except in AAX_FIELD_INDEX macro)
Definition: AAX.h:346
An AAX string interface.
Atomic, non-blocking queue.
A default implementation of the AAX_IeffectParameters interface.
Declaration of the base MIDI Node interface.
#define AAX_ASSERT(condition)
Asserts that a condition is true and logs an error if the condition is false.
Definition: AAX_Assert.h:268
The base interface for all normalizable plug-in parameters.
Description interface for an effect's (plug-in type's) components.
#define kSynchronizedParameterQueueSize
Definition: AAX_CMonolithicParameters.h:52
#define kMaxAuxOutputStems
Definition: AAX_CMonolithicParameters.h:49
#define kMaxAdditionalMIDINodes
Definition: AAX_CMonolithicParameters.h:46
Definition: AAX_CAtomicQueue.h:53
Default implementation of the AAX_IEffectParameters interface.
Definition: AAX_CEffectParameters.h:63
Description interface for an effect's (plug-in type's) components.
Definition: AAX_IEffectDescriptor.h:47
Interface for accessing information in a MIDI node.
Definition: AAX_IMIDINode.h:37
The base interface for all normalizable plug-in parameters.
Definition: AAX_IParameter.h:137
Definition: AAX_IPointerQueue.h:32
virtual value_type Pop()=0
Information used to describe the instrument.
Definition: AAX_CMonolithicParameters.h:61
AAX_CBoolean mMultiMonoSupport
Definition: AAX_CMonolithicParameters.h:107
AAX_CTypeID mProductID
Product ID
Definition: AAX_CMonolithicParameters.h:97
AAX_EStemFormat mHybridOutputStemFormat
Hybrid output stem format
Definition: AAX_CMonolithicParameters.h:88
int32_t mNumAdditionalInputMIDINodes
Number of additional input MIDI Nodes. These will all share the same channelMask and base MIDINodeNam...
Definition: AAX_CMonolithicParameters.h:71
bool mUseHostGeneratedGUI
Allow Pro Tools or other host to generate a generic GUI. This can be useful for early development.
Definition: AAX_CMonolithicParameters.h:94
uint32_t mGlobalMIDIEventMask
Global MIDI node event mask of AAX_EMidiGlobalNodeSelectors, if used.
Definition: AAX_CMonolithicParameters.h:65
const char * mAuxOutputStemNames[kMaxAuxOutputStems]
Names of the aux output stems.
Definition: AAX_CMonolithicParameters.h:83
int32_t mNumMeters
Number of meter taps used by the instrument. Must match the size of mMeterIDs.
Definition: AAX_CMonolithicParameters.h:78
bool mNeedsInputMIDI
Does the instrument use a local MIDI input node?
Definition: AAX_CMonolithicParameters.h:68
AAX_CTypeID mPluginID
Plug-In (Type) ID
Definition: AAX_CMonolithicParameters.h:98
bool mCanBypass
Can this instrument be bypassed?
Definition: AAX_CMonolithicParameters.h:95
const char * mTransportMIDINodeName
Name of the MIDI transport node, if used.
Definition: AAX_CMonolithicParameters.h:75
const AAX_CTypeID * mMeterIDs
Array of meter IDs.
Definition: AAX_CMonolithicParameters.h:79
AAX_CTypeID mAudiosuiteID
AudioSuite ID
Definition: AAX_CMonolithicParameters.h:99
AAX_CTypeID mManufacturerID
Manufacturer ID
Definition: AAX_CMonolithicParameters.h:96
AAX_SInstrumentSetupInfo()
Default constructor.
Definition: AAX_CMonolithicParameters.h:115
AAX_EStemFormat mOutputStemFormat
Output stem format
Definition: AAX_CMonolithicParameters.h:93
const char * mInputMIDINodeName
Name of the MIDI input node, if used.
Definition: AAX_CMonolithicParameters.h:69
int32_t mNumAuxOutputStems
Number of aux output stems for the plug-in.
Definition: AAX_CMonolithicParameters.h:82
uint32_t mInputMIDIChannelMask
MIDI input node channel mask, if used.
Definition: AAX_CMonolithicParameters.h:70
const char * mGlobalMIDINodeName
Name of the global MIDI node, if used.
Definition: AAX_CMonolithicParameters.h:64
bool mNeedsGlobalMIDI
Does the instrument use a global MIDI input node?
Definition: AAX_CMonolithicParameters.h:63
AAX_EStemFormat mInputStemFormat
Input stem format
Definition: AAX_CMonolithicParameters.h:92
AAX_EStemFormat mHybridInputStemFormat
Hybrid input stem format
Definition: AAX_CMonolithicParameters.h:87
bool mNeedsTransport
Does the instrument use the transport interface?
Definition: AAX_CMonolithicParameters.h:74
AAX_EStemFormat mAuxOutputStemFormats[kMaxAuxOutputStems]
Stem formats for the output stems.
Definition: AAX_CMonolithicParameters.h:84
Utility struct for AAX_CMonolithicParameters.
Definition: AAX_CMonolithicParameters.h:157
AAX_CMonolithicParameters * mMonolithicParametersPtr
A pointer to the instrument's data model.
Definition: AAX_CMonolithicParameters.h:164
Information used to parameterize AAX_CMonolithicParameters::RenderAudio()
Definition: AAX_CMonolithicParameters.h:175
float ** mAudioOutputs
Audio output buffers, including any aux output stems.
Definition: AAX_CMonolithicParameters.h:177
AAX_IMIDINode * mGlobalNode
Buffered global MIDI input node. Used for global events like beat updates in metronomes.
Definition: AAX_CMonolithicParameters.h:182
AAX_CTimestamp * mClock
Pointer to the global running time clock.
Definition: AAX_CMonolithicParameters.h:179
AAX_IMIDINode * mTransportNode
Transport MIDI node. Used for querying the state of the MIDI transport.
Definition: AAX_CMonolithicParameters.h:183
float ** mMeters
Array of meter taps. One meter value should be entered per tap for each render call.
Definition: AAX_CMonolithicParameters.h:188
int32_t * mNumSamples
Number of samples in each buffer. Bounded as per AAE_EAudioBufferLengthNative. The exact value can va...
Definition: AAX_CMonolithicParameters.h:178
int64_t * mCurrentStateNum
State counter.
Definition: AAX_CMonolithicParameters.h:190
float ** mAudioInputs
Audio input buffers.
Definition: AAX_CMonolithicParameters.h:176
AAX_IMIDINode * mInputNode
Buffered local MIDI input node. Used for incoming MIDI messages directed to the instrument.
Definition: AAX_CMonolithicParameters.h:181
AAX_IMIDINode * mAdditionalInputMIDINodes[kMaxAdditionalMIDINodes]
List of additional input MIDI nodes, if your plugin needs them.
Definition: AAX_CMonolithicParameters.h:184
AAX_SInstrumentPrivateData * mPrivateData
Struct containing private data relating to the instance. You should not need to use this data.
Definition: AAX_CMonolithicParameters.h:186
Extension of the AAX_CEffectParameters class for monolithic VIs and effects.
Definition: AAX_CMonolithicParameters.h:218
virtual void RenderAudio(AAX_SInstrumentRenderInfo *ioRenderInfo, const TParamValPair *inSynchronizedParamValues[], int32_t inNumSynchronizedParamValues)
Definition: AAX_CMonolithicParameters.h:241
void AddSynchronizedParameter(const AAX_IParameter &inParameter)
Definition: AAX_CMonolithicParameters.cpp:37
AAX_CMonolithicParameters(void)
Definition: AAX_CMonolithicParameters.cpp:19
AAX_Result ResetFieldData(AAX_CFieldIndex iFieldIndex, void *oData, uint32_t iDataSize) const AAX_OVERRIDE
Called by the host to reset a private data field in the plug-in's algorithm.
Definition: AAX_CMonolithicParameters.cpp:101
AAX_Result GenerateCoefficients() AAX_OVERRIDE
Generates and dispatches new coefficient packets.
Definition: AAX_CMonolithicParameters.cpp:62
static AAX_Result StaticDescribe(AAX_IEffectDescriptor *ioDescriptor, const AAX_SInstrumentSetupInfo &setupInfo)
Definition: AAX_CMonolithicParameters.cpp:129
AAX_Result UpdateParameterNormalizedValue(AAX_CParamID iParamID, double aValue, AAX_EUpdateSource inSource) AAX_OVERRIDE
Updates a single parameter's state to its current value.
Definition: AAX_CMonolithicParameters.cpp:44
std::pair< AAX_CParamID const, const AAX_IParameterValue * > TParamValPair
Definition: AAX_CMonolithicParameters.h:224
AAX_Result TimerWakeup() AAX_OVERRIDE
Periodic wakeup callback for idle-time operations.
Definition: AAX_CMonolithicParameters.cpp:120
~AAX_CMonolithicParameters(void) AAX_OVERRIDE
Definition: AAX_CMonolithicParameters.cpp:31
static void AAX_CALLBACK StaticRenderAudio(AAX_SInstrumentRenderInfo *const inInstancesBegin[], const void *inInstancesEnd)
Definition: AAX_CMonolithicParameters.cpp:233