Install, Readme and Changes files updated. Documentation removed.
[Faustine.git] / interpretor / faust-0.9.47mr3 / architecture / pa-qt.cpp
1 /************************************************************************
2
3 IMPORTANT NOTE : this file contains two clearly delimited sections :
4 the ARCHITECTURE section (in two parts) and the USER section. Each section
5 is governed by its own copyright and license. Please check individually
6 each section for license and copyright information.
7 *************************************************************************/
8
9 /*******************BEGIN ARCHITECTURE SECTION (part 1/2)****************/
10
11 /************************************************************************
12 FAUST Architecture File
13 Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale
14 ---------------------------------------------------------------------
15 This Architecture section is free software; you can redistribute it
16 and/or modify it under the terms of the GNU General Public License
17 as published by the Free Software Foundation; either version 3 of
18 the License, or (at your option) any later version.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with this program; If not, see <http://www.gnu.org/licenses/>.
27
28 EXCEPTION : As a special exception, you may create a larger work
29 that contains this FAUST architecture section and distribute
30 that work under terms of your choice, so long as this FAUST
31 architecture section is not modified.
32
33
34 ************************************************************************
35 ************************************************************************/
36
37 #include <libgen.h>
38 #include <iostream>
39
40 #include "gui/FUI.h"
41 #include "gui/faustqt.h"
42 #include "misc.h"
43 #include "audio/portaudio-dsp.h"
44
45 #ifdef OSCCTRL
46 #include "gui/OSCUI.h"
47 #endif
48
49
50 /******************************************************************************
51 *******************************************************************************
52
53 VECTOR INTRINSICS
54
55 *******************************************************************************
56 *******************************************************************************/
57
58 <<includeIntrinsic>>
59
60
61 /********************END ARCHITECTURE SECTION (part 1/2)****************/
62
63 /**************************BEGIN USER SECTION **************************/
64
65 <<includeclass>>
66
67 /***************************END USER SECTION ***************************/
68
69 /*******************BEGIN ARCHITECTURE SECTION (part 2/2)***************/
70
71 mydsp DSP;
72 list<GUI*> GUI::fGuiList;
73
74 /******************************************************************************
75 *******************************************************************************
76
77 MAIN PLAY THREAD
78
79 *******************************************************************************
80 *******************************************************************************/
81
82
83 long lopt(char *argv[], const char *name, long def)
84 {
85 int i;
86 for (i=0; argv[i]; i++) if (!strcmp(argv[i], name)) return atoi(argv[i+1]);
87 return def;
88 }
89
90 int main(int argc, char *argv[])
91 {
92 char appname[256];
93 char rcfilename[256];
94 char* home = getenv("HOME");
95
96 snprintf(appname, 255, "%s", basename(argv[0]));
97 snprintf(rcfilename, 255, "%s/.%src", home, appname);
98
99 GUI* interface = new QTGUI(argc, argv);
100 FUI* finterface = new FUI();
101 DSP.buildUserInterface(interface);
102 DSP.buildUserInterface(finterface);
103
104 #ifdef OSCCTRL
105 GUI* oscinterface = new OSCUI(appname, argc, argv);
106 DSP.buildUserInterface(oscinterface);
107 #endif
108
109 long srate = (long)lopt(argv, "--frequency", 44100);
110 int fpb = lopt(argv, "--buffer", 128);
111
112 portaudio audio (srate, fpb);
113 audio.init(appname, &DSP);
114 finterface->recallState(rcfilename);
115 audio.start();
116
117 #ifdef OSCCTRL
118 oscinterface->run();
119 #endif
120 interface->run();
121
122 audio.stop();
123 finterface->saveState(rcfilename);
124 return 0;
125 }
126
127 /********************END ARCHITECTURE SECTION (part 2/2)****************/
128