예제 #1
0
/******************************************************************************
*******************************************************************************

                                MAIN PLAY THREAD

*******************************************************************************
*******************************************************************************/
int main( int argc, char *argv[] )
{
	char	name[256], dst[258];
	char	rcfilename[256];

	char* home = getenv("HOME");
	snprintf(name, 255, "%s", basename(argv[0]));
	snprintf(dst, 257, "/%s/", name);
	snprintf(rcfilename, 255, "%s/.%src", home, name);

    QApplication myApp(argc, argv);
    
	QTGUI* interface = new QTGUI();
	FUI* finterface = new FUI();
	DSP.buildUserInterface(interface);
	DSP.buildUserInterface(finterface);

	oscdsp osca (dst, argc, argv);
	OSCUI*	oscinterface = new OSCUI(name, argc, argv, &osca);
	DSP.buildUserInterface(oscinterface);
	
	snprintf(dst, 257, "/%s/", oscinterface->getRootName());
	osca.setDest (dst);
	
	osca.init (name, &DSP);	
	finterface->recallState(rcfilename);
	osca.start ();	
	
	oscinterface->run();
	interface->run();	
    
    myApp.setStyleSheet(interface->styleSheet());
    myApp.exec();
    interface->stop();
    
	osca.stop();
	finterface->saveState(rcfilename);
    
	// desallocation
    delete interface;
    delete finterface;
	delete oscinterface;
  	return 0;
}
예제 #2
0
파일: alsa-qt.cpp 프로젝트: EBone/Faust
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;
}
예제 #3
0
파일: ra-qt.cpp 프로젝트: EBone/Faust
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;
}
예제 #4
0
파일: netjack-qt.cpp 프로젝트: Ace17/faust
//-------------------------------------------------------------------------
// 									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);
    
    QApplication myApp(argc, argv);
    
    QTGUI* interface = new QTGUI();
    FUI* finterface	= new FUI();
    DSP.buildUserInterface(interface);
    DSP.buildUserInterface(finterface);

#ifdef HTTPCTRL
    httpdUI* httpdinterface = new httpdUI(appname, DSP.getNumInputs(), DSP.getNumOutputs(), argc, argv);
    DSP.buildUserInterface(httpdinterface);
#endif

#ifdef OSCCTRL
    GUI* oscinterface = new OSCUI(appname, argc, argv);
    DSP.buildUserInterface(oscinterface);
#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();
	
    myApp.setStyleSheet(interface->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;
}
예제 #5
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;
}
예제 #6
0
파일: jack-qt.cpp 프로젝트: OpenDAWN/Faust
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;
}