diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index c01b38d4e0..284215d7c3 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -1140,10 +1140,8 @@ public: bool isValidChannel (int index, bool isInput) const { - if (isInput) - return index < getNumInputChannels(); - else - return index < getNumOutputChannels(); + return isInput ? (index < getNumInputChannels()) + : (index < getNumOutputChannels()); } //============================================================================== @@ -1183,33 +1181,9 @@ public: } } - const String getParameterName (int index) - { - if (effect != nullptr) - { - jassert (index >= 0 && index < effect->numParams); - - char nm [256] = { 0 }; - dispatch (effGetParamName, index, 0, nm, 0); - return String (nm).trim(); - } - - return String::empty; - } - - const String getParameterText (int index) - { - if (effect != nullptr) - { - jassert (index >= 0 && index < effect->numParams); - - char nm [256] = { 0 }; - dispatch (effGetParamDisplay, index, 0, nm, 0); - return String (nm).trim(); - } - - return String::empty; - } + const String getParameterName (int index) { return getTextForOpcode (index, effGetParamName); } + const String getParameterText (int index) { return getTextForOpcode (index, effGetParamDisplay); } + String getParameterLabel (int index) const { return getTextForOpcode (index, effGetParamLabel); } bool isParameterAutomatable (int index) const { @@ -1720,6 +1694,17 @@ private: return false; } + String getTextForOpcode (const int index, const AEffectOpcodes opcode) const + { + if (effect == nullptr) + return String::empty; + + jassert (index >= 0 && index < effect->numParams); + char nm [256] = { 0 }; + dispatch (opcode, index, 0, nm, 0); + return String (CharPointer_UTF8 (nm)).trim(); + } + String getCurrentProgramName() { String name; @@ -1820,20 +1805,6 @@ private: setParameter (i, p[i]); } - String getParameterLabel (int index) const - { - if (effect != nullptr) - { - jassert (index >= 0 && index < effect->numParams); - - char nm [256] = { 0 }; - dispatch (effGetParamLabel, index, 0, nm, 0); - return String (nm).trim(); - } - - return String::empty; - } - VstIntPtr getVstDirectory() const { #if JUCE_MAC