1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

VST parameter name refactoring + UTF8 handling.

This commit is contained in:
jules 2012-11-25 11:30:02 +00:00
parent d547fc0b98
commit fd2011ee8b

View file

@ -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