Browse Source

AAX: Added support for EQ curve graphs via a new AudioProcessor callback AudioProcessor::getAAXCurve

tags/2021-05-28
hogliux 7 years ago
parent
commit
4d0b1167f0
2 changed files with 125 additions and 0 deletions
  1. +97
    -0
      modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp
  2. +28
    -0
      modules/juce_audio_processors/processors/juce_AudioProcessor.h

+ 97
- 0
modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp View File

@@ -1704,6 +1704,103 @@ namespace AAXClasses
updateSidechainState();
}
//==============================================================================
static AudioProcessor::CurveData::Type aaxCurveTypeToJUCE (AAX_CTypeID type) noexcept
{
switch (type)
{
case AAX_eCurveType_EQ: return AudioProcessor::CurveData::Type::EQ;
case AAX_eCurveType_Dynamics: return AudioProcessor::CurveData::Type::Dynamics;
case AAX_eCurveType_Reduction: return AudioProcessor::CurveData::Type::GainReduction;
default: break;
}
return AudioProcessor::CurveData::Type::Unknown;
}
uint32_t getAAXMeterIdForParamId (const String& paramID) const noexcept
{
int idx;
for (idx = 0; idx < aaxMeters.size(); ++idx)
if (LegacyAudioParameter::getParamID (aaxMeters[idx], false) == paramID)
break;
// you sepecified a parameter id in your curve but the parameter does not have the meter
// category
jassert (idx < aaxMeters.size());
return 'Metr' + static_cast<AAX_CTypeID> (idx);
}
//==============================================================================
AAX_Result GetCurveData (AAX_CTypeID iCurveType, const float * iValues, uint32_t iNumValues, float * oValues ) const override
{
auto curveType = aaxCurveTypeToJUCE (iCurveType);
if (curveType != AudioProcessor::CurveData::Type::Unknown)
{
auto& audioProcessor = getPluginInstance();
auto curve = audioProcessor.getAAXCurve (curveType);
if (curve.curve)
{
if (oValues != nullptr && iValues != nullptr)
{
for (int i = 0; i < iNumValues; ++i)
oValues[i] = curve.curve (iValues[i]);
}
return AAX_SUCCESS;
}
}
return AAX_ERROR_UNIMPLEMENTED;
}
AAX_Result GetCurveDataMeterIds (AAX_CTypeID iCurveType, uint32_t *oXMeterId, uint32_t *oYMeterId) const override
{
auto curveType = aaxCurveTypeToJUCE (iCurveType);
if (curveType != AudioProcessor::CurveData::Type::Unknown)
{
auto& audioProcessor = getPluginInstance();
auto curve = audioProcessor.getAAXCurve (curveType);
if (curve.curve && curve.xMeterID.isNotEmpty() && curve.yMeterID.isNotEmpty())
{
if (oXMeterId != nullptr) *oXMeterId = getAAXMeterIdForParamId (curve.xMeterID);
if (oYMeterId != nullptr) *oYMeterId = getAAXMeterIdForParamId (curve.yMeterID);
return AAX_SUCCESS;
}
}
return AAX_ERROR_UNIMPLEMENTED;
}
AAX_Result GetCurveDataDisplayRange (AAX_CTypeID iCurveType, float *oXMin, float *oXMax, float *oYMin, float *oYMax) const override
{
auto curveType = aaxCurveTypeToJUCE (iCurveType);
if (curveType != AudioProcessor::CurveData::Type::Unknown)
{
auto& audioProcessor = getPluginInstance();
auto curve = audioProcessor.getAAXCurve (curveType);
if (curve.curve)
{
if (oXMin != nullptr) *oXMin = curve.xRange.getStart();
if (oXMax != nullptr) *oXMax = curve.xRange.getEnd();
if (oYMin != nullptr) *oYMin = curve.yRange.getStart();
if (oYMax != nullptr) *oYMax = curve.yRange.getEnd();
return AAX_SUCCESS;
}
}
return AAX_ERROR_UNIMPLEMENTED;
}
//==============================================================================
inline int getParamIndexFromID (AAX_CParamID paramID) const noexcept
{


+ 28
- 0
modules/juce_audio_processors/processors/juce_AudioProcessor.h View File

@@ -1338,6 +1338,34 @@ public:
const AudioChannelSet& mainOutputLayout,
bool idForAudioSuite) const;
//==============================================================================
/** AAX support sharing curve data with the host so that it can display this curve
on a console or in the mixer panel. For example, ProTools allows you to see the
total EQ curve of a track. It does this by interrogating each plug-in for their
internal EQ curve. */
struct CurveData
{
enum class Type : int
{
EQ, // an EQ curve - input is in Hz, output is in dB
Dynamics, // a dynamics curve - input and output is in dB
GainReduction, // a gain reduction curve - input and output is in dB
Unknown = -1
};
std::function<float (float)> curve; // a function which represents your curve (such as an eq)
Range<float> xRange, yRange; // the data range of your curve
// For some curve types, your plug-in may already measure the current input and output values.
// An AAX host can use to indicate where on the curve the current signal is (for example
// by putting a dot on the curve). Simply leave these strings empty if you do not want to
// support this.
String xMeterID, yMeterID;
};
virtual CurveData getAAXCurve (CurveData::Type /*curveType*/) const { return {}; }
//==============================================================================
/** Not for public use - this is called before deleting an editor component. */
void editorBeingDeleted (AudioProcessorEditor*) noexcept;


Loading…
Cancel
Save