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.

96 lines
2.9KB

  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 "DelayGUI.h"
  19. static const int GUI_COLOUR = 154;
  20. static const int GUIBG_COLOUR = 144;
  21. static const int GUIBG2_COLOUR = FL_GRAY;
  22. DelayGUI::DelayGUI(Delay *o)
  23. {
  24. m_delay=o;
  25. if (!m_delay) cerr<<"WARNING: Delay not correctly set up"<<endl;
  26. }
  27. DelayGUI::~DelayGUI()
  28. {
  29. delete GUIDelayGroup;
  30. }
  31. void DelayGUI::CreateGUI(int xoff, int yoff, char *name)
  32. {
  33. Fl_Group* o = GUIDelayGroup = 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. DelayA = new Fl_Knob(xoff+50, yoff+5, 40, 40, "Delay");
  41. DelayA->color(GUI_COLOUR);
  42. DelayA->labelsize(10);
  43. DelayA->maximum(1);
  44. DelayA->step(0.01);
  45. DelayA->value(0.5);
  46. DelayA->callback((Fl_Callback*)cb_Delay);
  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.0);
  51. Feedback->step(0.01);
  52. Feedback->value(0.5);
  53. Feedback->callback((Fl_Callback*)cb_Feedback);
  54. Bypass = new Fl_Button(xoff+5, yoff+25, 40, 20, "Bypass");
  55. Bypass->color(GUIBG2_COLOUR);
  56. Bypass->labelsize(10);
  57. Bypass->type(1);
  58. Bypass->value(1);
  59. Bypass->callback((Fl_Callback*)cb_Bypass);
  60. o->end();
  61. }
  62. void DelayGUI::UpdateValues()
  63. {
  64. DelayA->value(m_delay->GetDelay());
  65. Feedback->value(m_delay->GetFeedback());
  66. Bypass->value((int)m_delay->GetBypass());
  67. }
  68. //// Callbacks ////
  69. inline void DelayGUI::cb_Delay_i(Fl_Knob* o, void* v)
  70. { m_delay->SetDelay(o->value()); }
  71. void DelayGUI::cb_Delay(Fl_Knob* o, void* v)
  72. { ((DelayGUI*)(o->parent()->user_data()))->cb_Delay_i(o,v); }
  73. inline void DelayGUI::cb_Feedback_i(Fl_Knob* o, void* v)
  74. { m_delay->SetFeedback(o->value()); }
  75. void DelayGUI::cb_Feedback(Fl_Knob* o, void* v)
  76. { ((DelayGUI*)(o->parent()->user_data()))->cb_Feedback_i(o,v); }
  77. inline void DelayGUI::cb_Bypass_i(Fl_Button* o, void* v)
  78. { m_delay->SetBypass(o->value()); }
  79. void DelayGUI::cb_Bypass(Fl_Button* o, void* v)
  80. { ((DelayGUI*)(o->parent()->user_data()))->cb_Bypass_i(o,v); }