Debian Codegraph @

main.cpp

raw symbols SCIP
1 /* Copyright 2013 Kjetil S. Matheussen
2
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License
5 as published by the Free Software Foundation; either version 2
6 of the License, or (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
16
17
18 #include <math.h>
19 #include <signal.h>
20
21 #include <string>
22
23 //#include "audio/faudiostream/architecture/faust/gui/UI.h"
24
25 #include "nonlib/nsm.h"cxx . . $ `<file>/nonlib/nsm.h`/
26
27 #include <vector>
28
29 #define OPTARGS_CHECK_GETcxx . . $ `main.cpp:29:9`!(wrong,right) lokke==argc-1?(fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"Must supply argument for '%s'\n",argv[lokke]),exit(-4),wrong):right
30
31 #define OPTARGS_BEGINcxx . . $ `main.cpp:31:9`!(das_usage) {int lokke;const char *usage=das_usage;for(lokke=1;lokke<argc;lokke++){char *a=argv[lokke];if(!strcmp("--help",a)||!strcmp("-h",a)){fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"%s",usage);exit(0);
32 #define OPTARGcxx . . $ `main.cpp:32:9`!(name,name2) }}else if(!strcmp(name,a)||!strcmp(name2,a)){{
33 #define OPTARG_GETINTcxx . . $ `main.cpp:33:9`!() OPTARGS_CHECK_GET(0,atoll(argv[++lokke]))
34 //int optargs_inttemp;
35 //#define OPTARG_GETINT() OPTARGS_CHECK_GET(0,(optargs_inttemp=strtol(argv[++lokke],(char**)NULL,10),errno!=0?(perror("strtol"),0):optargs_inttemp))
36 #define OPTARG_GETFLOATcxx . . $ `main.cpp:36:9`!() OPTARGS_CHECK_GET(0.0f,atof(argv[++lokke]))
37 #define OPTARG_GETSTRINGcxx . . $ `main.cpp:37:9`!() OPTARGS_CHECK_GETcxx . . $ `main.cpp:29:9`!("",argv[++lokke])
38 #define OPTARG_LASTcxx . . $ `main.cpp:38:9`!() }}else if(lokke==argc-1 && argv[lokke][0]!='-'){lokke--;{
39 #define OPTARGS_ELSEcxx . . $ `main.cpp:39:9`!() }else if(1){
40 #define OPTARGS_ENDcxx . . $ `main.cpp:40:9`! }else{fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"%s",usage);exit(-1);}}}
41
42 #include "common/nsmtracker.h"cxx . . $ `<file>/common/nsmtracker.h`/
43 #include "Qt/Qt_MyQCheckBox.h"cxx . . $ `<file>/Qt/Qt_MyQCheckBox.h`/
44 #include "Qt/Qt_MyQSlider.h"cxx . . $ `<file>/Qt/Qt_MyQSlider.h`/
45 #include "Qt/Qt_MyQButton.h"cxx . . $ `<file>/Qt/Qt_MyQButton.h`/
46
47 static QColorcxx . . $ QColor# das_colorscxx . . $ das_colors.[16];
48 QColorcxx . . $ QColor# *g_colorscxx . . $ g_colors.=&das_colorscxx . . $ das_colors.[0];
49
50 #include "mQt_compressor_widget_callbacks.h"cxx . . $ `<file>/Qt/mQt_compressor_widget_callbacks.h`/
51
52 static void set_colorscxx . . $ set_colors(49f6e7a06ebc5aa8).(void){
53 das_colorscxx . . $ das_colors.[0] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#828070");
54 das_colorscxx . . $ das_colors.[1] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#00001d");
55 das_colorscxx . . $ das_colors.[2] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#f1ece6");
56 das_colorscxx . . $ das_colors.[3] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#98006d");
57 das_colorscxx . . $ das_colors.[4] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#6437a7");
58 das_colorscxx . . $ das_colors.[5] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#354353");
59 das_colorscxx . . $ das_colors.[6] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#8b6735");
60 das_colorscxx . . $ das_colors.[7] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#23405d");
61 das_colorscxx . . $ das_colors.[8] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#310062");
62 das_colorscxx . . $ das_colors.[9] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#8a8877");
63 das_colorscxx . . $ das_colors.[10] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#7a7a7a");
64 das_colorscxx . . $ das_colors.[11] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#696c5f");
65 das_colorscxx . . $ das_colors.[12] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#a1b09b");
66 das_colorscxx . . $ das_colors.[13] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#13511f");
67 das_colorscxx . . $ das_colors.[14] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#8a0000");
68 das_colorscxx . . $ das_colors.[15] =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(85c52e162fed56f9).("#7a7967");
69 }
70
71 bool g_autoconnectcxx . . $ g_autoconnect. = false;
72 const char *g_jack_client_namecxx . . $ g_jack_client_name. = "radium_compressor";
73 const char *g_settings_filenamecxx . . $ g_settings_filename. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
74 const char *g_shared_mem_keycxx . . $ g_shared_mem_key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
75
76 static Compressor_widgetcxx . . $ Compressor_widget# *g_compressor_editorcxx . . $ g_compressor_editor. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
77 static void *g_compressorcxx . . $ g_compressor. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
78
79 Compressor_widgetcxx . . $ Compressor_widget# *create_compressor_editorcxx . . $ create_compressor_editor(75609d0be94da4d6).(QWidgetcxx . . $ QWidget# *parent, void *compressor){
80 // A minimal radium patch environment.
81 struct Patchcxx . . $ Patch# *patch = new Patchcxx . . $ Patch#;
82 SoundPlugin *plugin = new SoundPlugin;
83 patch->patchdatacxx . . $ Patch#patchdata. = plugin;
84 plugin->compressorcxx . . $ SoundPlugin#compressor. = compressor;
85
86 Compressor_widgetcxx . . $ Compressor_widget# *compressor_widget = new Compressor_widgetcxx . . $ Compressor_widget#(patch,parent);
87
88 if(g_settings_filenamecxx . . $ g_settings_filename.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
89 compressor_widget->loadcxx . . $ Compressor_widget#load(4e51b35ce1bea96b).(g_settings_filenamecxx . . $ QString#QString(85c52e162fed56f9).);
90
91 set_colorscxx . . $ set_colors(49f6e7a06ebc5aa8).();
92
93 QPalettecxx . . $ QPalette# pal = compressor_widgetcxx . . $ QPalette#QPalette(f826ed73d5553cd5).->palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).();
94 //pal.setColor(compressor.backgroundRole(), das_colors[11].light(200));
95 pal.setColorcxx . . $ QPalette#setColor(4fd5272df43acd68).(compressor_widget->backgroundRolecxx . . $ QWidget#backgroundRole(fb0b8682864ec54b).(), das_colorscxx . . $ das_colors.[11].lightcxx . . $ QColor#light(a312dab4e0811e0).(100));
96 compressor_widget->setPalettecxx . . $ QWidget#setPalette(f826ed73d5553cd5).(pal);
97
98 return compressor_widget;
99 }
100
101 void delete_compressor_editorcxx . . $ delete_compressor_editor(34ad793e36b31af8).(Compressor_widgetcxx . . $ Compressor_widget# *compressor_editor){
102 struct Patchcxx . . $ Patch# *patch=compressor_editor->_patchcxx . . $ Compressor_widget#_patch.;
103 struct SoundPlugincxx . . $ SoundPlugin# *plugin=(SoundPlugin*)patch->patchdatacxx . . $ Patch#patchdata.;
104 COMPRESSOR_delete(plugin->compressorcxx . . $ SoundPlugin#compressor.);
105 //delete compressor;
106 }
107
108 static nsm_client_tcxx . . $ nsm_client_t# *g_nsmcxx . . $ g_nsm. = 0;
109 static bool g_nsm_quit_nowcxx . . $ g_nsm_quit_now. = false;
110
111
112 struct NSMTimercxx . . $ NSMTimer# : public QTimercxx . . $ QTimer#{
113 void timerEventcxx . . $ NSMTimer#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent# * e){
114 if(g_nsm_quit_nowcxx . . $ g_nsm_quit_now.==true)
115 QApplicationcxx . . $ QApplication#::quitcxx . . $ QCoreApplication#quit(49f6e7a06ebc5aa8).();
116 else
117 nsm_check_nowaitcxx . . $ nsm_check_nowait(539e082cf00e1f43).(g_nsmcxx . . $ g_nsm.);
118 }
119 };
120
121 NSMTimercxx . . $ NSMTimer# g_nsm_timercxx . . $ g_nsm_timer.;
122
123 static const char *g_nsm_save_filenamecxx . . $ g_nsm_save_filename.;
124
125 int rc_nsm_opencxx . . $ rc_nsm_open(f45a252860f80f3f). ( const char *name,
126 const char *display_name,
127 const char *client_id,
128 char **out_msg,
129 void *userdata )
130 {
131
132 if(g_compressor_editorcxx . . $ g_compressor_editor. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
133 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"calling nsm open twice is not supported.\n");
134 abort();
135 }
136
137 //do_open_stuff();
138 g_jack_client_namecxx . . $ g_jack_client_name. = client_id;
139 g_compressorcxx . . $ g_compressor. = COMPRESSOR_create(0);
140
141 if(g_nsm_save_filenamecxx . . $ g_nsm_save_filename. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
142 free((void*)g_nsm_save_filenamecxx . . $ g_nsm_save_filename.);
143 g_nsm_save_filenamecxx . . $ g_nsm_save_filename. = strdup(name);
144
145 g_compressor_editorcxx . . $ g_compressor_editor. = create_compressor_editorcxx . . $ create_compressor_editor(75609d0be94da4d6).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, g_compressorcxx . . $ g_compressor.);
146 g_compressor_editorcxx . . $ g_compressor_editor.->load_buttoncxx . . $ Ui_Compressor_widget#load_button.->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).();
147 g_compressor_editorcxx . . $ g_compressor_editor.->save_buttoncxx . . $ Ui_Compressor_widget#save_button.->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).();
148 g_compressor_editorcxx . . $ g_compressor_editor.->setWindowFlagscxx . . $ QWidget#setWindowFlags(f800b5e9bc59e42e). ( Qtcxx . . $ Qt/::CustomizeWindowHintcxx . . $ Qt/CustomizeWindowHint. |cxx . . $ Qt/`operator|`(5a3fd7a290f7a57d). Qtcxx . . $ Qt/::WindowTitleHintcxx . . $ Qt/WindowTitleHint.);
149
150 g_compressor_editorcxx . . $ g_compressor_editor.->loadcxx . . $ Compressor_widget#load(4e51b35ce1bea96b).(namecxx . . $ QString#QString(85c52e162fed56f9)., false);
151 g_compressor_editorcxx . . $ g_compressor_editor.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
152
153
154 char temp[1000];
155 sprintf(temp, "Open. name: %s, display_name: %s, client_id: %s\n",name, display_name, client_id);
156 *out_msg = strdup(temp);
157 puts(temp);
158
159 return ERR_OKcxx . . $ ERR_OK.;
160 }
161
162 int rc_nsm_savecxx . . $ rc_nsm_save(25b325de30aced6c). ( char **out_msg,
163 void *userdata )
164 {
165 //do_save_stuff();
166 g_compressor_editorcxx . . $ g_compressor_editor.->savecxx . . $ Compressor_widget#save(7df51288a9ebd664).(g_nsm_save_filenamecxx . . $ QString#QString(85c52e162fed56f9).);
167
168 char temp[1000];
169 sprintf(temp, "Save. userdata: %p\n", userdata);
170 *out_msg = strdup(temp);
171 puts(temp);
172 return ERR_OKcxx . . $ ERR_OK.;
173 }
174
175 void rc_nsm_signalHanldercxx . . $ rc_nsm_signalHanlder(d4f767463ce0a6b3).(int sigNum)
176 {
177 g_nsm_quit_nowcxx . . $ g_nsm_quit_now. = true;
178 }
179
180
181 void start_programcxx . . $ start_program(c759356ac01a31e7).(int argc, char **argv){
182
183 QApplicationcxx . . $ QApplication# appcxx . . $ QApplication#QApplication(6e9b1c7df49e191d).(argc, argv);
184
185 {
186
187
188 // nsm
189 {
190 const char *nsm_url = getenv( "NSM_URL" );
191 if ( nsm_url )
192 {
193 g_nsmcxx . . $ g_nsm. = nsm_newcxx . . $ nsm_new(60be7a5da8c9361a).();
194
195 printf("NSM: %p\n",g_nsmcxx . . $ g_nsm.);
196
197 nsm_set_open_callbackcxx . . $ nsm_set_open_callback(f0c1f274ab7703f0).( g_nsmcxx . . $ g_nsm., rc_nsm_opencxx . . $ rc_nsm_open(f45a252860f80f3f)., 0 );
198 nsm_set_save_callbackcxx . . $ nsm_set_save_callback(e30f969e3cd24f1d).( g_nsmcxx . . $ g_nsm., rc_nsm_savecxx . . $ rc_nsm_save(25b325de30aced6c)., 0 );
199
200 if ( 0 == nsm_initcxx . . $ nsm_init(997c68810b24581d).( g_nsmcxx . . $ g_nsm., nsm_url ) )
201 {
202 signal(SIGTERMcxx . . $ `<external>/11773118241360591791/signum-generic.h:53:9`!, rc_nsm_signalHanldercxx . . $ rc_nsm_signalHanlder(d4f767463ce0a6b3).);
203 nsm_send_announcecxx . . $ nsm_send_announce(6cd4fd716945be91).( g_nsmcxx . . $ g_nsm., "Radium Compressor", "", argv[0] );
204 g_nsm_timercxx . . $ g_nsm_timer..setIntervalcxx . . $ QTimer#setInterval(d4f767463ce0a6b3).(50);
205 g_nsm_timercxx . . $ g_nsm_timer..startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).();
206
207 }
208 else
209 {
210 nsm_freecxx . . $ nsm_free(539e082cf00e1f43).( g_nsmcxx . . $ g_nsm. );
211 g_nsmcxx . . $ g_nsm. = 0;
212 }
213 }
214 }
215
216 if(g_nsmcxx . . $ g_nsm. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!){
217 if (g_compressorcxx . . $ g_compressor. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
218 g_compressorcxx . . $ g_compressor. = COMPRESSOR_create(0);
219 g_compressor_editorcxx . . $ g_compressor_editor. = create_compressor_editorcxx . . $ create_compressor_editor(75609d0be94da4d6).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, g_compressorcxx . . $ g_compressor.);
220 g_compressor_editorcxx . . $ g_compressor_editor.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).();
221 }
222
223 app.execcxx . . $ QApplication#exec(b126dc7c1de90089).();
224
225 if(g_compressor_editorcxx . . $ g_compressor_editor. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
226 delete_compressor_editorcxx . . $ delete_compressor_editor(34ad793e36b31af8).(g_compressor_editorcxx . . $ g_compressor_editor.);
227 }
228 }
229
230 #ifndef COMPILING_VST
231
232 void *COMPRESSOR_create_ladspacxx . . $ COMPRESSOR_create_ladspa(42228c1987407501).(const char *key);
233
234
235
236
237 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv){
238
239 {
240 // Qt insists on doing strange things with locale settings, causing commans to appear instead of punctation. In an ideal world, LC_NUMERIC/LANG should never be set to anything else than "C", but unfortunately, many computers runs with uncommon language settings such as french or swedish. By default, programs seems to respect the sane behaviour (in the programming world), namely to never use commas when converting between strings and floats, but Qt does something strange with the world inside the QApplication contructor, and causes commas to be used everywhere if there is an uncommon LC_NUMERIC settings (or uncommon LANG setting).
241
242 setenv("LC_NUMERIC", "C", 1);
243
244 putenv(strdup("LC_NUMERIC=C")); // for mingw
245
246 QLocalecxx . . $ QLocale#::setDefaultcxx . . $ QLocale#setDefault(5c1b5ae6bc7ef6b4).(QLocalecxx . . $ QLocale#::ccxx . . $ QLocale#c(7171962d3a2fd395).());
247
248 QApplicationcxx . . $ QApplication#::setDesktopSettingsAwarecxx . . $ QGuiApplication#setDesktopSettingsAware(b45ddcbc8423892c).(false);
249
250 QLocalecxx . . $ QLocale#::setDefaultcxx . . $ QLocale#setDefault(5c1b5ae6bc7ef6b4).(QLocalecxx . . $ QLocale#QLocale(a0465d0afca1f93d).::Ccxx . . $ QLocale#C.);
251 }
252
253 OPTARGS_BEGINcxx . . $ `main.cpp:31:9`!("radium_compressor [--autoconnect] [--client-name s] [--settings-filename s] [settings-filename]\n"
254 " [ -ac ] [ -cn s] [ -sn s] [settings filename]\n"
255 "\n"
256 "\"autoconnect\" connects radium_compressor to physical in and out ports.\n"
257 "\"client-name\" sets the name of the jack client.\n"
258 "\"settings-filename\" is the name of a settings file to load at startup.\n"
259 )
260 {
261
262 OPTARGcxx . . $ `main.cpp:32:9`!("--settings-filename","-sn") g_settings_filenamecxx . . $ g_settings_filename.=OPTARG_GETSTRINGcxx . . $ `main.cpp:37:9`!();
263 OPTARGcxx . . $ `main.cpp:32:9`!("--autoconnect","-ac") g_autoconnectcxx . . $ g_autoconnect.=true;
264 OPTARGcxx . . $ `main.cpp:32:9`!("--client-name","-cn") g_jack_client_namecxx . . $ g_jack_client_name.=OPTARG_GETSTRINGcxx . . $ `main.cpp:37:9`!();
265 //OPTARG("--ladspa-slave","-ls") g_shared_mem_key = OPTARG_GETSTRING();
266 OPTARG_LASTcxx . . $ `main.cpp:38:9`!() g_settings_filenamecxx . . $ g_settings_filename.=OPTARG_GETSTRINGcxx . . $ `main.cpp:37:9`!();
267 }OPTARGS_ENDcxx . . $ `main.cpp:40:9`!;
268
269 if(g_shared_mem_keycxx . . $ g_shared_mem_key.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!){
270
271 g_compressorcxx . . $ g_compressor. = COMPRESSOR_create_ladspacxx . . $ COMPRESSOR_create_ladspa(42228c1987407501).(g_shared_mem_keycxx . . $ g_shared_mem_key.);
272 start_programcxx . . $ start_program(c759356ac01a31e7).(argc,argv);
273
274 }else{
275
276 start_programcxx . . $ start_program(c759356ac01a31e7).(argc,argv);
277
278 }
279 return 0;
280 }
281
282 #endif