From d01a5082174992238064bc7e615c93109f972cb2 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 28 May 2014 16:44:02 +0100 Subject: [PATCH] Added a method AudioProcessor::isParameterInverted(), and support for this in AAX/RTAS --- modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp | 8 +++++++- .../juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp | 5 +++-- .../processors/juce_AudioProcessor.cpp | 7 ++++--- .../processors/juce_AudioProcessor.h | 8 +++++--- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp index 624e657624..f290d6b853 100644 --- a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp @@ -835,7 +835,7 @@ struct AAXClasses AAX_IParameter* parameter = new AAX_CParameter (IndexAsParamID (parameterIndex), audioProcessor.getParameterName (parameterIndex, 31).toRawUTF8(), - audioProcessor.getParameter (parameterIndex), + audioProcessor.getParameterDefaultValue (parameterIndex), AAX_CLinearTaperDelegate(), AAX_CNumberDisplayDelegate(), audioProcessor.isParameterAutomatable (parameterIndex)); @@ -847,6 +847,12 @@ struct AAXClasses parameter->SetType (parameterNumSteps > 1000 ? AAX_eParameterType_Continuous : AAX_eParameterType_Discrete); + parameter->SetOrientation (audioProcessor.isParameterOrientationInverted (parameterIndex) + ? (AAX_eParameterOrientation_RightMinLeftMax | AAX_eParameterOrientation_TopMinBottomMax + | AAX_eParameterOrientation_RotarySingleDotMode | AAX_eParameterOrientation_RotaryRightMinLeftMax) + : (AAX_eParameterOrientation_LeftMinRightMax | AAX_eParameterOrientation_BottomMinTopMax + | AAX_eParameterOrientation_RotarySingleDotMode | AAX_eParameterOrientation_RotaryLeftMinRightMax)); + mParameterManager.AddParameter (parameter); } } diff --git a/modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp b/modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp index 3ebefdc6b7..e3ccc2cb85 100644 --- a/modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp @@ -856,8 +856,9 @@ private: long GetOrientation() const { - return kDAE_LeftMinRightMax | kDAE_BottomMinTopMax - | kDAE_RotarySingleDotMode | kDAE_RotaryLeftMinRightMax; + return juceFilter->isParameterOrientationInverted (index) + ? kDAE_RightMinLeftMax | kDAE_TopMinBottomMax | kDAE_RotarySingleDotMode | kDAE_RotaryRightMinLeftMax + : kDAE_LeftMinRightMax | kDAE_BottomMinTopMax | kDAE_RotarySingleDotMode | kDAE_RotaryLeftMinRightMax; } long GetControlType() const { return kDAE_ContinuousValues; } diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp index 501fedf43d..86f2e8199f 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp @@ -201,9 +201,10 @@ void AudioProcessor::updateHostDisplay() l->audioProcessorChanged (this); } -String AudioProcessor::getParameterLabel (int) const { return String(); } -bool AudioProcessor::isParameterAutomatable (int) const { return true; } -bool AudioProcessor::isMetaParameter (int) const { return false; } +String AudioProcessor::getParameterLabel (int) const { return String(); } +bool AudioProcessor::isParameterOrientationInverted (int) const { return false; } +bool AudioProcessor::isParameterAutomatable (int) const { return true; } +bool AudioProcessor::isMetaParameter (int) const { return false; } void AudioProcessor::suspendProcessing (const bool shouldBeSuspended) { diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h index 867a3924f9..cec25c0b79 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.h @@ -431,6 +431,11 @@ public: */ virtual String getParameterLabel (int index) const; + /** This can be overridden to tell the host that particular parameters operate in the + reverse direction. (Not all plugin formats or hosts will actually use this information). + */ + virtual bool isParameterOrientationInverted (int index) const; + /** The host will call this method to change the value of one of the filter's parameters. The host may call this at any time, including during the audio processing @@ -459,16 +464,13 @@ public: void setParameterNotifyingHost (int parameterIndex, float newValue); /** Returns true if the host can automate this parameter. - By default, this returns true for all parameters. */ virtual bool isParameterAutomatable (int parameterIndex) const; /** Should return true if this parameter is a "meta" parameter. - A meta-parameter is a parameter that changes other params. It is used by some hosts (e.g. AudioUnit hosts). - By default this returns false. */ virtual bool isMetaParameter (int parameterIndex) const;