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.

108 lines
3.4KB

  1. /* SpiralSynth
  2. * Copyright (C) 2000 David Griffiths <dave@blueammonite.f9.co.uk>
  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 "MixerGUI.h"
  19. MixerGUI::MixerGUI(Mixer *o)
  20. {
  21. m_mix=o;
  22. if (!m_mix) cerr<<"WARNING: Mixer not correctly set up"<<endl;
  23. }
  24. void MixerGUI::CreateGUI(int xoff=0, int yoff=0, char *name)
  25. {
  26. Fl_Group* o = GUIMixGroup = new Fl_Group(xoff, yoff, 100, 110, name);
  27. o->type(1);
  28. o->box(FL_UP_BOX);
  29. o->labeltype(FL_ENGRAVED_LABEL);
  30. o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
  31. o->user_data((void*)(this));
  32. Balance = new Fl_Knob(xoff+55, yoff+35, 40, 40, "Amount");
  33. Balance->color(SynthInfo::GUI_COLOUR);
  34. Balance->type(Fl_Knob::LINELIN);
  35. Balance->labelsize(10);
  36. Balance->maximum(0.002);
  37. Balance->step(0.00001);
  38. Balance->value(0.001);
  39. Balance->callback((Fl_Callback*)cb_Balance);
  40. Add = new Fl_Check_Button(xoff, yoff+15, 55, 30, "Add");
  41. Add->type(102);
  42. Add->down_box(FL_DIAMOND_DOWN_BOX);
  43. Add->selection_color(SynthInfo::GUI_COLOUR);
  44. Add->set();
  45. Add->callback((Fl_Callback*)cb_Add);
  46. XMod = new Fl_Check_Button(xoff, yoff+40, 55, 30, "XM");
  47. XMod->type(102);
  48. XMod->down_box(FL_DIAMOND_DOWN_BOX);
  49. XMod->selection_color(SynthInfo::GUI_COLOUR);
  50. XMod->callback((Fl_Callback*)cb_XMod);
  51. Ring = new Fl_Check_Button(xoff, yoff+65, 55, 30, "Ring");
  52. Ring->type(102);
  53. Ring->down_box(FL_DIAMOND_DOWN_BOX);
  54. Ring->selection_color(SynthInfo::GUI_COLOUR);
  55. Ring->callback((Fl_Callback*)cb_Ring);
  56. o->end();
  57. }
  58. void MixerGUI::UpdateValues()
  59. {
  60. Balance->value(m_mix->GetAmount());
  61. Add->value(0);
  62. XMod->value(0);
  63. Ring->value(0);
  64. switch(m_mix->GetType())
  65. {
  66. case Mixer::ADD: Add->value(1); break;
  67. case Mixer::XMOD: XMod->value(1); break;
  68. case Mixer::RING: Ring->value(1); break;
  69. case Mixer::NONE: break;
  70. }
  71. }
  72. //// Callbacks ////
  73. inline void MixerGUI::cb_Balance_i(Fl_Knob* o, void* v)
  74. { m_mix->SetAmount(o->value()); }
  75. void MixerGUI::cb_Balance(Fl_Knob* o, void* v)
  76. { ((MixerGUI*)(o->parent()->user_data()))->cb_Balance_i(o,v); }
  77. inline void MixerGUI::cb_Add_i(Fl_Check_Button* o, void* v)
  78. { m_mix->SetType(Mixer::ADD); }
  79. void MixerGUI::cb_Add(Fl_Check_Button* o, void* v)
  80. { ((MixerGUI*)(o->parent()->user_data()))->cb_Add_i(o,v); }
  81. inline void MixerGUI::cb_XMod_i(Fl_Check_Button* o, void* v)
  82. { m_mix->SetType(Mixer::XMOD); }
  83. void MixerGUI::cb_XMod(Fl_Check_Button* o, void* v)
  84. { ((MixerGUI*)(o->parent()->user_data()))->cb_XMod_i(o,v); }
  85. inline void MixerGUI::cb_Ring_i(Fl_Check_Button* o, void* v)
  86. { m_mix->SetType(Mixer::RING); }
  87. void MixerGUI::cb_Ring(Fl_Check_Button* o, void* v)
  88. { ((MixerGUI*)(o->parent()->user_data()))->cb_Ring_i(o,v); }