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.

109 lines
2.7KB

  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 "ImageWidgets.hpp"
  21. using DGL::Image;
  22. using DGL::ImageAboutWindow;
  23. using DGL::ImageButton;
  24. using DGL::ImageKnob;
  25. using DGL::ImageSlider;
  26. using DGL::Rectangle;
  27. START_NAMESPACE_DISTRHO
  28. // -----------------------------------------------------------------------
  29. class StutterJuiceUI : public UI,
  30. public ImageButton::Callback,
  31. public ImageSlider::Callback
  32. {
  33. public:
  34. StutterJuiceUI();
  35. protected:
  36. // -------------------------------------------------------------------
  37. // DSP Callbacks
  38. void parameterChanged(uint32_t index, float value) override;
  39. void programLoaded(uint32_t index) override;
  40. // -------------------------------------------------------------------
  41. // Widget Callbacks
  42. void imageButtonClicked(ImageButton* button, int) override;
  43. void imageSliderDragStarted(ImageSlider* slider) override;
  44. void imageSliderDragFinished(ImageSlider* slider) override;
  45. void imageSliderValueChanged(ImageSlider* slider, float value) override;
  46. void onDisplay() override;
  47. private:
  48. Image fImgBackground;
  49. Image fImgOverlay;
  50. ImageAboutWindow fAboutWindow;
  51. float outputParams[9];
  52. void drawLFOs() {
  53. int oX = 18;
  54. int oY = 67;
  55. int wX = 223;
  56. wX /=4;
  57. int wY = 26;
  58. int mX = 228;
  59. int mY = 116;
  60. wX = 221+2;
  61. wY = 111;
  62. // set color
  63. for (int y=0; y<3; y++) {
  64. for (int x=0; x<3; x++) {
  65. if (outputParams[x+y*3]!=0) {
  66. glColor4f(0.0f, 0.0f, 1.0f, 0.5f - outputParams[x+y*3]/2);
  67. glBegin(GL_POLYGON);
  68. glVertex2i(oX+x*mX, oY+y*mY);
  69. glVertex2i(oX+x*mX, oY+y*mY+wY);
  70. glVertex2i(oX+x*mX+wX, oY+y*mY+wY);
  71. glVertex2i(oX+x*mX+wX, oY+y*mY);
  72. glEnd();
  73. }
  74. }
  75. }
  76. // reset color
  77. glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  78. }
  79. //sliders
  80. ScopedPointer<ImageSlider> fSliders[9][3];
  81. ScopedPointer<ImageButton> fButtonAbout;
  82. };
  83. // -----------------------------------------------------------------------
  84. END_NAMESPACE_DISTRHO
  85. #endif // TRIGGERJUICEUI_HPP_INCLUDED