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.

176 lines
5.5KB

  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 "DelayPluginGUI.h"
  19. #include <FL/fl_draw.h>
  20. #include <FL/fl_draw.H>
  21. static const int GUI_COLOUR = 179;
  22. static const int GUIBG_COLOUR = 144;
  23. static const int GUIBG2_COLOUR = 145;
  24. ////////////////////////////////////////////
  25. DelayPluginGUI::DelayPluginGUI(int w, int h, DelayPlugin *o, ChannelHandler *ch, const HostInfo *Info) :
  26. SpiralPluginGUI (w, h, o, ch)
  27. {
  28. m_TheTabs = new Fl_Tabs (2, 14, 118, 90, "");
  29. m_TheTabs->box (FL_PLASTIC_DOWN_BOX);
  30. m_TheTabs->color (GUI_COLOUR);
  31. add (m_TheTabs);
  32. m_CtlGroup = new Fl_Group (2, 28, 118, 66, "Control");
  33. m_CtlGroup->labelsize (10);
  34. m_TheTabs->add (m_CtlGroup);
  35. m_Delay = new Fl_Knob (12, 38, 45, 45, "Delay");
  36. m_Delay->user_data ((void*)(this));
  37. m_Delay->color (GUI_COLOUR);
  38. m_Delay->type (Fl_Knob::DOTLIN);
  39. m_Delay->labelsize (10);
  40. m_Delay->minimum (0);
  41. m_Delay->maximum (1);
  42. m_Delay->step (0.001);
  43. m_Delay->value (0.5);
  44. m_Delay->callback ((Fl_Callback*)cb_Delay);
  45. m_CtlGroup->add (m_Delay);
  46. m_Mix = new Fl_Knob (66, 38, 45, 45, "Mix");
  47. m_Mix->user_data ((void*)(this));
  48. m_Mix->color (GUI_COLOUR);
  49. m_Mix->type (Fl_Knob::DOTLIN);
  50. m_Mix->labelsize (10);
  51. m_Mix->maximum (1);
  52. m_Mix->step (0.01);
  53. m_Mix->value (0);
  54. m_Mix->callback ((Fl_Callback*)cb_Mix);
  55. m_CtlGroup->add (m_Mix);
  56. m_NumGroup = new Fl_Group (2, 28, 118, 66, "Numbers");
  57. m_NumGroup->labelsize (10);
  58. m_TheTabs->add (m_NumGroup);
  59. m_NumDelay = new Fl_Counter (6, 36, 110, 20, "Delay (secs)");
  60. m_NumDelay->user_data ((void*)(this));
  61. m_NumDelay->labelsize (10);
  62. m_NumDelay->box (FL_PLASTIC_UP_BOX);
  63. m_NumDelay->color (GUI_COLOUR);
  64. m_NumDelay->maximum (m_Delay->maximum());
  65. m_NumDelay->minimum (m_Delay->minimum());
  66. m_NumDelay->step (m_Delay->step());
  67. m_NumDelay->lstep (0.1);
  68. m_NumDelay->value (m_Delay->value());
  69. m_NumDelay->callback ((Fl_Callback*)cb_NumDelay);
  70. m_NumGroup->add (m_NumDelay);
  71. m_NumMix = new Fl_Counter (6, 70, 110, 20, "Mix");
  72. m_NumMix->user_data ((void*)(this));
  73. m_NumMix->labelsize (10);
  74. m_NumMix->box (FL_PLASTIC_UP_BOX);
  75. m_NumMix->color (GUI_COLOUR);
  76. m_NumMix->maximum (m_Mix->maximum());
  77. m_NumMix->minimum (m_Mix->minimum());
  78. m_NumMix->step (m_Mix->step());
  79. m_NumMix->lstep (0.1);
  80. m_NumMix->value (m_Mix->value());
  81. m_NumMix->callback ((Fl_Callback*)cb_NumMix);
  82. m_NumGroup->add (m_NumMix);
  83. end();
  84. }
  85. void DelayPluginGUI::UpdateValues(SpiralPlugin *o)
  86. {
  87. float value;
  88. DelayPlugin *Plugin = (DelayPlugin*)o;
  89. value = Plugin->GetDelay();
  90. m_Delay->value (value);
  91. m_NumDelay->value (value);
  92. value = Plugin->GetMix();
  93. m_Mix->value (value);
  94. m_NumMix->value (value);
  95. }
  96. inline void DelayPluginGUI::cb_Delay_i (Fl_Knob* o, void* v)
  97. {
  98. float value = o->value();
  99. m_NumDelay->value (value);
  100. m_GUICH->Set ("Delay", value);
  101. }
  102. void DelayPluginGUI::cb_Delay (Fl_Knob* o, void* v)
  103. {
  104. ((DelayPluginGUI*)(o->user_data()))->cb_Delay_i (o, v);
  105. }
  106. inline void DelayPluginGUI::cb_Mix_i (Fl_Knob* o, void* v)
  107. {
  108. float value = o->value();
  109. m_NumMix->value (value);
  110. m_GUICH->Set ("Mix", value);
  111. }
  112. void DelayPluginGUI::cb_Mix (Fl_Knob* o, void* v)
  113. {
  114. ((DelayPluginGUI*)(o->user_data()))->cb_Mix_i (o, v);
  115. }
  116. inline void DelayPluginGUI::cb_NumDelay_i (Fl_Counter* o, void* v)
  117. {
  118. float value = o->value();
  119. m_Delay->value (value);
  120. m_GUICH->Set ("Delay", value);
  121. }
  122. void DelayPluginGUI::cb_NumDelay (Fl_Counter* o, void* v)
  123. {
  124. ((DelayPluginGUI*)(o->user_data()))->cb_NumDelay_i (o, v);
  125. }
  126. inline void DelayPluginGUI::cb_NumMix_i (Fl_Counter* o, void* v)
  127. {
  128. float value = o->value();
  129. m_Mix->value (value);
  130. m_GUICH->Set ("Mix", value);
  131. }
  132. void DelayPluginGUI::cb_NumMix (Fl_Counter* o, void* v)
  133. {
  134. ((DelayPluginGUI*)(o->user_data()))->cb_NumMix_i (o, v);
  135. }
  136. const string DelayPluginGUI::GetHelpText(const string &loc){
  137. return string("")
  138. + "The delay plugins delays the input signal, and can\n"
  139. + "mix the current signal into the output, the amount\n"
  140. + "is set by the dial in the plugin window.\n"
  141. + "\n"
  142. + "The delay time and read head position can be modified\n"
  143. + "by input CV's. The read head is the place in the buffer\n"
  144. + "the output sample is taken from, relative to the write\n"
  145. + "head.\n"
  146. + "\n"
  147. + "This plugin can be used as the base of a number of effects,\n"
  148. + "such as phasers, flangers and complex echos. If the output\n"
  149. + "is fed back into the input, you get a similar effect\n"
  150. + "to the echo, but you can add cool effects by routing\n"
  151. + "the signal back through a lowpass filter (for example).\n";
  152. }