Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. /**
  16. This abstract base class is used by some AudioProcessorParameter helper classes.
  17. @see AudioParameterFloat, AudioParameterInt, AudioParameterBool, AudioParameterChoice
  18. @tags{Audio}
  19. */
  20. class JUCE_API RangedAudioParameter : public AudioProcessorParameterWithID
  21. {
  22. public:
  23. /** The creation of this object requires providing a name and ID which will be
  24. constant for its lifetime.
  25. */
  26. RangedAudioParameter (const String& parameterID,
  27. const String& parameterName,
  28. const String& parameterLabel = {},
  29. Category parameterCategory = AudioProcessorParameter::genericParameter);
  30. /** Returns the range of values that the parameter can take. */
  31. virtual const NormalisableRange<float>& getNormalisableRange() const = 0;
  32. /** Returns the number of steps for this parameter based on the normalisable range's interval.
  33. If you are using lambda functions to define the normalisable range's snapping behaviour
  34. then you should override this function so that it returns the number of snapping points.
  35. */
  36. int getNumSteps() const override;
  37. /** Normalises and snaps a value based on the normalisable range. */
  38. float convertTo0to1 (float v) const noexcept;
  39. /** Denormalises and snaps a value based on the normalisable range. */
  40. float convertFrom0to1 (float v) const noexcept;
  41. };
  42. } // namespace juce