int main( int argc, char *argv[]) { char c; if ( !SetUpMidi() ) return 0; // open the MidiShare session MSParam[kDelay] = lopt(argv, "-delay", 500); MSParam[kVel] = lopt(argv, "-vel", -10); MSParam[kPitch] = lopt(argv, "-pitch", 0); MSParam[kChan] = lopt(argv, "-chan", 0); printf ( "\nmsEcho [-delay <d> -pitch <p> -vel <v> -chan <c>]\n\n"); printf ( "msEcho produce an echo on incoming Note and KeyOn events\n\n"); printf ( "Use q or Q to quit the application\n\n"); while ((c = getchar()) && c != 'q' && c != 'Q') switch (c) {} QuitMidi(); // close the MidiShare session }
int main(int argc, char *argv[]) { char appname[256]; char rcfilename[256]; char* home = getenv("HOME"); snprintf(appname, 255, "%s", basename(argv[0])); snprintf(rcfilename, 255, "%s/.%src", home, appname); GUI* interface = new QTGUI(argc, argv); FUI* finterface = new FUI(); DSP.buildUserInterface(interface); DSP.buildUserInterface(finterface); #ifdef OSCCTRL GUI* oscinterface = new OSCUI(appname, argc, argv); DSP.buildUserInterface(oscinterface); #endif long srate = (long)lopt(argv, "--frequency", 44100); int fpb = lopt(argv, "--buffer", 128); portaudio audio (srate, fpb); audio.init(appname, &DSP); finterface->recallState(rcfilename); audio.start(); #ifdef OSCCTRL oscinterface->run(); #endif interface->run(); audio.stop(); finterface->saveState(rcfilename); return 0; }
int main(int argc, char *argv[] ) { char* appname = basename (argv [0]); char rcfilename[256]; char* home = getenv("HOME"); int nvoices = 0; mydsp_poly* dsp_poly = NULL; snprintf(rcfilename, 256, "%s/.%src", home, appname); #ifdef POLY2 nvoices = lopt(argv, "--nvoices", nvoices); int group = lopt(argv, "--group", 1); std::cout << "Started with " << nvoices << " voices\n"; dsp_poly = new mydsp_poly(new mydsp(), nvoices, true, group); #if MIDICTRL if (hasMIDISync()) { DSP = new timed_dsp(new dsp_sequencer(dsp_poly, new effect())); } else { DSP = new dsp_sequencer(dsp_poly, new effect()); } #else DSP = new dsp_sequencer(dsp_poly, new effect()); #endif #else nvoices = lopt(argv, "--nvoices", nvoices); int group = lopt(argv, "--group", 1); if (nvoices > 0) { std::cout << "Started with " << nvoices << " voices\n"; dsp_poly = new mydsp_poly(new mydsp(), nvoices, true, group); #if MIDICTRL if (hasMIDISync()) { DSP = new timed_dsp(dsp_poly); } else { DSP = dsp_poly; } #else DSP = dsp_poly; #endif } else { #if MIDICTRL if (hasMIDISync()) { DSP = new timed_dsp(new mydsp()); } else { DSP = new mydsp(); } #else DSP = new mydsp(); #endif } #endif if (DSP == 0) { std::cerr << "Unable to allocate Faust DSP object" << std::endl; exit(1); } CMDUI* interface = new CMDUI(argc, argv); FUI* finterface = new FUI(); DSP->buildUserInterface(interface); DSP->buildUserInterface(finterface); #ifdef MIDICTRL rt_midi midi_handler(appname); midi_handler.addMidiIn(dsp_poly); MidiUI midiinterface(&midi_handler); DSP->buildUserInterface(&midiinterface); std::cout << "MIDI is on" << std::endl; #endif #ifdef HTTPCTRL httpdUI* httpdinterface = new httpdUI(appname, DSP->getNumInputs(), DSP->getNumOutputs(), argc, argv); DSP->buildUserInterface(httpdinterface); std::cout << "HTTPD is on" << std::endl; #endif #ifdef OSCCTRL GUI* oscinterface = new OSCUI(appname, argc, argv); DSP->buildUserInterface(oscinterface); #endif alsaaudio audio (argc, argv, DSP); audio.init(appname, DSP); finterface->recallState(rcfilename); audio.start(); #ifdef HTTPCTRL httpdinterface->run(); #endif #ifdef OSCCTRL oscinterface->run(); #endif #ifdef MIDICTRL if (!midiinterface.run()) { std::cerr << "MidiUI run error\n"; } #endif interface->run(); #ifdef MIDICTRL midiinterface.stop(); #endif audio.stop(); finterface->saveState(rcfilename); // desallocation delete interface; delete finterface; #ifdef HTTPCTRL delete httpdinterface; #endif #ifdef OSCCTRL delete oscinterface; #endif return 0; }
DrMain* LprHandler::loadToolDriver(const QString& filename) { QFile f(filename); if (f.open(IO_ReadOnly)) { DrMain *driver = new DrMain; QValueStack<DrGroup*> groups; QTextStream t(&f); QStringList l; DrListOption *lopt(0); DrBase *opt(0); groups.push(driver); driver->set("text", "Tool Driver"); while (!t.atEnd()) { l = QStringList::split('|', t.readLine().stripWhiteSpace(), false); if (l.count() == 0) continue; if (l[0] == "GROUP") { DrGroup *grp = new DrGroup; grp->setName(l[1]); grp->set("text", l[2]); groups.top()->addGroup(grp); groups.push(grp); } else if (l[0] == "ENDGROUP") { groups.pop(); } else if (l[0] == "OPTION") { opt = 0; lopt = 0; if (l.count() > 3) { if (l[3] == "STRING") opt = new DrStringOption; else if (l[3] == "BOOLEAN") { lopt = new DrBooleanOption; opt = lopt; } } else { lopt = new DrListOption; opt = lopt; } if (opt) { opt->setName(l[1]); opt->set("text", l[2]); groups.top()->addOption(opt); } } else if (l[0] == "CHOICE" && lopt) { DrBase *ch = new DrBase; ch->setName(l[1]); ch->set("text", l[2]); lopt->addChoice(ch); } else if (l[0] == "DEFAULT" && opt) { opt->setValueText(l[1]); opt->set("default", l[1]); } } return driver; } return NULL; }
int main(int argc, char *argv[]) { char* name = basename (argv [0]); char rcfilename[256]; char* home = getenv("HOME"); snprintf(rcfilename, 256, "%s/.%src", home, name); #ifdef POLY int poly = lopt(argv, "--poly", 4); int group = lopt(argv, "--group", 1); #if MIDICTRL if (hasMIDISync()) { DSP = new timed_dsp(new mydsp_poly(new mydsp(), poly, true, group)); } else { DSP = new mydsp_poly(new mydsp(), poly, true, group); } #else DSP = new mydsp_poly(new mydsp(), poly, false, group); #endif #else #if MIDICTRL if (hasMIDISync()) { DSP = new timed_dsp(new mydsp()); } else { DSP = new mydsp(); } #else DSP = new mydsp(); #endif #endif if (DSP == 0) { std::cerr << "Unable to allocate Faust DSP object" << std::endl; exit(1); } QApplication myApp(argc, argv); QTGUI* interface = new QTGUI(); FUI* finterface = new FUI(); DSP->buildUserInterface(interface); DSP->buildUserInterface(finterface); #ifdef MIDICTRL rt_midi midi_handler(name); MidiUI midiinterface(&midi_handler); DSP->buildUserInterface(&midiinterface); std::cout << "MIDI is on" << std::endl; #endif #ifdef HTTPCTRL httpdUI* httpdinterface = new httpdUI(name, DSP->getNumInputs(), DSP->getNumOutputs(), argc, argv); DSP->buildUserInterface(httpdinterface); std::cout << "HTTPD is on" << std::endl; #endif #ifdef OSCCTRL GUI* oscinterface = new OSCUI(name, argc, argv); DSP->buildUserInterface(oscinterface); #endif alsaaudio audio (argc, argv, DSP); audio.init(name, DSP); finterface->recallState(rcfilename); audio.start(); #ifdef HTTPCTRL httpdinterface->run(); #endif #ifdef OSCCTRL oscinterface->run(); #endif #ifdef MIDICTRL if (!midiinterface.run()) { std::cerr << "MidiUI run error\n"; } #endif interface->run(); myApp.setStyleSheet(interface->styleSheet()); myApp.exec(); interface->stop(); #ifdef MIDICTRL midiinterface.stop(); #endif audio.stop(); finterface->saveState(rcfilename); // desallocation delete interface; delete finterface; #ifdef HTTPCTRL delete httpdinterface; #endif #ifdef OSCCTRL delete oscinterface; #endif return 0; }
int main(int argc, char *argv[]) { char name[256]; char rcfilename[256]; char* home = getenv("HOME"); snprintf(name, 255, "%s", basename(argv[0])); snprintf(rcfilename, 256, "%s/.%src", home, basename(argv[0])); long srate = (long)lopt(argv, "--frequency", 44100); int fpb = lopt(argv, "--buffer", 512); #ifdef POLY int poly = lopt(argv, "--poly", 4); int group = lopt(argv, "--group", 1); #if MIDICTRL if (hasMIDISync()) { DSP = new timed_dsp(new mydsp_poly(new mydsp(), poly, true, group)); } else { DSP = new mydsp_poly(new mydsp(), poly, true, group); } #else DSP = new mydsp_poly(new mydsp(), poly, false, group); #endif #else #if MIDICTRL if (hasMIDISync()) { DSP = new timed_dsp(new mydsp()); } else { DSP = new mydsp(); } #else DSP = new mydsp(); #endif #endif if (DSP == 0) { std::cerr << "Unable to allocate Faust DSP object" << std::endl; exit(1); } QApplication myApp(argc, argv); QTGUI interface; FUI finterface; DSP->buildUserInterface(&interface); DSP->buildUserInterface(&finterface); #ifdef MIDICTRL rt_midi midi_handler(name); MidiUI midiinterface(&midi_handler); DSP->buildUserInterface(&midiinterface); std::cout << "MIDI is on" << std::endl; #endif #ifdef HTTPCTRL httpdUI httpdinterface(name, DSP->getNumInputs(), DSP->getNumOutputs(), argc, argv); DSP->buildUserInterface(&httpdinterface); std::cout << "HTTPD is on" << std::endl; #endif #ifdef OSCCTRL OSCUI oscinterface(name, argc, argv); DSP->buildUserInterface(&oscinterface); std::cout << "OSC is on" << std::endl; #endif rtaudio audio(srate, fpb); audio.init(name, DSP); finterface.recallState(rcfilename); audio.start(); printf("ins %d\n", audio.getNumInputs()); printf("outs %d\n", audio.getNumOutputs()); #ifdef HTTPCTRL httpdinterface.run(); #ifdef QRCODECTRL interface.displayQRCode(httpdinterface.getTCPPort()); #endif #endif #ifdef OSCCTRL oscinterface.run(); #endif #ifdef MIDICTRL if (!midiinterface.run()) { std::cerr << "MidiUI run error\n"; } #endif interface.run(); myApp.setStyleSheet(interface.styleSheet()); myApp.exec(); interface.stop(); #ifdef MIDICTRL midiinterface.stop(); #endif audio.stop(); finterface.saveState(rcfilename); return 0; }
//------------------------------------------------------------------------- // MAIN //------------------------------------------------------------------------- int main(int argc, char *argv[]) { char appname[256]; char rcfilename[256]; char* home = getenv("HOME"); int celt = lopt(argv, "--celt", -1); const char* master_ip = lopts(argv, "--a", DEFAULT_MULTICAST_IP); int master_port = lopt(argv, "--p", DEFAULT_PORT); int mtu = lopt(argv, "--m", DEFAULT_MTU); int latency = lopt(argv, "--l", 2); snprintf(appname, 255, "%s", basename(argv[0])); snprintf(rcfilename, 255, "%s/.%src", home, appname); CMDUI* interface = new CMDUI(argc, argv); FUI* finterface = new FUI(); DSP.buildUserInterface(interface); DSP.buildUserInterface(finterface); #ifdef OSCCTRL GUI* oscinterface = new OSCUI(appname, argc, argv); DSP.buildUserInterface(oscinterface); #endif #ifdef HTTPCTRL httpdUI* httpdinterface = new httpdUI(appname, argc, argv); DSP.buildUserInterface(httpdinterface); #endif netjackaudio audio(celt, master_ip, master_port, mtu, latency); if (!audio.init(appname, &DSP)) { return 0; } finterface->recallState(rcfilename); if (!audio.start()) { return 0; } #ifdef HTTPCTRL httpdinterface->run(); #endif #ifdef OSCCTRL oscinterface->run(); #endif interface->run(); audio.stop(); finterface->saveState(rcfilename); // desallocation delete interface; delete finterface; #ifdef HTTPCTRL delete httpdinterface; #endif #ifdef OSCCTRL delete oscinterface; #endif return 0; }
DrMain *PrinttoolEntry::createDriver() { // create driver DrMain *dr = new DrMain(); dr->setName(m_name); dr->set("description", m_description); dr->set("text", m_description); dr->set("drtype", "printtool"); DrGroup *gr(0); DrListOption *lopt(0); DrStringOption *sopt(0); DrBooleanOption *bopt(0); DrBase *ch(0); if(m_gsdriver != "TEXT") { // create GS group gr = new DrGroup(); gr->set("text", i18n("GhostScript settings")); dr->addGroup(gr); // Pseudo option to have access to GS driver lopt = new DrListOption(); lopt->setName("GSDEVICE"); lopt->set("text", i18n("Driver")); lopt->set("default", m_gsdriver); gr->addOption(lopt); ch = new DrBase(); ch->setName(m_gsdriver); ch->set("text", m_gsdriver); lopt->addChoice(ch); lopt->setValueText(m_gsdriver); // Resolutions if(m_resolutions.count() > 0) { lopt = new DrListOption(); lopt->setName("RESOLUTION"); lopt->set("text", i18n("Resolution")); gr->addOption(lopt); QPtrListIterator< Resolution > it(m_resolutions); for(int i = 0; it.current(); ++it, i++) { ch = new DrBase; ch->setName(QString::fromLatin1("%1x%2").arg(it.current()->xdpi).arg(it.current()->ydpi)); if(it.current()->comment.isEmpty()) ch->set("text", QString::fromLatin1("%1x%2 DPI").arg(it.current()->xdpi).arg(it.current()->ydpi)); else ch->set("text", QString::fromLatin1("%2x%3 DPI (%1)").arg(it.current()->comment).arg(it.current()->xdpi).arg(it.current()->ydpi)); lopt->addChoice(ch); } QString defval = lopt->choices()->first()->name(); lopt->set("default", defval); lopt->setValueText(defval); } // BitsPerPixels if(m_depths.count() > 0) { lopt = new DrListOption(); lopt->setName("COLOR"); lopt->set("text", i18n("Color depth")); gr->addOption(lopt); QPtrListIterator< BitsPerPixel > it(m_depths); for(int i = 0; it.current(); ++it, i++) { ch = new DrBase; if(m_gsdriver != "uniprint") ch->setName(QString::fromLatin1("-dBitsPerPixel=%1").arg(it.current()->bpp)); else ch->setName(it.current()->bpp); if(it.current()->comment.isEmpty()) ch->set("text", it.current()->bpp); else ch->set("text", QString::fromLatin1("%1 - %2").arg(it.current()->bpp).arg(it.current()->comment)); lopt->addChoice(ch); } QString defval = lopt->choices()->first()->name(); lopt->set("default", defval); lopt->setValueText(defval); } // additional GS options sopt = new DrStringOption; sopt->setName("EXTRA_GS_OPTIONS"); sopt->set("text", i18n("Additional GS options")); gr->addOption(sopt); } // General group gr = new DrGroup(); gr->set("text", i18n("General")); dr->addGroup(gr); // Page size lopt = new DrListOption(); lopt->setName("PAPERSIZE"); lopt->set("text", i18n("Page size")); lopt->set("default", "letter"); gr->addOption(lopt); int i(0); while(pt_pagesize[i]) { ch = new DrBase(); ch->setName(pt_pagesize[i++]); ch->set("text", i18n(pt_pagesize[i++])); lopt->addChoice(ch); } lopt->setValueText("letter"); // Nup lopt = new DrListOption(); lopt->setName("NUP"); lopt->set("text", i18n("Pages per sheet")); lopt->set("default", "1"); gr->addOption(lopt); i = 0; while(pt_nup[i] != -1) { ch = new DrBase(); ch->setName(QString::number(pt_nup[i++])); ch->set("text", ch->name()); lopt->addChoice(ch); } lopt->setValueText("1"); // Margins sopt = new DrStringOption(); sopt->setName("RTLFTMAR"); sopt->set("text", i18n("Left/right margin (1/72 in)")); sopt->setValueText("18"); gr->addOption(sopt); sopt = new DrStringOption(); sopt->setName("TOPBOTMAR"); sopt->set("text", i18n("Top/bottom margin (1/72 in)")); sopt->setValueText("18"); gr->addOption(sopt); // Text group gr = new DrGroup(); gr->set("text", i18n("Text options")); dr->addGroup(gr); // Send EOF bopt = new DrBooleanOption(); bopt->setName("TEXT_SEND_EOF"); bopt->set("text", i18n("Send EOF after job to eject page")); gr->addOption(bopt); setupBooleanOption(bopt); bopt->setValueText("NO"); // Fix stair-stepping bopt = new DrBooleanOption(); bopt->setName("CRLFTRANS"); bopt->set("text", i18n("Fix stair-stepping text")); gr->addOption(bopt); setupBooleanOption(bopt); bopt->choices()->first()->setName("1"); bopt->choices()->last()->setName("0"); bopt->setValueText("0"); if(m_gsdriver != "POSTSCRIPT") { // Fast text printing bopt = new DrBooleanOption(); bopt->setName("ASCII_TO_PS"); bopt->set("text", i18n("Fast text printing (non-PS printers only)")); gr->addOption(bopt); setupBooleanOption(bopt); bopt->choices()->first()->setName("NO"); bopt->choices()->last()->setName("YES"); bopt->setValueText("NO"); } return dr; }
int main(int argc, char *argv[]) { char appname[256]; char filename[256]; char rcfilename[256]; std::string error_msg; char* home = getenv("HOME"); llvm_dsp* DSP = NULL; llvm_dsp_factory* factory; int inc_arg = 0; int celt = lopt(argv, "--celt", -1); const char* master_ip = lopts(argv, "--a", DEFAULT_MULTICAST_IP); int master_port = lopt(argv, "--p", DEFAULT_PORT); if (isopt(argv, "--celt")) inc_arg += 2; if (isopt(argv, "--a")) inc_arg += 2; if (isopt(argv, "--p")) inc_arg += 2; if (argc < 2) { printf("Usage: faust-netjack-gtk args [file.dsp | file.bc]\n"); exit(1); } else { factory = createDSPFactoryFromFile(argv[1], argc-2-inc_arg, (const char**)&argv[inc_arg+2], "", error_msg); DSP = factory->createDSPInstance(); if (!DSP) { std::cerr << error_msg; std::cerr << "Cannot load .dsp or .bc file" << std::endl; exit(1); } } snprintf(appname, 256, "%s", basename(argv[0])); snprintf(filename, 256, "%s", basename(argv[argc-1])); snprintf(rcfilename, 256, "%s/.%s-%src", home, appname, argv[1]); GUI* interface = new GTKUI(filename, &argc, &argv); FUI* finterface = new FUI(); DSP->buildUserInterface(interface); DSP->buildUserInterface(finterface); #ifdef HTTPCTRL httpdUI* httpdinterface = new httpdUI(appname, argc, argv); DSP->buildUserInterface(httpdinterface); #endif #ifdef OSCCTRL GUI* oscinterface = new OSCUI(filename, argc, argv); DSP->buildUserInterface(oscinterface); #endif netjackaudio audio(celt, master_ip, master_port, DEFAULT_MTU); if (!audio.init(filename, DSP)) { return 0; } finterface->recallState(rcfilename); audio.start(); #ifdef HTTPCTRL httpdinterface->run(); #endif #ifdef OSCCTRL oscinterface->run(); #endif interface->run(); audio.stop(); finterface->saveState(rcfilename); return 0; }
int main(int argc, char *argv[]) { char name[256]; char rcfilename[256]; char* home = getenv("HOME"); snprintf(name, 255, "%s", basename(argv[0])); snprintf(rcfilename, 255, "%s/.%src", home, basename(argv[0])); long srate = (long)lopt(argv, "--frequency", -1); int fpb = lopt(argv, "--buffer", 512); QApplication myApp(argc, argv); QTGUI* interface = new QTGUI(); DSP.buildUserInterface(interface); FUI* finterface = new FUI(); DSP.buildUserInterface(finterface); #ifdef HTTPCTRL httpdUI* httpdinterface = new httpdUI(name, argc, argv); DSP.buildUserInterface(httpdinterface); #endif #ifdef OSCCTRL GUI* oscinterface = new OSCUI(name, argc, argv); DSP.buildUserInterface(oscinterface); #endif coreaudio audio(srate, fpb); audio.init(name, &DSP); finterface->recallState(rcfilename); audio.start(); #ifdef HTTPCTRL httpdinterface->run(); #ifdef QRCODECTRL interface->displayQRCode( httpdinterface->getTCPPort() ); #endif #endif #ifdef OSCCTRL oscinterface->run(); #endif interface->run(); myApp.setStyleSheet(STYLESHEET); myApp.exec(); interface->stop(); audio.stop(); finterface->saveState(rcfilename); // desallocation delete interface; delete finterface; #ifdef HTTPCTRL delete httpdinterface; #endif #ifdef OSCCTRL delete oscinterface; #endif return 0; }
int main(int argc, char *argv[]) { char appname[256]; char rcfilename[256]; char* home = getenv("HOME"); snprintf(appname, 255, "%s", basename(argv[0])); snprintf(rcfilename, 255, "%s/.%src", home, appname); int poly = lopt(argv, "--poly", 4); #if MIDICTRL rtmidi midi; #endif #ifdef POLY #if MIDICTRL DSP = new mydsp_poly(poly, true); midi.addMidiIn(DSP); #else DSP = new mydsp_poly(poly); #endif #else DSP = new mydsp(); #endif if (DSP == 0) { std::cerr << "Unable to allocate Faust DSP object" << std::endl; exit(1); } QApplication myApp(argc, argv); QTGUI interface; FUI finterface; DSP->buildUserInterface(&interface); DSP->buildUserInterface(&finterface); #ifdef MIDICTRL MidiUI midiinterface(&midi); DSP->buildUserInterface(&midiinterface); std::cout << "MIDI is on" << std::endl; #endif #ifdef HTTPCTRL httpdUI httpdinterface(appname, DSP->getNumInputs(), DSP->getNumOutputs(), argc, argv); DSP->buildUserInterface(&httpdinterface); std::cout << "HTTPD is on" << std::endl; #endif #ifdef OSCCTRL OSCUI oscinterface(appname, argc, argv); DSP->buildUserInterface(&oscinterface); std::cout << "OSC is on" << std::endl; #endif jackaudio audio; audio.init(appname, DSP); finterface.recallState(rcfilename); audio.start(); printf("ins %d\n", audio.get_num_inputs()); printf("outs %d\n", audio.get_num_outputs()); #if MIDICTRL midi.start(); #endif #ifdef HTTPCTRL httpdinterface.run(); #ifdef QRCODECTRL interface.displayQRCode(httpdinterface.getTCPPort()); #endif #endif #ifdef OSCCTRL oscinterface.run(); #endif #ifdef MIDICTRL midiinterface.run(); #endif interface.run(); myApp.setStyleSheet(interface.styleSheet()); myApp.exec(); interface.stop(); audio.stop(); finterface.saveState(rcfilename); #if MIDICTRL midi.stop(); #endif return 0; }