AudioProcessorParameterWithID pre-dates HostedAudioProcessorParameter, which is why AudioProcessorParameterWithID was initially used for this purpose.v7.0.9
@@ -1150,8 +1150,8 @@ private: | |||||
auto getParameterIdentifier = [¶meter] | auto getParameterIdentifier = [¶meter] | ||||
{ | { | ||||
if (const auto* paramWithID = dynamic_cast<const AudioProcessorParameterWithID*> (¶meter)) | |||||
return paramWithID->paramID; | |||||
if (const auto* paramWithID = dynamic_cast<const HostedAudioProcessorParameter*> (¶meter)) | |||||
return paramWithID->getParameterID(); | |||||
// This could clash if any groups have been given integer IDs! | // This could clash if any groups have been given integer IDs! | ||||
return String (parameter.getParameterIndex()); | return String (parameter.getParameterIndex()); | ||||
@@ -29,7 +29,7 @@ namespace juce | |||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") | JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") | ||||
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996) | JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4996) | ||||
class LegacyAudioParameter : public AudioProcessorParameter | |||||
class LegacyAudioParameter : public HostedAudioProcessorParameter | |||||
{ | { | ||||
public: | public: | ||||
LegacyAudioParameter (AudioProcessor& audioProcessorToUse, int audioParameterIndex) | LegacyAudioParameter (AudioProcessor& audioProcessorToUse, int audioParameterIndex) | ||||
@@ -54,7 +54,7 @@ public: | |||||
bool isMetaParameter() const override { return processor->isMetaParameter (parameterIndex); } | bool isMetaParameter() const override { return processor->isMetaParameter (parameterIndex); } | ||||
Category getCategory() const override { return processor->getParameterCategory (parameterIndex); } | Category getCategory() const override { return processor->getParameterCategory (parameterIndex); } | ||||
String getCurrentValueAsText() const override { return processor->getParameterText (parameterIndex); } | String getCurrentValueAsText() const override { return processor->getParameterText (parameterIndex); } | ||||
String getParamID() const { return processor->getParameterID (parameterIndex); } | |||||
String getParameterID() const override { return processor->getParameterID (parameterIndex); } | |||||
//============================================================================== | //============================================================================== | ||||
float getValueForText (const String&) const override | float getValueForText (const String&) const override | ||||
@@ -101,12 +101,12 @@ public: | |||||
static String getParamID (const AudioProcessorParameter* param, bool forceLegacyParamIDs) noexcept | static String getParamID (const AudioProcessorParameter* param, bool forceLegacyParamIDs) noexcept | ||||
{ | { | ||||
if (auto* legacy = dynamic_cast<const LegacyAudioParameter*> (param)) | if (auto* legacy = dynamic_cast<const LegacyAudioParameter*> (param)) | ||||
return forceLegacyParamIDs ? String (legacy->parameterIndex) : legacy->getParamID(); | |||||
return forceLegacyParamIDs ? String (legacy->parameterIndex) : legacy->getParameterID(); | |||||
if (auto* paramWithID = dynamic_cast<const AudioProcessorParameterWithID*> (param)) | |||||
if (auto* paramWithID = dynamic_cast<const HostedAudioProcessorParameter*> (param)) | |||||
{ | { | ||||
if (! forceLegacyParamIDs) | if (! forceLegacyParamIDs) | ||||
return paramWithID->paramID; | |||||
return paramWithID->getParameterID(); | |||||
} | } | ||||
if (param != nullptr) | if (param != nullptr) | ||||
@@ -446,11 +446,11 @@ void AudioProcessor::validateParameter (AudioProcessorParameter* param) | |||||
void AudioProcessor::checkForDuplicateTrimmedParamID ([[maybe_unused]] AudioProcessorParameter* param) | void AudioProcessor::checkForDuplicateTrimmedParamID ([[maybe_unused]] AudioProcessorParameter* param) | ||||
{ | { | ||||
#if JUCE_DEBUG && ! JUCE_DISABLE_CAUTIOUS_PARAMETER_ID_CHECKING | #if JUCE_DEBUG && ! JUCE_DISABLE_CAUTIOUS_PARAMETER_ID_CHECKING | ||||
if (auto* withID = dynamic_cast<AudioProcessorParameterWithID*> (param)) | |||||
if (auto* withID = dynamic_cast<HostedAudioProcessorParameter*> (param)) | |||||
{ | { | ||||
constexpr auto maximumSafeAAXParameterIdLength = 31; | constexpr auto maximumSafeAAXParameterIdLength = 31; | ||||
const auto paramID = withID->paramID; | |||||
const auto paramID = withID->getParameterID(); | |||||
// If you hit this assertion, a parameter name is too long to be supported | // If you hit this assertion, a parameter name is too long to be supported | ||||
// by the AAX plugin format. | // by the AAX plugin format. | ||||
@@ -478,9 +478,9 @@ void AudioProcessor::checkForDuplicateTrimmedParamID ([[maybe_unused]] AudioProc | |||||
void AudioProcessor::checkForDuplicateParamID ([[maybe_unused]] AudioProcessorParameter* param) | void AudioProcessor::checkForDuplicateParamID ([[maybe_unused]] AudioProcessorParameter* param) | ||||
{ | { | ||||
#if JUCE_DEBUG | #if JUCE_DEBUG | ||||
if (auto* withID = dynamic_cast<AudioProcessorParameterWithID*> (param)) | |||||
if (auto* withID = dynamic_cast<HostedAudioProcessorParameter*> (param)) | |||||
{ | { | ||||
auto insertResult = paramIDs.insert (withID->paramID); | |||||
auto insertResult = paramIDs.insert (withID->getParameterID()); | |||||
// If you hit this assertion then the parameter ID is not unique | // If you hit this assertion then the parameter ID is not unique | ||||
jassert (insertResult.second); | jassert (insertResult.second); | ||||
@@ -1430,8 +1430,8 @@ const String AudioProcessor::getParameterName (int index) | |||||
String AudioProcessor::getParameterID (int index) | String AudioProcessor::getParameterID (int index) | ||||
{ | { | ||||
// Don't use getParamChecked here, as this must also work for legacy plug-ins | // Don't use getParamChecked here, as this must also work for legacy plug-ins | ||||
if (auto* p = dynamic_cast<AudioProcessorParameterWithID*> (getParameters()[index])) | |||||
return p->paramID; | |||||
if (auto* p = dynamic_cast<HostedAudioProcessorParameter*> (getParameters()[index])) | |||||
return p->getParameterID(); | |||||
return String (index); | return String (index); | ||||
} | } | ||||