/* SpiralPlugin * Copyleft (C) 2000 David Griffiths * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "DiskWriterPluginGUI.h" #include #include using namespace std; DiskWriterPluginGUI::DiskWriterPluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch,const HostInfo *Info) : SpiralPluginGUI(w,h,o,ch) { m_16bits = new Fl_LED_Button (0, 15, 23, 23, "16bit"); m_16bits->type (FL_RADIO_BUTTON); m_16bits->labelsize(10); m_16bits->set(); m_16bits->callback((Fl_Callback*)cb_16bits); m_24bits = new Fl_LED_Button (0, 38, 23, 23, "24bit"); m_24bits->type (FL_RADIO_BUTTON); m_24bits->labelsize(10); m_24bits->callback((Fl_Callback*)cb_24bits); m_32bits = new Fl_LED_Button (0, 61, 23, 23, "32bit"); m_32bits->type (FL_RADIO_BUTTON); m_32bits->labelsize(10); m_32bits->callback((Fl_Callback*)cb_32bits); Open = new Fl_Button(50, 20, 90, 20, "Open"); Open->type(1); Open->box (FL_PLASTIC_UP_BOX); Open->color (Info->GUI_COLOUR); Open->selection_color (Info->GUI_COLOUR); Open->labelsize(10); Open->callback((Fl_Callback*)cb_Open); Record = new Fl_Button(50, 60, 90, 20, "Record"); Record->type(1); Record->box (FL_PLASTIC_UP_BOX); Record->color (Info->GUI_COLOUR); Record->selection_color (Info->GUI_COLOUR); Record->labelsize(10); Record->callback((Fl_Callback*)cb_Record); end(); } void DiskWriterPluginGUI::UpdateValues(SpiralPlugin *o) { } //// Callbacks //// inline void DiskWriterPluginGUI::cb_Open_i(Fl_Button* o, void* v) { if (o->value()) { char *fn=fl_file_chooser("Pick a Wav file to save to", "*.wav", NULL); char t[256]; sprintf(t,"%s",fn); if (fn && fn!="") { m_GUICH->SetData("Filename",(void*)t); m_GUICH->SetCommand(DiskWriterPlugin::OPENWAV); } else { m_GUICH->SetCommand(DiskWriterPlugin::CLOSEWAV); o->value(false); } } else { m_GUICH->SetCommand(DiskWriterPlugin::CLOSEWAV); } } void DiskWriterPluginGUI::cb_Open(Fl_Button* o, void* v) { ((DiskWriterPluginGUI*)(o->parent()))->cb_Open_i(o,v); } inline void DiskWriterPluginGUI::cb_Record_i(Fl_Button* o, void* v) { if (o->value()) m_GUICH->SetCommand(DiskWriterPlugin::RECORD); else m_GUICH->SetCommand(DiskWriterPlugin::STOP); } void DiskWriterPluginGUI::cb_Record(Fl_Button* o, void* v) { ((DiskWriterPluginGUI*)(o->parent()))->cb_Record_i(o,v); } inline void DiskWriterPluginGUI::cb_16bits_i(Fl_Button* o, void* v) { m_GUICH->Set("BitsPerSample",16); } void DiskWriterPluginGUI::cb_16bits(Fl_Button* o, void* v) { ((DiskWriterPluginGUI*)(o->parent()))->cb_16bits_i(o,v); } inline void DiskWriterPluginGUI::cb_24bits_i(Fl_Button* o, void* v) { m_GUICH->Set("BitsPerSample",24); } void DiskWriterPluginGUI::cb_24bits(Fl_Button* o, void* v) { ((DiskWriterPluginGUI*)(o->parent()))->cb_24bits_i(o,v); } inline void DiskWriterPluginGUI::cb_32bits_i(Fl_Button* o, void* v) { m_GUICH->Set("BitsPerSample",32); } void DiskWriterPluginGUI::cb_32bits(Fl_Button* o, void* v) { ((DiskWriterPluginGUI*)(o->parent()))->cb_32bits_i(o,v); } const string DiskWriterPluginGUI::GetHelpText(const string &loc){ return string("") + "One way of recording your creations to disk. First open a file\n" + "you wish to save to, then hit record to start recording.\n" + "You are able to stop and restart recording without closing the\n" + "file, which should make life a little easier if you are doing\n" + "things like recording lots of little samples."; }