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.

110 lines
3.5KB

  1. /* SpiralLoops
  2. * Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #include "ReverbGUI.h"
  19. static const int GUI_COLOUR = 154;
  20. static const int GUIBG_COLOUR = 144;
  21. static const int GUIBG2_COLOUR = FL_GRAY;
  22. ReverbGUI::ReverbGUI(Reverb *o)
  23. {
  24. m_reverb=o;
  25. if (!m_reverb) cerr<<"WARNING: Reverb not correctly set up"<<endl;
  26. }
  27. ReverbGUI::~ReverbGUI()
  28. {
  29. delete GUIReverbGroup;
  30. }
  31. void ReverbGUI::CreateGUI(int xoff, int yoff, char *name)
  32. {
  33. Fl_Group* o = GUIReverbGroup = new Fl_Group(xoff, yoff, 300, 60, name);
  34. o->type(1);
  35. o->color(GUIBG2_COLOUR);
  36. o->box(FL_UP_BOX);
  37. o->labeltype(FL_ENGRAVED_LABEL);
  38. o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
  39. o->user_data((void*)(this));
  40. Time = new Fl_Knob(xoff+50, yoff+5, 40, 40, "Time");
  41. Time->color(GUI_COLOUR);
  42. Time->labelsize(10);
  43. Time->maximum(0.25);
  44. Time->step(0.01);
  45. Time->value(0.0);
  46. Time->callback((Fl_Callback*)cb_Time);
  47. FeedBack = new Fl_Knob(xoff+100, yoff+5, 40, 40, "FeedBack");
  48. FeedBack->color(GUI_COLOUR);
  49. FeedBack->labelsize(10);
  50. FeedBack->maximum(1);
  51. FeedBack->step(0.01);
  52. FeedBack->value(0.01);
  53. FeedBack->callback((Fl_Callback*)cb_Feedback);
  54. Randomness = new Fl_Knob(xoff+150, yoff+5, 40, 40, "Random");
  55. Randomness->color(GUI_COLOUR);
  56. Randomness->labelsize(10);
  57. Randomness->maximum(0.01);
  58. Randomness->step(0.00001);
  59. Randomness->value(0.002);
  60. Randomness->callback((Fl_Callback*)cb_Randomness);
  61. Bypass = new Fl_Button(xoff+5, yoff+25, 40, 20, "Bypass");
  62. Bypass->color(GUIBG2_COLOUR);
  63. Bypass->labelsize(10);
  64. Bypass->type(1);
  65. Bypass->value(1);
  66. Bypass->callback((Fl_Callback*)cb_Bypass);
  67. o->end();
  68. }
  69. void ReverbGUI::UpdateValues()
  70. {
  71. Time->value(m_reverb->GetTime());
  72. FeedBack->value(m_reverb->GetFeedback());
  73. Randomness->value(m_reverb->GetRandomness());
  74. Bypass->value(m_reverb->IsBypassed());
  75. }
  76. //// Callbacks ////
  77. inline void ReverbGUI::cb_Time_i(Fl_Knob* o, void* v)
  78. { m_reverb->SetTime(o->value()); }
  79. void ReverbGUI::cb_Time(Fl_Knob* o, void* v)
  80. { ((ReverbGUI*)(o->parent()->user_data()))->cb_Time_i(o,v); }
  81. inline void ReverbGUI::cb_Feedback_i(Fl_Knob* o, void* v)
  82. { m_reverb->SetFeedback(o->value()); }
  83. void ReverbGUI::cb_Feedback(Fl_Knob* o, void* v)
  84. { ((ReverbGUI*)(o->parent()->user_data()))->cb_Feedback_i(o,v); }
  85. inline void ReverbGUI::cb_Randomness_i(Fl_Knob* o, void* v)
  86. { m_reverb->SetRandomness(o->value()); }
  87. void ReverbGUI::cb_Randomness(Fl_Knob* o, void* v)
  88. { ((ReverbGUI*)(o->parent()->user_data()))->cb_Randomness_i(o,v); }
  89. inline void ReverbGUI::cb_Bypass_i(Fl_Button* o, void* v)
  90. { m_reverb->SetBypass(o->value()); }
  91. void ReverbGUI::cb_Bypass(Fl_Button* o, void* v)
  92. { ((ReverbGUI*)(o->parent()->user_data()))->cb_Bypass_i(o,v); }