DISTRHO Juice Plugins
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.

129 lines
3.2KB

  1. /*
  2. * Stutter Juice Plugin
  3. * Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #ifndef STUTTERJUICEUI_HPP_INCLUDED
  18. #define STUTTERJUICEUI_HPP_INCLUDED
  19. #include "DistrhoUI.hpp"
  20. #include "Geometry.hpp"
  21. #include "ImageAboutWindow.hpp"
  22. #include "ImageButton.hpp"
  23. #include "ImageKnob.hpp"
  24. #include "ImageSlider.hpp"
  25. #include "StutterJuiceArtwork.hpp"
  26. #include "StutterJuicePlugin.hpp"
  27. using DGL::Image;
  28. using DGL::ImageAboutWindow;
  29. using DGL::ImageButton;
  30. using DGL::ImageKnob;
  31. using DGL::ImageSlider;
  32. using DGL::Rectangle;
  33. START_NAMESPACE_DISTRHO
  34. // -----------------------------------------------------------------------
  35. class StutterJuiceUI : public UI,
  36. public ImageButton::Callback,
  37. public ImageSlider::Callback
  38. {
  39. public:
  40. StutterJuiceUI();
  41. protected:
  42. // -------------------------------------------------------------------
  43. // Information
  44. uint d_getWidth() const noexcept override
  45. {
  46. return StutterJuiceArtwork::backgroundWidth;
  47. }
  48. uint d_getHeight() const noexcept override
  49. {
  50. return StutterJuiceArtwork::backgroundHeight;
  51. }
  52. // -------------------------------------------------------------------
  53. // DSP Callbacks
  54. void d_parameterChanged(uint32_t index, float value) override;
  55. void d_programChanged(uint32_t index) override;
  56. // -------------------------------------------------------------------
  57. // Widget Callbacks
  58. void imageButtonClicked(ImageButton* button, int) override;
  59. void imageSliderDragStarted(ImageSlider* slider) override;
  60. void imageSliderDragFinished(ImageSlider* slider) override;
  61. void imageSliderValueChanged(ImageSlider* slider, float value) override;
  62. void onDisplay() override;
  63. private:
  64. Image fImgBackground;
  65. Image fImgOverlay;
  66. ImageAboutWindow fAboutWindow;
  67. float outputParams[9];
  68. void drawLFOs() {
  69. int oX = 18;
  70. int oY = 67;
  71. int wX = 223;
  72. wX /=4;
  73. int wY = 26;
  74. int mX = 228;
  75. int mY = 116;
  76. wX = 221+2;
  77. wY = 111;
  78. // set color
  79. for (int y=0; y<3; y++) {
  80. for (int x=0; x<3; x++) {
  81. if (outputParams[x+y*3]!=0) {
  82. glColor4f(0.0f, 0.0f, 1.0f, 0.5f - outputParams[x+y*3]/2);
  83. glBegin(GL_POLYGON);
  84. glVertex2i(oX+x*mX, oY+y*mY);
  85. glVertex2i(oX+x*mX, oY+y*mY+wY);
  86. glVertex2i(oX+x*mX+wX, oY+y*mY+wY);
  87. glVertex2i(oX+x*mX+wX, oY+y*mY);
  88. glEnd();
  89. }
  90. }
  91. }
  92. // reset color
  93. glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  94. }
  95. //sliders
  96. ScopedPointer<ImageSlider> fSliders[9][3];
  97. ScopedPointer<ImageButton> fButtonAbout;
  98. };
  99. // -----------------------------------------------------------------------
  100. END_NAMESPACE_DISTRHO
  101. #endif // TRIGGERJUICEUI_HPP_INCLUDED