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.

134 lines
4.3KB

  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 "DiskWriterPluginGUI.h"
  19. #include <FL/fl_draw.h>
  20. #include <FL/fl_file_chooser.H>
  21. using namespace std;
  22. DiskWriterPluginGUI::DiskWriterPluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch,const HostInfo *Info) :
  23. SpiralPluginGUI(w,h,o,ch)
  24. {
  25. m_16bits = new Fl_LED_Button (0, 15, 23, 23, "16bit");
  26. m_16bits->type (FL_RADIO_BUTTON);
  27. m_16bits->labelsize(10);
  28. m_16bits->set();
  29. m_16bits->callback((Fl_Callback*)cb_16bits);
  30. m_24bits = new Fl_LED_Button (0, 38, 23, 23, "24bit");
  31. m_24bits->type (FL_RADIO_BUTTON);
  32. m_24bits->labelsize(10);
  33. m_24bits->callback((Fl_Callback*)cb_24bits);
  34. m_32bits = new Fl_LED_Button (0, 61, 23, 23, "32bit");
  35. m_32bits->type (FL_RADIO_BUTTON);
  36. m_32bits->labelsize(10);
  37. m_32bits->callback((Fl_Callback*)cb_32bits);
  38. Open = new Fl_Button(50, 20, 90, 20, "Open");
  39. Open->type(1);
  40. Open->box (FL_PLASTIC_UP_BOX);
  41. Open->color (Info->GUI_COLOUR);
  42. Open->selection_color (Info->GUI_COLOUR);
  43. Open->labelsize(10);
  44. Open->callback((Fl_Callback*)cb_Open);
  45. Record = new Fl_Button(50, 60, 90, 20, "Record");
  46. Record->type(1);
  47. Record->box (FL_PLASTIC_UP_BOX);
  48. Record->color (Info->GUI_COLOUR);
  49. Record->selection_color (Info->GUI_COLOUR);
  50. Record->labelsize(10);
  51. Record->callback((Fl_Callback*)cb_Record);
  52. end();
  53. }
  54. void DiskWriterPluginGUI::UpdateValues(SpiralPlugin *o)
  55. {
  56. }
  57. //// Callbacks ////
  58. inline void DiskWriterPluginGUI::cb_Open_i(Fl_Button* o, void* v)
  59. {
  60. if (o->value())
  61. {
  62. char *fn=fl_file_chooser("Pick a Wav file to save to", "*.wav", NULL);
  63. char t[256];
  64. sprintf(t,"%s",fn);
  65. if (fn && fn!="")
  66. {
  67. m_GUICH->SetData("Filename",(void*)t);
  68. m_GUICH->SetCommand(DiskWriterPlugin::OPENWAV);
  69. }
  70. else
  71. {
  72. m_GUICH->SetCommand(DiskWriterPlugin::CLOSEWAV);
  73. o->value(false);
  74. }
  75. }
  76. else
  77. {
  78. m_GUICH->SetCommand(DiskWriterPlugin::CLOSEWAV);
  79. }
  80. }
  81. void DiskWriterPluginGUI::cb_Open(Fl_Button* o, void* v)
  82. { ((DiskWriterPluginGUI*)(o->parent()))->cb_Open_i(o,v); }
  83. inline void DiskWriterPluginGUI::cb_Record_i(Fl_Button* o, void* v)
  84. {
  85. if (o->value()) m_GUICH->SetCommand(DiskWriterPlugin::RECORD);
  86. else m_GUICH->SetCommand(DiskWriterPlugin::STOP);
  87. }
  88. void DiskWriterPluginGUI::cb_Record(Fl_Button* o, void* v)
  89. { ((DiskWriterPluginGUI*)(o->parent()))->cb_Record_i(o,v); }
  90. inline void DiskWriterPluginGUI::cb_16bits_i(Fl_Button* o, void* v)
  91. {
  92. m_GUICH->Set("BitsPerSample",16);
  93. }
  94. void DiskWriterPluginGUI::cb_16bits(Fl_Button* o, void* v)
  95. { ((DiskWriterPluginGUI*)(o->parent()))->cb_16bits_i(o,v); }
  96. inline void DiskWriterPluginGUI::cb_24bits_i(Fl_Button* o, void* v)
  97. {
  98. m_GUICH->Set("BitsPerSample",24);
  99. }
  100. void DiskWriterPluginGUI::cb_24bits(Fl_Button* o, void* v)
  101. { ((DiskWriterPluginGUI*)(o->parent()))->cb_24bits_i(o,v); }
  102. inline void DiskWriterPluginGUI::cb_32bits_i(Fl_Button* o, void* v)
  103. {
  104. m_GUICH->Set("BitsPerSample",32);
  105. }
  106. void DiskWriterPluginGUI::cb_32bits(Fl_Button* o, void* v)
  107. { ((DiskWriterPluginGUI*)(o->parent()))->cb_32bits_i(o,v); }
  108. const string DiskWriterPluginGUI::GetHelpText(const string &loc){
  109. return string("")
  110. + "One way of recording your creations to disk. First open a file\n"
  111. + "you wish to save to, then hit record to start recording.\n"
  112. + "You are able to stop and restart recording without closing the\n"
  113. + "file, which should make life a little easier if you are doing\n"
  114. + "things like recording lots of little samples.";
  115. }