Refactoring of rec process "~" in faustexp.ml.
[Faustine.git] / interpretor / faust-0.9.47mr3 / architecture / ca-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
38 #include <libgen.h>
39 #include <stdlib.h>
40 #include <iostream>
41
42 #include "gui/FUI.h"
43 #include "gui/faustqt.h"
44 #include "misc.h"
45 #include "audio/coreaudio-dsp.h"
46
47 #ifdef OSCCTRL
48 #include "gui/OSCUI.h"
49 #endif
50
51 /**************************BEGIN USER SECTION **************************/
52
53 /******************************************************************************
54 *******************************************************************************
55
56 VECTOR INTRINSICS
57
58 *******************************************************************************
59 *******************************************************************************/
60 <<includeIntrinsic>>
61
62
63 <<includeclass>>
64
65 /***************************END USER SECTION ***************************/
66
67 /*******************BEGIN ARCHITECTURE SECTION (part 2/2)***************/
68
69 mydsp DSP;
70
71 list<GUI*> GUI::fGuiList;
72
73 /******************************************************************************
74 *******************************************************************************
75
76 MAIN PLAY THREAD
77
78 *******************************************************************************
79 *******************************************************************************/
80
81 int main(int argc, char *argv[])
82 {
83 char name[256];
84 char rcfilename[256];
85 char* home = getenv("HOME");
86
87 snprintf(name, 255, "%s", basename(argv[0]));
88 snprintf(rcfilename, 255, "%s/.%src", home, basename(argv[0]));
89
90 long srate = (long)lopt(argv, "--frequency", 44100);
91 int fpb = lopt(argv, "--buffer", 512);
92
93 GUI* interface = new QTGUI(argc, argv);
94 DSP.buildUserInterface(interface);
95 FUI* finterface = new FUI();
96 DSP.buildUserInterface(finterface);
97
98 #ifdef OSCCTRL
99 GUI* oscinterface = new OSCUI(name, argc, argv);
100 DSP.buildUserInterface(oscinterface);
101 #endif
102
103 coreaudio audio(srate, fpb);
104 audio.init(name, &DSP);
105 finterface->recallState(rcfilename);
106 audio.start();
107
108 #ifdef OSCCTRL
109 oscinterface->run();
110 #endif
111 interface->run();
112
113 audio.stop();
114 finterface->saveState(rcfilename);
115 return 0;
116 }
117
118
119 /********************END ARCHITECTURE SECTION (part 2/2)****************/
120
121