DISTRHO Plugin Framework
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.

143 lines
4.5KB

  1. /*
  2. * DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
  3. * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
  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. #include "DistrhoUINekobi.hpp"
  18. using DGL::Point;
  19. // -----------------------------------------------------------------------
  20. DistrhoUINekobi::DistrhoUINekobi(DGL::Window& parent)
  21. : DGL::Widget(parent),
  22. fAboutWindow(this)
  23. {
  24. fNeko.setTimerSpeed(15);
  25. // background
  26. fImgBackground = Image(DistrhoArtworkNekobi::backgroundData, DistrhoArtworkNekobi::backgroundWidth, DistrhoArtworkNekobi::backgroundHeight, GL_BGR);
  27. Image imageAbout(DistrhoArtworkNekobi::aboutData, DistrhoArtworkNekobi::aboutWidth, DistrhoArtworkNekobi::aboutHeight, GL_BGR);
  28. fAboutWindow.setImage(imageAbout);
  29. // slider
  30. Image sliderImage(DistrhoArtworkNekobi::sliderData, DistrhoArtworkNekobi::sliderWidth, DistrhoArtworkNekobi::sliderHeight);
  31. fSliderWaveform = new ImageSlider(this, sliderImage);
  32. fSliderWaveform->setStartPos(133, 40);
  33. fSliderWaveform->setEndPos(133, 60);
  34. fSliderWaveform->setRange(0.0f, 1.0f);
  35. fSliderWaveform->setValue(0.0f);
  36. fSliderWaveform->setStep(1.0f);
  37. // knobs
  38. Image knobImage(DistrhoArtworkNekobi::knobData, DistrhoArtworkNekobi::knobWidth, DistrhoArtworkNekobi::knobHeight);
  39. // knob Tuning
  40. fKnobTuning = new ImageKnob(this, knobImage);
  41. fKnobTuning->setPos(41, 43);
  42. fKnobTuning->setRange(-12.0f, 12.0f);
  43. fKnobTuning->setValue(0.0f);
  44. fKnobTuning->setRotationAngle(305);
  45. // knob Cutoff
  46. fKnobCutoff = new ImageKnob(this, knobImage);
  47. fKnobCutoff->setPos(185, 43);
  48. fKnobCutoff->setRange(0.0f, 100.0f);
  49. fKnobCutoff->setValue(25.0f);
  50. fKnobCutoff->setRotationAngle(305);
  51. // knob Resonance
  52. fKnobResonance = new ImageKnob(this, knobImage);
  53. fKnobResonance->setPos(257, 43);
  54. fKnobResonance->setRange(0.0f, 95.0f);
  55. fKnobResonance->setValue(25.0f);
  56. fKnobResonance->setRotationAngle(305);
  57. // knob Env Mod
  58. fKnobEnvMod = new ImageKnob(this, knobImage);
  59. fKnobEnvMod->setPos(329, 43);
  60. fKnobEnvMod->setRange(0.0f, 100.0f);
  61. fKnobEnvMod->setValue(50.0f);
  62. fKnobEnvMod->setRotationAngle(305);
  63. // knob Decay
  64. fKnobDecay = new ImageKnob(this, knobImage);
  65. fKnobDecay->setPos(400, 43);
  66. fKnobDecay->setRange(0.0f, 100.0f);
  67. fKnobDecay->setValue(75.0f);
  68. fKnobDecay->setRotationAngle(305);
  69. // knob Accent
  70. fKnobAccent = new ImageKnob(this, knobImage);
  71. fKnobAccent->setPos(473, 43);
  72. fKnobAccent->setRange(0.0f, 100.0f);
  73. fKnobAccent->setValue(25.0f);
  74. fKnobAccent->setRotationAngle(305);
  75. // knob Volume
  76. fKnobVolume = new ImageKnob(this, knobImage);
  77. fKnobVolume->setPos(545, 43);
  78. fKnobVolume->setRange(0.0f, 100.0f);
  79. fKnobVolume->setValue(75.0f);
  80. fKnobVolume->setRotationAngle(305);
  81. // about button
  82. Image aboutImageNormal(DistrhoArtworkNekobi::aboutButtonNormalData, DistrhoArtworkNekobi::aboutButtonNormalWidth, DistrhoArtworkNekobi::aboutButtonNormalHeight);
  83. Image aboutImageHover(DistrhoArtworkNekobi::aboutButtonHoverData, DistrhoArtworkNekobi::aboutButtonHoverWidth, DistrhoArtworkNekobi::aboutButtonHoverHeight);
  84. fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
  85. fButtonAbout->setPos(505, 5);
  86. fButtonAbout->setCallback(this);
  87. }
  88. DistrhoUINekobi::~DistrhoUINekobi()
  89. {
  90. delete fSliderWaveform;
  91. delete fKnobTuning;
  92. delete fKnobCutoff;
  93. delete fKnobResonance;
  94. delete fKnobEnvMod;
  95. delete fKnobDecay;
  96. delete fKnobAccent;
  97. delete fKnobVolume;
  98. delete fButtonAbout;
  99. }
  100. void DistrhoUINekobi::idle()
  101. {
  102. if (fNeko.idle())
  103. repaint();
  104. }
  105. // -----------------------------------------------------------------------
  106. // Widget Callbacks
  107. void DistrhoUINekobi::imageButtonClicked(ImageButton* button, int)
  108. {
  109. if (button != fButtonAbout)
  110. return;
  111. fAboutWindow.exec();
  112. }
  113. void DistrhoUINekobi::onDisplay()
  114. {
  115. fImgBackground.draw();
  116. fNeko.draw();
  117. }
  118. // -----------------------------------------------------------------------