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.

174 lines
5.4KB

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