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.

80 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. /**
  18. A subclass of AudioProcessorParameter that provides an easy way to create a
  19. parameter which maps onto a given NormalisableRange.
  20. @see AudioParameterInt, AudioParameterBool, AudioParameterChoice
  21. */
  22. class JUCE_API AudioParameterFloat : public AudioProcessorParameterWithID
  23. {
  24. public:
  25. /** Creates a AudioParameterFloat with an ID, name, and range.
  26. On creation, its value is set to the default value.
  27. */
  28. AudioParameterFloat (String parameterID, String name,
  29. NormalisableRange<float> normalisableRange,
  30. float defaultValue);
  31. /** Creates a AudioParameterFloat with an ID, name, and range.
  32. On creation, its value is set to the default value.
  33. For control over skew factors, you can use the other
  34. constructor and provide a NormalisableRange.
  35. */
  36. AudioParameterFloat (String parameterID, String name,
  37. float minValue,
  38. float maxValue,
  39. float defaultValue);
  40. /** Destructor. */
  41. ~AudioParameterFloat();
  42. /** Returns the parameter's current value. */
  43. float get() const noexcept { return value; }
  44. /** Returns the parameter's current value. */
  45. operator float() const noexcept { return value; }
  46. /** Changes the parameter's current value. */
  47. AudioParameterFloat& operator= (float newValue);
  48. /** Provides access to the parameter's range. */
  49. NormalisableRange<float> range;
  50. private:
  51. //==============================================================================
  52. float value, defaultValue;
  53. float getValue() const override;
  54. void setValue (float newValue) override;
  55. float getDefaultValue() const override;
  56. int getNumSteps() const override;
  57. String getText (float, int) const override;
  58. float getValueForText (const String&) const override;
  59. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioParameterFloat)
  60. };