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.

83 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI 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. SliderPropertyComponent::SliderPropertyComponent (const String& name,
  18. const double rangeMin,
  19. const double rangeMax,
  20. const double interval,
  21. const double skewFactor,
  22. bool symmetricSkew)
  23. : PropertyComponent (name)
  24. {
  25. addAndMakeVisible (slider);
  26. slider.setRange (rangeMin, rangeMax, interval);
  27. slider.setSkewFactor (skewFactor, symmetricSkew);
  28. slider.setSliderStyle (Slider::LinearBar);
  29. slider.addListener (this);
  30. }
  31. SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl,
  32. const String& name,
  33. const double rangeMin,
  34. const double rangeMax,
  35. const double interval,
  36. const double skewFactor,
  37. bool symmetricSkew)
  38. : PropertyComponent (name)
  39. {
  40. addAndMakeVisible (slider);
  41. slider.setRange (rangeMin, rangeMax, interval);
  42. slider.setSkewFactor (skewFactor, symmetricSkew);
  43. slider.setSliderStyle (Slider::LinearBar);
  44. slider.getValueObject().referTo (valueToControl);
  45. }
  46. SliderPropertyComponent::~SliderPropertyComponent()
  47. {
  48. }
  49. void SliderPropertyComponent::setValue (const double /*newValue*/)
  50. {
  51. }
  52. double SliderPropertyComponent::getValue() const
  53. {
  54. return slider.getValue();
  55. }
  56. void SliderPropertyComponent::refresh()
  57. {
  58. slider.setValue (getValue(), dontSendNotification);
  59. }
  60. void SliderPropertyComponent::sliderValueChanged (Slider*)
  61. {
  62. if (getValue() != slider.getValue())
  63. setValue (slider.getValue());
  64. }