//============================================================================== AudioParameterChoice::AudioParameterChoice (String pid, String nm, const StringArray& c, int def) : AudioProcessorParameterWithID (pid, nm), choices (c), value ((float) def), defaultValue (convertTo0to1 (def)) { jassert (choices.size() > 0); // you must supply an actual set of items to choose from! }
AudioParameterChoice& AudioParameterChoice::operator= (int newValue) { if (getIndex() != newValue) setValueNotifyingHost (convertTo0to1 (newValue)); return *this; }
AudioParameterInt& AudioParameterInt::operator= (int newValue) { if (get() != newValue) setValueNotifyingHost (convertTo0to1 (newValue)); return *this; }
//============================================================================== AudioParameterInt::AudioParameterInt (String pid, String nm, int mn, int mx, int def) : AudioProcessorParameterWithID (pid, nm), minValue (mn), maxValue (mx), value ((float) def), defaultValue (convertTo0to1 (def)) { jassert (minValue < maxValue); // must have a non-zero range of values! }
//============================================================================== AudioParameterChoice::AudioParameterChoice (const String& idToUse, const String& nameToUse, const StringArray& c, int def, const String& labelToUse) : AudioProcessorParameterWithID (idToUse, nameToUse, labelToUse), choices (c), value ((float) def), defaultValue (convertTo0to1 (def)) { jassert (choices.size() > 0); // you must supply an actual set of items to choose from! }
AudioParameterInt& AudioParameterInt::operator= (int newValue) { const float normalisedValue = convertTo0to1 (newValue); if (value != normalisedValue) setValueNotifyingHost (normalisedValue); return *this; }
//============================================================================== AudioParameterInt::AudioParameterInt (const String& idToUse, const String& nameToUse, int mn, int mx, int def, const String& labelToUse) : AudioProcessorParameterWithID (idToUse, nameToUse, labelToUse), minValue (mn), maxValue (mx), value ((float) def), defaultValue (convertTo0to1 (def)) { jassert (minValue < maxValue); // must have a non-zero range of values! }
float AudioParameterInt::getValueForText (const String& text) const { return convertTo0to1 (text.getIntValue()); }
float AudioParameterInt::getValue() const { return convertTo0to1 (roundToInt (value)); }
float AudioParameterChoice::getValueForText (const String& text) const { return convertTo0to1 (choices.indexOf (text)); }