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.

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