AAX SDK 2.8.0
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-2024 Avid Technology, Inc.
4 * All rights reserved.
5 *
6 * This file is part of the Avid AAX SDK.
7 *
8 * The AAX SDK is subject to commercial or open-source licensing.
9 *
10 * By using the AAX SDK, you agree to the terms of both the Avid AAX SDK License
11 * Agreement and Avid Privacy Policy.
12 *
13 * AAX SDK License: https://developer.avid.com/aax
14 * Privacy Policy: https://www.avid.com/legal/privacy-policy-statement
15 *
16 * Or: You may also use this code under the terms of the GPL v3 (see
17 * www.gnu.org/licenses).
18 *
19 * THE AAX SDK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 * EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 * DISCLAIMED.
22 */
23
30/*================================================================================================*/
31
32
33#ifndef AAX_CMONOLITHICPARAMETERS_H
34#define AAX_CMONOLITHICPARAMETERS_H
35
36// AAX headers
37//
38// Parent class
40//
41// Describe
44#include "AAX_IPropertyMap.h"
45//
46// Utilities
47#include "AAX_CAtomicQueue.h"
48#include "AAX_IParameter.h"
49#include "AAX_IMIDINode.h"
50#include "AAX_IString.h"
51
52// Standard Includes
53#include <set>
54#include <list>
55#include <utility>
56
57
58// 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.
59#define kMaxAdditionalMIDINodes 15
60
61// You can increase this if you need, it is not a system limitation.
62#define kMaxAuxOutputStems 32
63
64// 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
65#define kSynchronizedParameterQueueSize 32
66
67
74{
75 //Global MIDI Nodes
77 const char* mGlobalMIDINodeName;
79
80 //Input MIDI Nodes
82 const char* mInputMIDINodeName;
85
86 //Transport
89
90 //Meters
91 int32_t mNumMeters;
93
94 //Aux Output Stems Feature.
98
99 //AAX Hybrid
102
103
104 //General Properties
113
121
122
129 {
130 mNeedsGlobalMIDI = false;
131 mGlobalMIDINodeName = "GlobalMIDI";
132 mGlobalMIDIEventMask = 0xffff;
133 mNeedsInputMIDI = false;
134 mInputMIDINodeName = "InputMIDI";
135 mInputMIDIChannelMask = 0xffff;
137 mNeedsTransport = false;
138 mTransportMIDINodeName = "Transport";
139 mNumMeters = 0;
140 mMeterIDs = 0;
143 mUseHostGeneratedGUI = false;
144 mCanBypass = true;
145 mManufacturerID = 'none';
146 mProductID = 'none';
147 mPluginID = 'none';
148 mAudiosuiteID = 'none';
149 mMultiMonoSupport = true;
150
152 for (int32_t i=0; i<kMaxAuxOutputStems; i++)
153 {
154 mAuxOutputStemNames[i] = 0;
156 }
157
160 }
161};
162
163class AAX_CMonolithicParameters; //predefined for AAX_SInstrumentPrivateData
170{
178
179 //<DMT> Removed mOutputStemFormat. Adding it to this structure was not intentional. Please call Controller()->GetOutputStemFormat() from your RenderAudio call if you need this info.
180 //<DMT> Please note, nothing else should be added to this struct. All host information is accessible through the AAX_IController in the RenderAudio call.
181};
182
183
188{
189 float** mAudioInputs;
191 int32_t* mNumSamples;
193
198
200
201 float** mMeters;
202
204};
205
231{
232public:
235
236protected:
237 typedef std::pair<AAX_CParamID const, const AAX_IParameterValue*> TParamValPair;
238
254 virtual void RenderAudio(AAX_SInstrumentRenderInfo* ioRenderInfo, const TParamValPair* inSynchronizedParamValues[], int32_t inNumSynchronizedParamValues) {}
256
271 void AddSynchronizedParameter(const AAX_IParameter& inParameter);
273
274public:
281 // Overrides from \ref AAX_CEffectParameters
284 AAX_Result ResetFieldData (AAX_CFieldIndex iFieldIndex, void * oData, uint32_t iDataSize) const AAX_OVERRIDE;
294 static AAX_Result StaticDescribe (AAX_IEffectDescriptor * ioDescriptor, const AAX_SInstrumentSetupInfo & setupInfo);
303 static void AAX_CALLBACK StaticRenderAudio(AAX_SInstrumentRenderInfo* const inInstancesBegin [], const void* inInstancesEnd);
305
306private:
307 // This structure is used on the render thread to set up the contiguous array of TParamValPair* values
308 // which is passed to RenderAudio(). The values are drawn from lists of parameter value updates which
309 // were queued during GenerateCoefficients()
310 struct SParamValList
311 {
312 // Using 4x the preset queue size: the buffer must be large enough to accommodate the maximum
313 // number of updates that we expect to be queued between/before executions of the render callback.
314 // The maximum queuing that will likely ever occur is during a preset change (i.e. a call to
315 // SetChunk()), in which updates to all parameters may be queued in the same state frame. It is
316 // possible that the host would call SetChunk() on the plug-in more than once before the render
317 // callback executes, but probably not more than 2-3x. Therefore 4x seems like a safe upper limit
318 // for the capacity of this buffer.
319 static const int32_t sCap = 4*kSynchronizedParameterQueueSize;
320
321 TParamValPair* mElem[sCap];
322 int32_t mSize;
323
324 SParamValList()
325 {
326 Clear();
327 }
328
329 void Add(TParamValPair* inElem)
330 {
331 AAX_ASSERT(sCap > mSize);
332 if (sCap > mSize)
333 {
334 mElem[mSize++] = inElem;
335 }
336 }
337
338 void Append(const SParamValList& inOther)
339 {
340 AAX_ASSERT(sCap >= mSize + inOther.mSize);
341 for (int32_t i = 0; i < inOther.mSize; ++i)
342 {
343 Add(inOther.mElem[i]);
344 }
345 }
346
347 void Append(const std::list<TParamValPair*>& inOther)
348 {
349 AAX_ASSERT(sCap >= mSize + (int64_t)inOther.size());
350 for (std::list<TParamValPair*>::const_iterator iter = inOther.begin(); iter != inOther.end(); ++iter)
351 {
352 Add(*iter);
353 }
354 }
355
356 void Merge(AAX_IPointerQueue<TParamValPair>& inOther)
357 {
358 do
359 {
360 TParamValPair* const val = inOther.Pop();
361 if (NULL == val) { break; }
362 Add(val);
363 } while (1);
364 }
365
366 void Clear()
367 {
368 std::memset(mElem, 0x0, sizeof(mElem));
369 mSize = 0;
370 }
371 };
372
373 typedef std::set<const AAX_IParameter*> TParamSet;
374 typedef std::pair<int64_t, std::list<TParamValPair*> > TNumberedParamStateList;
375 typedef AAX_CAtomicQueue<TNumberedParamStateList, 256> TNumberedStateListQueue;
377
378
379 SParamValList GetUpdatesForState(int64_t inTargetStateNum);
380 void DeleteUsedParameterChanges();
381
382private:
383 std::set<std::string> mSynchronizedParameters;
384 int64_t mStateCounter;
385 TParamSet mDirtyParameters;
386 TNumberedStateListQueue mQueuedParameterChanges;
387 TNumberedStateListQueue mFinishedParameterChanges; // Parameter changes ready for deletion
388 TParamValPairQueue mFinishedParameterValues; // Parameter values ready for deletion
389};
390
391
392
393
394
395#endif // AAX_CMONOLITHICPARAMETERS_H
AAX_EUpdateSource
Source for values passed into UpdateParameterNormalizedValue().
Definition: AAX_Enums.h:1095
AAX_EStemFormat
Stem format definitions.
Definition: AAX_Enums.h:243
@ AAX_eStemFormat_Mono
M.
Definition: AAX_Enums.h:245
@ AAX_eStemFormat_None
Definition: AAX_Enums.h:287
Description interface for an AAX plug-in algorithm.
Generic plug-in description property map.
const char * AAX_CParamID
Parameter identifier.
Definition: AAX.h:362
int32_t AAX_Result
Definition: AAX.h:347
uint8_t AAX_CBoolean
Cross-compiler boolean type used by AAX interfaces.
Definition: AAX.h:339
#define AAX_CALLBACK
Definition: AAX.h:295
int64_t AAX_CTimestamp
Time stamp value. Measured against the DAE clock (see AAX_IComponentDescriptor::AddClock() )
Definition: AAX.h:341
#define AAX_OVERRIDE
override keyword macro
Definition: AAX.h:164
uint32_t AAX_CTypeID
Matches type of OSType used in classic plugins.
Definition: AAX.h:346
AAX_CIndex AAX_CFieldIndex
Not used by AAX plug-ins (except in AAX_FIELD_INDEX macro)
Definition: AAX.h:359
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:281
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:65
#define kMaxAuxOutputStems
Definition: AAX_CMonolithicParameters.h:62
#define kMaxAdditionalMIDINodes
Definition: AAX_CMonolithicParameters.h:59
Definition: AAX_CAtomicQueue.h:66
Default implementation of the AAX_IEffectParameters interface.
Definition: AAX_CEffectParameters.h:76
Description interface for an effect's (plug-in type's) components.
Definition: AAX_IEffectDescriptor.h:60
Interface for accessing information in a MIDI node.
Definition: AAX_IMIDINode.h:50
The base interface for all normalizable plug-in parameters.
Definition: AAX_IParameter.h:150
Definition: AAX_IPointerQueue.h:45
virtual value_type Pop()=0
Information used to describe the instrument.
Definition: AAX_CMonolithicParameters.h:74
AAX_CBoolean mMultiMonoSupport
Definition: AAX_CMonolithicParameters.h:120
AAX_CTypeID mProductID
Product ID
Definition: AAX_CMonolithicParameters.h:110
AAX_EStemFormat mHybridOutputStemFormat
Hybrid output stem format
Definition: AAX_CMonolithicParameters.h:101
int32_t mNumAdditionalInputMIDINodes
Number of additional input MIDI Nodes. These will all share the same channelMask and base MIDINodeNam...
Definition: AAX_CMonolithicParameters.h:84
bool mUseHostGeneratedGUI
Allow Pro Tools or other host to generate a generic GUI. This can be useful for early development.
Definition: AAX_CMonolithicParameters.h:107
uint32_t mGlobalMIDIEventMask
Global MIDI node event mask of AAX_EMidiGlobalNodeSelectors, if used.
Definition: AAX_CMonolithicParameters.h:78
const char * mAuxOutputStemNames[kMaxAuxOutputStems]
Names of the aux output stems.
Definition: AAX_CMonolithicParameters.h:96
int32_t mNumMeters
Number of meter taps used by the instrument. Must match the size of mMeterIDs.
Definition: AAX_CMonolithicParameters.h:91
bool mNeedsInputMIDI
Does the instrument use a local MIDI input node?
Definition: AAX_CMonolithicParameters.h:81
AAX_CTypeID mPluginID
Plug-In (Type) ID
Definition: AAX_CMonolithicParameters.h:111
bool mCanBypass
Can this instrument be bypassed?
Definition: AAX_CMonolithicParameters.h:108
const char * mTransportMIDINodeName
Name of the MIDI transport node, if used.
Definition: AAX_CMonolithicParameters.h:88
const AAX_CTypeID * mMeterIDs
Array of meter IDs.
Definition: AAX_CMonolithicParameters.h:92
AAX_CTypeID mAudiosuiteID
AudioSuite ID
Definition: AAX_CMonolithicParameters.h:112
AAX_CTypeID mManufacturerID
Manufacturer ID
Definition: AAX_CMonolithicParameters.h:109
AAX_SInstrumentSetupInfo()
Default constructor.
Definition: AAX_CMonolithicParameters.h:128
AAX_EStemFormat mOutputStemFormat
Output stem format
Definition: AAX_CMonolithicParameters.h:106
const char * mInputMIDINodeName
Name of the MIDI input node, if used.
Definition: AAX_CMonolithicParameters.h:82
int32_t mNumAuxOutputStems
Number of aux output stems for the plug-in.
Definition: AAX_CMonolithicParameters.h:95
uint32_t mInputMIDIChannelMask
MIDI input node channel mask, if used.
Definition: AAX_CMonolithicParameters.h:83
const char * mGlobalMIDINodeName
Name of the global MIDI node, if used.
Definition: AAX_CMonolithicParameters.h:77
bool mNeedsGlobalMIDI
Does the instrument use a global MIDI input node?
Definition: AAX_CMonolithicParameters.h:76
AAX_EStemFormat mInputStemFormat
Input stem format
Definition: AAX_CMonolithicParameters.h:105
AAX_EStemFormat mHybridInputStemFormat
Hybrid input stem format
Definition: AAX_CMonolithicParameters.h:100
bool mNeedsTransport
Does the instrument use the transport interface?
Definition: AAX_CMonolithicParameters.h:87
AAX_EStemFormat mAuxOutputStemFormats[kMaxAuxOutputStems]
Stem formats for the output stems.
Definition: AAX_CMonolithicParameters.h:97
Utility struct for AAX_CMonolithicParameters.
Definition: AAX_CMonolithicParameters.h:170
AAX_CMonolithicParameters * mMonolithicParametersPtr
A pointer to the instrument's data model.
Definition: AAX_CMonolithicParameters.h:177
Information used to parameterize AAX_CMonolithicParameters::RenderAudio()
Definition: AAX_CMonolithicParameters.h:188
float ** mAudioOutputs
Audio output buffers, including any aux output stems.
Definition: AAX_CMonolithicParameters.h:190
AAX_IMIDINode * mGlobalNode
Buffered global MIDI input node. Used for global events like beat updates in metronomes.
Definition: AAX_CMonolithicParameters.h:195
AAX_CTimestamp * mClock
Pointer to the global running time clock.
Definition: AAX_CMonolithicParameters.h:192
AAX_IMIDINode * mTransportNode
Transport MIDI node. Used for querying the state of the MIDI transport.
Definition: AAX_CMonolithicParameters.h:196
float ** mMeters
Array of meter taps. One meter value should be entered per tap for each render call.
Definition: AAX_CMonolithicParameters.h:201
int32_t * mNumSamples
Number of samples in each buffer. Bounded as per AAE_EAudioBufferLengthNative. The exact value can va...
Definition: AAX_CMonolithicParameters.h:191
int64_t * mCurrentStateNum
State counter.
Definition: AAX_CMonolithicParameters.h:203
float ** mAudioInputs
Audio input buffers.
Definition: AAX_CMonolithicParameters.h:189
AAX_IMIDINode * mInputNode
Buffered local MIDI input node. Used for incoming MIDI messages directed to the instrument.
Definition: AAX_CMonolithicParameters.h:194
AAX_IMIDINode * mAdditionalInputMIDINodes[kMaxAdditionalMIDINodes]
List of additional input MIDI nodes, if your plugin needs them.
Definition: AAX_CMonolithicParameters.h:197
AAX_SInstrumentPrivateData * mPrivateData
Struct containing private data relating to the instance. You should not need to use this data.
Definition: AAX_CMonolithicParameters.h:199
Extension of the AAX_CEffectParameters class for monolithic VIs and effects.
Definition: AAX_CMonolithicParameters.h:231
virtual void RenderAudio(AAX_SInstrumentRenderInfo *ioRenderInfo, const TParamValPair *inSynchronizedParamValues[], int32_t inNumSynchronizedParamValues)
Definition: AAX_CMonolithicParameters.h:254
void AddSynchronizedParameter(const AAX_IParameter &inParameter)
Definition: AAX_CMonolithicParameters.cpp:50
AAX_CMonolithicParameters(void)
Definition: AAX_CMonolithicParameters.cpp:32
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:114
AAX_Result GenerateCoefficients() AAX_OVERRIDE
Generates and dispatches new coefficient packets.
Definition: AAX_CMonolithicParameters.cpp:75
static AAX_Result StaticDescribe(AAX_IEffectDescriptor *ioDescriptor, const AAX_SInstrumentSetupInfo &setupInfo)
Definition: AAX_CMonolithicParameters.cpp:142
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:57
std::pair< AAX_CParamID const, const AAX_IParameterValue * > TParamValPair
Definition: AAX_CMonolithicParameters.h:237
AAX_Result TimerWakeup() AAX_OVERRIDE
Periodic wakeup callback for idle-time operations.
Definition: AAX_CMonolithicParameters.cpp:133
~AAX_CMonolithicParameters(void) AAX_OVERRIDE
Definition: AAX_CMonolithicParameters.cpp:44
static void AAX_CALLBACK StaticRenderAudio(AAX_SInstrumentRenderInfo *const inInstancesBegin[], const void *inInstancesEnd)
Definition: AAX_CMonolithicParameters.cpp:246