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.

98 lines
3.2KB

  1. /* SpiralPlugin
  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 "StereoMixerPluginGUI.h"
  19. #include <FL/fl_draw.h>
  20. #include <FL/fl_draw.H>
  21. using namespace std;
  22. ////////////////////////////////////////////
  23. StereoMixerPluginGUI::StereoMixerPluginGUI (int w, int h, StereoMixerPlugin *o, ChannelHandler *ch, const HostInfo *Info) :
  24. SpiralPluginGUI(w,h,o,ch) {
  25. int Width=20;
  26. int Height=100;
  27. for (int n=0; n<NUM_CHANNELS; n++) {
  28. Numbers[n]=n;
  29. m_Chan[n] = new Fl_Slider (20 + (2 + Width * 2) * n, 22, Width, Height, "");
  30. m_Chan[n]->type (4);
  31. m_Chan[n]->selection_color (Info->GUI_COLOUR);
  32. m_Chan[n]->box (FL_PLASTIC_DOWN_BOX);
  33. m_Chan[n]->labelsize (10);
  34. m_Chan[n]->maximum (2);
  35. m_Chan[n]->step (0.01);
  36. m_Chan[n]->value (1.0);
  37. m_Chan[n]->callback ((Fl_Callback*)cb_Chan, (void*)&Numbers[n]);
  38. add (m_Chan[n]);
  39. m_Pan[n] = new Fl_Knob (10 + (2 + Width * 2) * n, 122, 40, 40, "Pan");
  40. m_Pan[n]->type (Fl_Knob::DOTLIN);
  41. m_Pan[n]->color (Info->GUI_COLOUR);
  42. m_Pan[n]->labelsize (10);
  43. m_Pan[n]->maximum (1);
  44. m_Pan[n]->step (0.01);
  45. m_Pan[n]->value (0.5);
  46. m_Pan[n]->callback ((Fl_Callback*)cb_Pan, (void*)&Numbers[n]);
  47. add (m_Pan[n]);
  48. }
  49. end();
  50. }
  51. void StereoMixerPluginGUI::UpdateValues (SpiralPlugin *o) {
  52. StereoMixerPlugin* Plugin = (StereoMixerPlugin*)o;
  53. for (int n=0; n<NUM_CHANNELS; n++) {
  54. m_Chan[n]->value (2.0f - Plugin->GetChannel (n));
  55. m_Pan[n]->value (1.0f - Plugin->GetPan (n));
  56. }
  57. }
  58. inline void StereoMixerPluginGUI::cb_Chan_i(Fl_Slider* o, void* v) {
  59. m_GUICH->Set("Num",*(int*)(v));
  60. m_GUICH->Set("Value",(float)(2.0f-o->value()));
  61. m_GUICH->SetCommand(StereoMixerPlugin::SETCH);
  62. }
  63. void StereoMixerPluginGUI::cb_Chan(Fl_Slider* o, void* v) {
  64. ((StereoMixerPluginGUI*)(o->parent()))->cb_Chan_i(o,v);
  65. }
  66. inline void StereoMixerPluginGUI::cb_Pan_i(Fl_Knob* o, void* v) {
  67. m_GUICH->Set("Num",*(int*)(v));
  68. m_GUICH->Set("Value",(float)(1.0f-o->value()));
  69. m_GUICH->SetCommand(StereoMixerPlugin::SETPAN);
  70. }
  71. void StereoMixerPluginGUI::cb_Pan(Fl_Knob* o, void* v) {
  72. ((StereoMixerPluginGUI*)(o->parent()))->cb_Pan_i(o,v);
  73. }
  74. const string StereoMixerPluginGUI::GetHelpText(const string &loc){
  75. return string("")
  76. + "A more advanced version of the 4 channel mixer,\n"
  77. + "this one has a stereo output. CV's are provided\n"
  78. + "for control of the panning of each of the inputs.\n"
  79. + "The panning can also be set with the knobs on the\n"
  80. + "plugin window.\n";
  81. }