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.

142 lines
4.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 "OutputPluginGUI.h"
  19. #include <FL/fl_draw.h>
  20. #include <FL/fl_file_chooser.H>
  21. OutputPluginGUI::OutputPluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch,const HostInfo *Info) :
  22. SpiralPluginGUI(w,h,o,ch)
  23. {
  24. Volume = new Fl_Knob(30, 22, 40, 40, "Volume");
  25. Volume->color(Info->GUI_COLOUR);
  26. Volume->type(Fl_Knob::DOTLIN);
  27. Volume->labelsize(10);
  28. Volume->maximum(1);
  29. Volume->step(0.001);
  30. Volume->value(0.5);
  31. Volume->callback((Fl_Callback*)cb_Volume);
  32. OpenRead = new Fl_Button(2, 80, 30, 15, "Read");
  33. OpenRead->type(1);
  34. OpenRead->down_box(FL_DOWN_BOX);
  35. OpenRead->labelsize(10);
  36. OpenRead->callback((Fl_Callback*)cb_OpenRead);
  37. OpenDuplex = new Fl_Button(34, 80, 31, 15, "Dplx");
  38. OpenDuplex->type(1);
  39. OpenDuplex->down_box(FL_DOWN_BOX);
  40. OpenDuplex->labelsize(10);
  41. OpenDuplex->callback((Fl_Callback*)cb_OpenDuplex);
  42. OpenWrite = new Fl_Button(68, 80, 30, 15, "Write");
  43. OpenWrite->type(1);
  44. OpenWrite->down_box(FL_DOWN_BOX);
  45. OpenWrite->labelsize(10);
  46. OpenWrite->callback((Fl_Callback*)cb_OpenWrite);
  47. end();
  48. }
  49. void OutputPluginGUI::UpdateValues(SpiralPlugin *o)
  50. {
  51. Volume->value(OSSOutput::Get()->GetVolume());
  52. }
  53. //// Callbacks ////
  54. inline void OutputPluginGUI::cb_Volume_i(Fl_Knob* o, void* v)
  55. {
  56. m_GUICH->Set("Volume",(float)o->value());
  57. m_GUICH->SetCommand(OutputPlugin::SET_VOLUME);
  58. }
  59. void OutputPluginGUI::cb_Volume(Fl_Knob* o, void* v)
  60. { ((OutputPluginGUI*)(o->parent()))->cb_Volume_i(o,v); }
  61. inline void OutputPluginGUI::cb_OpenRead_i(Fl_Button* o, void* v)
  62. {
  63. if (o->value())
  64. {
  65. OpenWrite->value(0);
  66. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  67. m_GUICH->Wait();
  68. m_GUICH->SetCommand(OutputPlugin::OPENREAD);
  69. m_GUICH->Wait();
  70. }
  71. else
  72. {
  73. OpenWrite->value(0);
  74. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  75. m_GUICH->Wait();
  76. }
  77. }
  78. void OutputPluginGUI::cb_OpenRead(Fl_Button* o, void* v)
  79. { ((OutputPluginGUI*)(o->parent()))->cb_OpenRead_i(o,v); }
  80. inline void OutputPluginGUI::cb_OpenDuplex_i(Fl_Button* o, void* v)
  81. {
  82. if (o->value())
  83. {
  84. OpenRead->value(0);
  85. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  86. m_GUICH->Wait();
  87. m_GUICH->SetCommand(OutputPlugin::OPENDUPLEX);
  88. m_GUICH->Wait();
  89. }
  90. else
  91. {
  92. OpenRead->value(0);
  93. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  94. m_GUICH->Wait();
  95. }
  96. }
  97. void OutputPluginGUI::cb_OpenDuplex(Fl_Button* o, void* v)
  98. { ((OutputPluginGUI*)(o->parent()))->cb_OpenDuplex_i(o,v); }
  99. inline void OutputPluginGUI::cb_OpenWrite_i(Fl_Button* o, void* v)
  100. {
  101. if (o->value())
  102. {
  103. OpenRead->value(0);
  104. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  105. m_GUICH->Wait();
  106. m_GUICH->SetCommand(OutputPlugin::OPENWRITE);
  107. m_GUICH->Wait();
  108. }
  109. else
  110. {
  111. OpenRead->value(0);
  112. m_GUICH->SetCommand(OutputPlugin::CLOSE);
  113. m_GUICH->Wait();
  114. }
  115. }
  116. void OutputPluginGUI::cb_OpenWrite(Fl_Button* o, void* v)
  117. { ((OutputPluginGUI*)(o->parent()))->cb_OpenWrite_i(o,v); }
  118. const string OutputPluginGUI::GetHelpText(const string &loc){
  119. return string("")
  120. + "Your basic OSS i/o plugin, It opens the OSS sound driver, and outputs\n"
  121. + "whatever is passed into it's inputs to the soundcard. It works in stereo,\n"
  122. + "so you have seperate left and right inputs.\n\n"
  123. + "There are three modes of operation: read, write and duplex. You can select\n"
  124. + "read to record/process sound from your soundcard, write to play sound\n"
  125. + "(default) and if your card supports it - duplex, to play and record \n"
  126. + "simultaneously.";
  127. }