mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-21 01:24:21 +00:00
Fixed 4dcce50 to support AudioProcessor based parameter selection
This commit is contained in:
parent
05624e8354
commit
f346de10c3
3 changed files with 37 additions and 39 deletions
|
|
@ -1319,14 +1319,12 @@ namespace AAXClasses
|
|||
|
||||
for (int parameterIndex = 0; parameterIndex < numParameters; ++parameterIndex)
|
||||
{
|
||||
auto* processorParam = audioProcessor.getParameters().getUnchecked (parameterIndex);
|
||||
|
||||
const AudioProcessorParameter::Category category = processorParam->getCategory();
|
||||
const AudioProcessorParameter::Category category = audioProcessor.getParameterCategory (parameterIndex);
|
||||
|
||||
aaxParamIDs.add (usingManagedParameters ? audioProcessor.getParameterID (parameterIndex)
|
||||
: String (parameterIndex));
|
||||
|
||||
AAX_CString paramName (processorParam->getName (31).toRawUTF8());
|
||||
AAX_CString paramName (audioProcessor.getParameterName (parameterIndex, 31).toRawUTF8());
|
||||
AAX_CParamID paramID = aaxParamIDs.getReference (parameterIndex).getCharPointer();
|
||||
|
||||
paramMap.set (AAXClasses::getAAXParamHash (paramID), parameterIndex);
|
||||
|
|
@ -1341,25 +1339,25 @@ namespace AAXClasses
|
|||
AAX_IParameter* parameter
|
||||
= new AAX_CParameter<float> (paramID,
|
||||
paramName,
|
||||
processorParam->getDefaultValue(),
|
||||
audioProcessor.getParameterDefaultValue (parameterIndex),
|
||||
AAX_CLinearTaperDelegate<float, 0>(),
|
||||
AAX_CNumberDisplayDelegate<float, 3>(),
|
||||
audioProcessor.isParameterAutomatable (parameterIndex));
|
||||
|
||||
parameter->AddShortenedName (processorParam->getName (4).toRawUTF8());
|
||||
parameter->AddShortenedName (audioProcessor.getParameterName (parameterIndex, 4).toRawUTF8());
|
||||
|
||||
const int parameterNumSteps = processorParam->getNumSteps();
|
||||
const int parameterNumSteps = audioProcessor.getParameterNumSteps (parameterIndex);
|
||||
parameter->SetNumberOfSteps ((uint32_t) parameterNumSteps);
|
||||
|
||||
#if JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE
|
||||
parameter->SetType (parameterNumSteps > 1000 ? AAX_eParameterType_Continuous
|
||||
: AAX_eParameterType_Discrete);
|
||||
#else
|
||||
parameter->SetType (processorParam->isDiscrete() ? AAX_eParameterType_Discrete
|
||||
: AAX_eParameterType_Continuous);
|
||||
parameter->SetType (audioProcessor.isParameterDiscrete (parameterIndex) ? AAX_eParameterType_Discrete
|
||||
: AAX_eParameterType_Continuous);
|
||||
#endif
|
||||
|
||||
parameter->SetOrientation (processorParam->isOrientationInverted()
|
||||
parameter->SetOrientation (audioProcessor.isParameterOrientationInverted (parameterIndex)
|
||||
? (AAX_eParameterOrientation_RightMinLeftMax | AAX_eParameterOrientation_TopMinBottomMax
|
||||
| AAX_eParameterOrientation_RotarySingleDotMode | AAX_eParameterOrientation_RotaryRightMinLeftMax)
|
||||
: (AAX_eParameterOrientation_LeftMinRightMax | AAX_eParameterOrientation_BottomMinTopMax
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ public:
|
|||
const String text (String::fromCFString (pv->inString));
|
||||
|
||||
if (AudioProcessorParameter* param = juceFilter->getParameters() [paramID])
|
||||
pv->outValue = param->getValueForText (text) * getMaximumParameterValue (param);
|
||||
pv->outValue = param->getValueForText (text) * getMaximumParameterValue (paramID);
|
||||
else
|
||||
pv->outValue = text.getFloatValue();
|
||||
|
||||
|
|
@ -546,7 +546,7 @@ public:
|
|||
String text;
|
||||
|
||||
if (AudioProcessorParameter* param = juceFilter->getParameters() [paramID])
|
||||
text = param->getText (value / getMaximumParameterValue (param), 0);
|
||||
text = param->getText (value / getMaximumParameterValue (paramID), 0);
|
||||
else
|
||||
text = String (value);
|
||||
|
||||
|
|
@ -805,13 +805,13 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
// When parameters are discrete we need to use integer values.
|
||||
static float getMaximumParameterValue (AudioProcessorParameter* param)
|
||||
float getMaximumParameterValue (int parameterIndex)
|
||||
{
|
||||
#if JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE
|
||||
ignoreUnused (param);
|
||||
ignoreUnused (parameterIndex);
|
||||
return 1.0f;
|
||||
#else
|
||||
return param->isDiscrete() ? (float) (param->getNumSteps() - 1) : 1.0f;
|
||||
return juceFilter->isParameterDiscrete (parameterIndex) ? (float) (juceFilter->getParameterNumSteps (parameterIndex) - 1) : 1.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -835,22 +835,22 @@ public:
|
|||
outParameterInfo.flags |= (UInt32) kAudioUnitParameterFlag_IsHighResolution;
|
||||
#endif
|
||||
|
||||
auto* param = juceFilter->getParameters().getUnchecked (index);
|
||||
|
||||
const String name (param->getName (512));
|
||||
const String name (juceFilter->getParameterName (index));
|
||||
|
||||
// Set whether the param is automatable (unnamed parameters aren't allowed to be automated)
|
||||
if (name.isEmpty() || ! param->isAutomatable())
|
||||
if (name.isEmpty() || ! juceFilter->isParameterAutomatable (index))
|
||||
outParameterInfo.flags |= kAudioUnitParameterFlag_NonRealTime;
|
||||
|
||||
if (! param->isDiscrete())
|
||||
const bool isParameterDiscrete = juceFilter->isParameterDiscrete (index);
|
||||
|
||||
if (! isParameterDiscrete)
|
||||
outParameterInfo.flags |= kAudioUnitParameterFlag_CanRamp;
|
||||
|
||||
if (param->isMetaParameter())
|
||||
if (juceFilter->isMetaParameter (index))
|
||||
outParameterInfo.flags |= kAudioUnitParameterFlag_IsGlobalMeta;
|
||||
|
||||
// Is this a meter?
|
||||
if (((param->getCategory() & 0xffff0000) >> 16) == 2)
|
||||
if (((juceFilter->getParameterCategory (index) & 0xffff0000) >> 16) == 2)
|
||||
{
|
||||
outParameterInfo.flags &= ~kAudioUnitParameterFlag_IsWritable;
|
||||
outParameterInfo.flags |= kAudioUnitParameterFlag_MeterReadOnly | kAudioUnitParameterFlag_DisplayLogarithmic;
|
||||
|
|
@ -859,7 +859,7 @@ public:
|
|||
else
|
||||
{
|
||||
#if ! JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE
|
||||
outParameterInfo.unit = param->isDiscrete() ? kAudioUnitParameterUnit_Indexed
|
||||
outParameterInfo.unit = isParameterDiscrete ? kAudioUnitParameterUnit_Indexed
|
||||
: kAudioUnitParameterUnit_Generic;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -867,8 +867,8 @@ public:
|
|||
MusicDeviceBase::FillInParameterName (outParameterInfo, name.toCFString(), true);
|
||||
|
||||
outParameterInfo.minValue = 0.0f;
|
||||
outParameterInfo.maxValue = getMaximumParameterValue (param);
|
||||
outParameterInfo.defaultValue = param->getDefaultValue();
|
||||
outParameterInfo.maxValue = getMaximumParameterValue (index);
|
||||
outParameterInfo.defaultValue = juceFilter->getParameterDefaultValue (index);
|
||||
jassert (outParameterInfo.defaultValue >= outParameterInfo.minValue
|
||||
&& outParameterInfo.defaultValue <= outParameterInfo.maxValue);
|
||||
|
||||
|
|
@ -885,9 +885,10 @@ public:
|
|||
{
|
||||
if (inScope == kAudioUnitScope_Global && juceFilter != nullptr)
|
||||
{
|
||||
auto* param = juceFilter->getParameters().getUnchecked (getJuceIndexForAUParameterID (inID));
|
||||
const auto index = getJuceIndexForAUParameterID (inID);
|
||||
auto* param = juceFilter->getParameters().getUnchecked (index);
|
||||
|
||||
outValue = param->getValue() * getMaximumParameterValue (param);
|
||||
outValue = param->getValue() * getMaximumParameterValue (index);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
|
@ -902,9 +903,10 @@ public:
|
|||
{
|
||||
if (inScope == kAudioUnitScope_Global && juceFilter != nullptr)
|
||||
{
|
||||
auto* param = juceFilter->getParameters().getUnchecked (getJuceIndexForAUParameterID (inID));
|
||||
const auto index = getJuceIndexForAUParameterID (inID);
|
||||
auto* param = juceFilter->getParameters().getUnchecked (index);
|
||||
|
||||
param->setValue (inValue / getMaximumParameterValue (param));
|
||||
param->setValue (inValue / getMaximumParameterValue (index));
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,31 +205,29 @@ public:
|
|||
{
|
||||
info.id = paramID;
|
||||
|
||||
auto* param = p.getParameters().getUnchecked (index);
|
||||
|
||||
toString128 (info.title, param->getName (128));
|
||||
toString128 (info.shortTitle, param->getName (8));
|
||||
toString128 (info.units, param->getLabel());
|
||||
toString128 (info.title, p.getParameterName (index));
|
||||
toString128 (info.shortTitle, p.getParameterName (index, 8));
|
||||
toString128 (info.units, p.getParameterLabel (index));
|
||||
|
||||
info.stepCount = (Steinberg::int32) 0;
|
||||
|
||||
#if ! JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE
|
||||
if (param->isDiscrete())
|
||||
if (p.isParameterDiscrete (index))
|
||||
#endif
|
||||
{
|
||||
const int numSteps = param->getNumSteps();
|
||||
const int numSteps = p.getParameterNumSteps (index);
|
||||
info.stepCount = (Steinberg::int32) (numSteps > 0 && numSteps < 0x7fffffff ? numSteps - 1 : 0);
|
||||
}
|
||||
|
||||
info.defaultNormalizedValue = param->getDefaultValue();
|
||||
info.defaultNormalizedValue = p.getParameterDefaultValue (index);
|
||||
jassert (info.defaultNormalizedValue >= 0 && info.defaultNormalizedValue <= 1.0f);
|
||||
info.unitId = Vst::kRootUnitId;
|
||||
|
||||
// Is this a meter?
|
||||
if (((param->getCategory() & 0xffff0000) >> 16) == 2)
|
||||
if (((p.getParameterCategory (index) & 0xffff0000) >> 16) == 2)
|
||||
info.flags = Vst::ParameterInfo::kIsReadOnly;
|
||||
else
|
||||
info.flags = param->isAutomatable() ? Vst::ParameterInfo::kCanAutomate : 0;
|
||||
info.flags = p.isParameterAutomatable (index) ? Vst::ParameterInfo::kCanAutomate : 0;
|
||||
|
||||
valueNormalized = info.defaultNormalizedValue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue