Debian Codegraph @

myladspa.cpp

raw symbols SCIP
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 <math.h>
38 #include <stdlib.h>
39 #include <string.h>
40 #include <stdio.h>
41 #include <unistd.h>
42
43 #include <stack>
44 #include <string>
45 #include <iostream>
46 #include <map>
47
48 #include <QSharedMemory>
49 #include <QDateTime>
50
51 #include "ladspa.h"
52 #include "faust/gui/GUI.h"cxx . . $ `<file>/faudiostream/architecture/faust/gui/GUI.h`/
53 #include "faust/misc.h"cxx . . $ `<file>/faudiostream/architecture/faust/misc.h`/
54 #include "faust/audio/dsp.h"cxx . . $ `<file>/faudiostream/architecture/faust/audio/dsp.h`/
55
56 // On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
57 // flags to avoid costly denormals
58 #ifdef __SSE__cxx . . $ `<built-in>:453:9`!
59 #include <xmmintrin.h>
60 #ifdef __SSE2__cxx . . $ `<built-in>:451:9`!
61 #define AVOIDDENORMALScxx . . $ `myladspa.cpp:61:17`! _mm_setcsr(_mm_getcsr() | 0x8040)
62 #else
63 #define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
64 #endif
65 #else
66 #warning *** ladspa.cpp: NO SSE FLAG (denormals may slow things down) ***
67 #define AVOIDDENORMALS
68 #endif
69
70 #define symcxx . . $ `myladspa.cpp:70:9`!(name) xsymcxx . . $ `myladspa.cpp:71:9`!(name)
71 #define xsymcxx . . $ `myladspa.cpp:71:9`!(name) #name
72
73 /******************************************************************************
74 *******************************************************************************
75
76 VECTOR INTRINSICS
77
78 *******************************************************************************
79 *******************************************************************************/
80 #include "common/nsmtracker.h"cxx . . $ `<file>/common/nsmtracker.h`/
81 #include "audio/system_compressor_wrapper_proc.h"cxx . . $ `<file>/audio/system_compressor_wrapper_proc.h`/
82
83 #include "audio/system_compressor.cpp"cxx . . $ `<file>/audio/system_compressor.cpp`/
84
85 #define mydspcxx . . $ `myladspa.cpp:85:9`! Faust_system_compressor
86
87 //<<includeIntrinsic>>
88
89 /********************END ARCHITECTURE SECTION (part 1/2)****************/
90
91 /**************************BEGIN USER SECTION **************************/
92
93 //<<includeclass>>
94
95 /***************************END USER SECTION ***************************/
96
97 /*******************BEGIN ARCHITECTURE SECTION (part 2/2)***************/
98
99 //-----------------------------------portCollector--------------------------------------
100 //
101 // portCollector is passed to the buildUserInterface method of a dsp object
102 // in order to build a description of its inputs, outputs and control ports.
103 // This description is used to fill a LADSPA_Descriptor
104 //
105 //--------------------------------------------------------------------------------------
106
107 //--------------------------------useful constants--------------------------------------
108
109 #define MAXPORTcxx . . $ `myladspa.cpp:109:9`! 1024
110 static const int ICONTROLcxx . . $ ICONTROL. = LADSPA_PORT_INPUTcxx . . $ `<external>/14375785390476756063/ladspa.h:155:9`!|LADSPA_PORT_CONTROLcxx . . $ `<external>/14375785390476756063/ladspa.h:162:9`!;
111 static const int OCONTROLcxx . . $ OCONTROL. = LADSPA_PORT_OUTPUTcxx . . $ `<external>/14375785390476756063/ladspa.h:158:9`!|LADSPA_PORT_CONTROLcxx . . $ `<external>/14375785390476756063/ladspa.h:162:9`!;
112 static const int RANGEcxx . . $ RANGE. = LADSPA_PORT_INPUTcxx . . $ `<external>/14375785390476756063/ladspa.h:155:9`!|LADSPA_PORT_CONTROLcxx . . $ `<external>/14375785390476756063/ladspa.h:162:9`!;
113
114 static const char* inamescxx . . $ inames.[] = {
115 "input00", "input01", "input02", "input03", "input04",
116 "input05", "input06", "input07", "input08", "input09",
117 "input10", "input11", "input12", "input13", "input14",
118 "input15", "input16", "input17", "input18", "input19",
119 "input20", "input21", "input22", "input23", "input24",
120 "input25", "input26", "input27", "input28", "input29",
121 "input30", "input31", "input32", "input33", "input34",
122 "input35", "input36", "input37", "input38", "input39"
123 };
124
125 static const char* onamescxx . . $ onames.[] = {
126 "output00", "output01", "output02", "output03", "output04",
127 "output05", "output06", "output07", "output08", "output09",
128 "output10", "output11", "output12", "output13", "output14",
129 "output15", "output16", "output17", "output18", "output19",
130 "output20", "output21", "output22", "output23", "output24",
131 "output25", "output26", "output27", "output28", "output29",
132 "output30", "output31", "output32", "output33", "output34",
133 "output35", "output36", "output37", "output38", "output39"
134 };
135
136 class portCollectorcxx . . $ portCollector# : public UIcxx . . $ UI#
137 {
138 private:
139
140 //--------------------------------------------------------------------------------------
141
142 const int fInsCountcxx . . $ portCollector#fInsCount.; // number of audio input ports
143 const int fOutsCountcxx . . $ portCollector#fOutsCount.; // number of audio output ports
144 int fCtrlCountcxx . . $ portCollector#fCtrlCount.; // number of control ports
145
146 LADSPA_PortDescriptor fPortDescscxx . . $ portCollector#fPortDescs.[MAXPORTcxx . . $ `myladspa.cpp:109:9`!]; // table of port descriptors to be used in a LADSPA_Descriptor
147 const char* fPortNamescxx . . $ portCollector#fPortNames.[MAXPORTcxx . . $ `myladspa.cpp:109:9`!]; // table of port names to be used in a LADSPA_Descriptor
148 LADSPA_PortRangeHint fPortHintscxx . . $ portCollector#fPortHints.[MAXPORTcxx . . $ `myladspa.cpp:109:9`!]; // table of port hints to be used in a LADSPA_Descriptor
149
150 stringcxx . . $ std/string# fPluginNamecxx . . $ portCollector#fPluginName.; // toplevel prefix used as plugin name
151 stackcxx . . $ std/stack#<stringcxx . . $ std/string#> fPrefixcxx . . $ portCollector#fPrefix.; // current prefix for controls name
152
153
154 //--------------------------------------------------------------------------------------
155 stringcxx . . $ std/string# simplifycxx . . $ portCollector#simplify(fd626fc03107dd24).(const stringcxx . . $ std/string#& src)
156 {
157 int i=0;
158 int level=2;
159 stringcxx . . $ std/string# dstcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
160
161 while (src[cxx . . $ std/__cxx11/basic_string#`operator[]`(dd01cf3f78ddc127).i] ) {
162
163 switch (level) {
164
165 case 0 :
166 case 1 :
167 case 2 :
168 // Skip the begin of the label "--foo-"
169 // until 3 '-' have been read
170 if (src[cxx . . $ std/__cxx11/basic_string#`operator[]`(dd01cf3f78ddc127).i]=='-') { level++; }
171 break;
172
173 case 3 :
174 // copy the content, but skip non alphnum
175 // and content in parenthesis
176 switch (src[cxx . . $ std/__cxx11/basic_string#`operator[]`(dd01cf3f78ddc127).i]) {
177 case '(' :
178 case '[' :
179 level++;
180 break;
181
182 case '-' :
183 dst +=cxx . . $ std/__cxx11/basic_string#`operator+=`(63cc1ae870623930). '-';
184 break;
185
186 default :
187 if (isalnum(src[cxx . . $ std/__cxx11/basic_string#`operator[]`(dd01cf3f78ddc127).i])) {
188 dst+=cxx . . $ std/__cxx11/basic_string#`operator+=`(63cc1ae870623930). tolower(src[cxx . . $ std/__cxx11/basic_string#`operator[]`(dd01cf3f78ddc127).i]);
189 }
190
191 }
192 break;
193
194 default :
195 // here we are inside parenthesis and
196 // we skip the content until we are back to
197 // level 3
198 switch (src[cxx . . $ std/__cxx11/basic_string#`operator[]`(dd01cf3f78ddc127).i]) {
199
200 case '(' :
201 case '[' :
202 level++;
203 break;
204
205 case ')' :
206 case ']' :
207 level--;
208 break;
209
210 default :
211 break;
212 }
213
214 }
215 i++;
216 }
217 return (cxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).dst.sizecxx . . $ std/__cxx11/basic_string#size(6f8bd5c0ea8fb29a).() > 0) ? dst :src;
218 }
219
220 void addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(int type, const char* label, int hint, float min=0.0, float max=0.0)
221 {
222 stringcxx . . $ std/string# fullname = simplifycxx . . $ portCollector#simplify(fd626fc03107dd24).(fPrefixcxx . . $ portCollector#fPrefix..topcxx . . $ std/stack#top(d8c1a3bbdff15733).() +cxx . . $ std/operator+(40fc1db9226233c6). "-" +cxx . . $ std/operator+(900ec9581c410ad9). label);
223 char * str = strdup(fullname.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
224
225 fPortDescscxx . . $ portCollector#fPortDescs.[fInsCountcxx . . $ portCollector#fInsCount. + fOutsCountcxx . . $ portCollector#fOutsCount. + fCtrlCountcxx . . $ portCollector#fCtrlCount.] = type;
226 fPortNamescxx . . $ portCollector#fPortNames.[fInsCountcxx . . $ portCollector#fInsCount. + fOutsCountcxx . . $ portCollector#fOutsCount. + fCtrlCountcxx . . $ portCollector#fCtrlCount.] = str;
227 fPortHintscxx . . $ portCollector#fPortHints.[fInsCountcxx . . $ portCollector#fInsCount. + fOutsCountcxx . . $ portCollector#fOutsCount. + fCtrlCountcxx . . $ portCollector#fCtrlCount.].HintDescriptor = hint;
228 fPortHintscxx . . $ portCollector#fPortHints.[fInsCountcxx . . $ portCollector#fInsCount. + fOutsCountcxx . . $ portCollector#fOutsCount. + fCtrlCountcxx . . $ portCollector#fCtrlCount.].LowerBound = min;
229 fPortHintscxx . . $ portCollector#fPortHints.[fInsCountcxx . . $ portCollector#fInsCount. + fOutsCountcxx . . $ portCollector#fOutsCount. + fCtrlCountcxx . . $ portCollector#fCtrlCount.].UpperBound = max;
230 fCtrlCountcxx . . $ portCollector#fCtrlCount.++;
231 }
232
233 void openAnyBoxcxx . . $ portCollector#openAnyBox(85c52e162fed56f9).(const char* label)
234 {
235 if (fPrefixcxx . . $ portCollector#fPrefix..sizecxx . . $ std/stack#size(71e6dd9020568ee8).() == 0) {
236 // top level label is used as plugin name
237 fPluginNamecxx . . $ portCollector#fPluginName. =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). label;
238 fPrefixcxx . . $ portCollector#fPrefix..pushcxx . . $ std/stack#push(bfe8a576267fe2ec).(labelcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
239
240 } else {
241 stringcxx . . $ std/string# scxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
242 if (label && label[0]) {
243 s =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). fPrefixcxx . . $ portCollector#fPrefix..topcxx . . $ std/stack#top(d8c1a3bbdff15733).() +cxx . . $ std/operator+(40fc1db9226233c6). "-" +cxx . . $ std/operator+(900ec9581c410ad9). label;
244 } else {
245 s =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). fPrefixcxx . . $ portCollector#fPrefix..topcxx . . $ std/stack#top(d8c1a3bbdff15733).();
246 }
247 fPrefixcxx . . $ portCollector#fPrefix..pushcxx . . $ std/stack#push(5cd2eaf705c8bad3).(s);
248 }
249 }
250
251 public:
252
253 //--------------------------------Collect the audio ports-------------------------------
254
255 portCollectorcxx . . $ portCollector#portCollector(3e454b8ccf442868).(int ins, int outs) : UIcxx . . $ UI#(), fInsCountcxx . . $ portCollector#fInsCount.(ins), fOutsCountcxx . . $ portCollector#fOutsCount.(outs), fCtrlCountcxx . . $ portCollector#fCtrlCount.(0)
256 {
257 for (int i = 0; i < ins; i++) {
258 fPortDescscxx . . $ portCollector#fPortDescs.[i] = LADSPA_PORT_INPUTcxx . . $ `<external>/14375785390476756063/ladspa.h:155:9`! | LADSPA_PORT_AUDIOcxx . . $ `<external>/14375785390476756063/ladspa.h:166:9`!;
259 fPortNamescxx . . $ portCollector#fPortNames.[i] = inamescxx . . $ inames.[i];
260 fPortHintscxx . . $ portCollector#fPortHints.[i].HintDescriptor = 0;
261 }
262 for (int j = 0; j < outs; j++) {
263 fPortDescscxx . . $ portCollector#fPortDescs.[ins + j] = LADSPA_PORT_OUTPUTcxx . . $ `<external>/14375785390476756063/ladspa.h:158:9`! | LADSPA_PORT_AUDIOcxx . . $ `<external>/14375785390476756063/ladspa.h:166:9`!;
264 fPortNamescxx . . $ portCollector#fPortNames.[ins + j] = onamescxx . . $ onames.[j];
265 fPortHintscxx . . $ portCollector#fPortHints.[ins + j].HintDescriptor = 0;
266 }
267 };
268
269 virtual ~cxx . . $ portCollector#`~portCollector`(ced63f7c635d850d).portCollectorcxx . . $ portCollector#() {}
270
271 //------------------------------Collect the control ports-------------------------------
272
273 virtual void addButtoncxx . . $ portCollector#addButton(d2efea74a95ba4f0).(const char* label, float* zone) {
274 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(ICONTROLcxx . . $ ICONTROL., label, LADSPA_HINT_TOGGLEDcxx . . $ `<external>/14375785390476756063/ladspa.h:224:9`!);
275 }
276
277 virtual void addToggleButtoncxx . . $ portCollector#addToggleButton(d2efea74a95ba4f0).(const char* label, float* zone) {
278 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(ICONTROLcxx . . $ ICONTROL., label, LADSPA_HINT_TOGGLEDcxx . . $ `<external>/14375785390476756063/ladspa.h:224:9`!);
279 }
280
281 virtual void addCheckButtoncxx . . $ portCollector#addCheckButton(d2efea74a95ba4f0).(const char* label, float* zone) {
282 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(ICONTROLcxx . . $ ICONTROL., label, LADSPA_HINT_TOGGLEDcxx . . $ `<external>/14375785390476756063/ladspa.h:224:9`!);
283 }
284
285 virtual void addVerticalSlidercxx . . $ portCollector#addVerticalSlider(dd97e545ed932d9f).(const char* label, float* zone, float init, float min, float max, float step) {
286 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(ICONTROLcxx . . $ ICONTROL., label, LADSPA_HINT_BOUNDED_BELOWcxx . . $ `<external>/14375785390476756063/ladspa.h:208:9`! | LADSPA_HINT_BOUNDED_ABOVEcxx . . $ `<external>/14375785390476756063/ladspa.h:216:9`!, min, max);
287 }
288
289 virtual void addHorizontalSlidercxx . . $ portCollector#addHorizontalSlider(dd97e545ed932d9f).(const char* label, float* zone, float init, float min, float max, float step) {
290 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(ICONTROLcxx . . $ ICONTROL., label, LADSPA_HINT_BOUNDED_BELOWcxx . . $ `<external>/14375785390476756063/ladspa.h:208:9`! | LADSPA_HINT_BOUNDED_ABOVEcxx . . $ `<external>/14375785390476756063/ladspa.h:216:9`!, min, max);
291 }
292
293 virtual void addNumEntrycxx . . $ portCollector#addNumEntry(dd97e545ed932d9f).(const char* label, float* zone, float init, float min, float max, float step) {
294 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(ICONTROLcxx . . $ ICONTROL., label, LADSPA_HINT_BOUNDED_BELOWcxx . . $ `<external>/14375785390476756063/ladspa.h:208:9`! | LADSPA_HINT_BOUNDED_ABOVEcxx . . $ `<external>/14375785390476756063/ladspa.h:216:9`!, min, max);
295 }
296
297 // -- passive widgets
298
299 virtual void addNumDisplaycxx . . $ portCollector#addNumDisplay(75b6969b25080c5b).(const char* label, float* zone, int precision) {
300 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(OCONTROLcxx . . $ OCONTROL., label, 0, -10000, +10000);
301 }
302 virtual void addTextDisplaycxx . . $ portCollector#addTextDisplay(b0b4be5486cbde75).(const char* label, float* zone, const char* names[], float min, float max) {
303 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(OCONTROLcxx . . $ OCONTROL., label, LADSPA_HINT_BOUNDED_BELOWcxx . . $ `<external>/14375785390476756063/ladspa.h:208:9`! | LADSPA_HINT_BOUNDED_ABOVEcxx . . $ `<external>/14375785390476756063/ladspa.h:216:9`!, min, max);
304 }
305 virtual void addHorizontalBargraphcxx . . $ portCollector#addHorizontalBargraph(9c4395346a0a905e).(const char* label, float* zone, float min, float max) {
306 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(OCONTROLcxx . . $ OCONTROL., label, LADSPA_HINT_BOUNDED_BELOWcxx . . $ `<external>/14375785390476756063/ladspa.h:208:9`! | LADSPA_HINT_BOUNDED_ABOVEcxx . . $ `<external>/14375785390476756063/ladspa.h:216:9`!, min, max);
307 }
308 virtual void addVerticalBargraphcxx . . $ portCollector#addVerticalBargraph(9c4395346a0a905e).(const char* label, float* zone, float min, float max){
309 addPortDescrcxx . . $ portCollector#addPortDescr(56c8211586e36dba).(OCONTROLcxx . . $ OCONTROL., label, LADSPA_HINT_BOUNDED_BELOWcxx . . $ `<external>/14375785390476756063/ladspa.h:208:9`! | LADSPA_HINT_BOUNDED_ABOVEcxx . . $ `<external>/14375785390476756063/ladspa.h:216:9`!, min, max);
310 }
311
312 virtual void openFrameBoxcxx . . $ portCollector#openFrameBox(85c52e162fed56f9).(const char* label) { openAnyBoxcxx . . $ portCollector#openAnyBox(85c52e162fed56f9).(label); }
313 virtual void openTabBoxcxx . . $ portCollector#openTabBox(85c52e162fed56f9).(const char* label) { openAnyBoxcxx . . $ portCollector#openAnyBox(85c52e162fed56f9).(label); }
314 virtual void openHorizontalBoxcxx . . $ portCollector#openHorizontalBox(85c52e162fed56f9).(const char* label) { openAnyBoxcxx . . $ portCollector#openAnyBox(85c52e162fed56f9).(label); }
315 virtual void openVerticalBoxcxx . . $ portCollector#openVerticalBox(85c52e162fed56f9).(const char* label) { openAnyBoxcxx . . $ portCollector#openAnyBox(85c52e162fed56f9).(label); }
316
317 virtual void closeBoxcxx . . $ portCollector#closeBox(49f6e7a06ebc5aa8).() { fPrefixcxx . . $ portCollector#fPrefix..popcxx . . $ std/stack#pop(49f6e7a06ebc5aa8).(); }
318
319 virtual void showcxx . . $ portCollector#show(49f6e7a06ebc5aa8).() {}
320 virtual void runcxx . . $ portCollector#run(49f6e7a06ebc5aa8).() {}
321
322 //---------------------------------Fill the LADSPA descriptor---------------------------
323
324 // generate an ID from a plugin name
325 int makeIDcxx . . $ portCollector#makeID(5c4306d8553b3696). (const char* s) {
326 int h = 0;
327 for (int i = 0; s[i]; i++) {
328 h = (h << 3) + (s[i] & 7);
329 }
330 return 1+h%1000;
331 }
332
333 // fill a ladspa descriptor with the information collected on ports
334 void fillPortDescriptioncxx . . $ portCollector#fillPortDescription(54a5ce3a0a7b46f1). (LADSPA_Descriptor * descriptor) {
335 const char* name = symcxx . . $ `myladspa.cpp:70:9`!(mydspcxx . . $ `myladspa.cpp:85:9`!);
336 descriptor->PortCount = fCtrlCountcxx . . $ portCollector#fCtrlCount.+fInsCountcxx . . $ portCollector#fInsCount.+fOutsCountcxx . . $ portCollector#fOutsCount.;
337 descriptor->PortDescriptors = fPortDescscxx . . $ portCollector#fPortDescs.;
338 descriptor->PortNames = fPortNamescxx . . $ portCollector#fPortNames.;
339 descriptor->PortRangeHints = fPortHintscxx . . $ portCollector#fPortHints.;
340
341 descriptor->Label = strdup(name);
342 descriptor->UniqueID = makeIDcxx . . $ portCollector#makeID(5c4306d8553b3696).(name);
343 // descriptor->Label = strdup(fPluginName.c_str());
344 // descriptor->UniqueID = makeID(fPluginName.c_str());
345 descriptor->Properties = LADSPA_PROPERTY_HARD_RT_CAPABLEcxx . . $ `<external>/14375785390476756063/ladspa.h:132:9`!;
346 descriptor->Name = name;
347 // descriptor->Name = strdup(fPluginName.c_str());
348 descriptor->Maker = "undefined";
349 descriptor->Copyright = "undefined";
350 }
351 };
352
353 //--------------------------------------portData----------------------------------------
354 //
355 // portData : a user interface used to associate the data buffers and the ports
356 //
357 //--------------------------------------------------------------------------------------
358
359 class portDatacxx . . $ portData# : public UIcxx . . $ UI#
360 {
361
362 public:
363
364 //--------------------------------------------------------------------------------------
365
366 const int fInsCountcxx . . $ portData#fInsCount.; // number of audio input ports
367 const int fOutsCountcxx . . $ portData#fOutsCount.; // number of audio output ports
368 int fCtrlCountcxx . . $ portData#fCtrlCount.; // number of control ports
369 int num_in_zonescxx . . $ portData#num_in_zones.;
370
371 float* fPortZonecxx . . $ portData#fPortZone.[MAXPORTcxx . . $ `myladspa.cpp:109:9`!]; //
372 float* fPortDatacxx . . $ portData#fPortData.[MAXPORTcxx . . $ `myladspa.cpp:109:9`!];
373
374 //--------------------------------------------------------------------------------------
375
376 void addZonecxx . . $ portData#addZone(e6881f009d13a851).(float* zone)
377 {
378 fPortZonecxx . . $ portData#fPortZone.[fInsCountcxx . . $ portData#fInsCount. + fOutsCountcxx . . $ portData#fOutsCount. + fCtrlCountcxx . . $ portData#fCtrlCount.] = zone;
379 fCtrlCountcxx . . $ portData#fCtrlCount.++;
380 num_in_zonescxx . . $ portData#num_in_zones.++;
381 }
382
383 float *getInputZonecxx . . $ portData#getInputZone(14bcf4d013640fef).(int num){
384 return fPortZonecxx . . $ portData#fPortZone.[fInsCountcxx . . $ portData#fInsCount. + fOutsCountcxx . . $ portData#fOutsCount. + num];
385 }
386
387 float *getOutputZonecxx . . $ portData#getOutputZone(14bcf4d013640fef).(int num){
388 return fPortZonecxx . . $ portData#fPortZone.[fInsCountcxx . . $ portData#fInsCount. + fOutsCountcxx . . $ portData#fOutsCount. + num_in_zonescxx . . $ portData#num_in_zones. + num];
389 }
390
391 //--------------------------------Collect the audio ports-------------------------------
392
393 portDatacxx . . $ portData#portData(3e454b8ccf442868).(int ins, int outs) : UIcxx . . $ UI#(), fInsCountcxx . . $ portData#fInsCount.(ins), fOutsCountcxx . . $ portData#fOutsCount.(outs), fCtrlCountcxx . . $ portData#fCtrlCount.(0), num_in_zonescxx . . $ portData#num_in_zones.(0) {};
394 virtual ~cxx . . $ portData#`~portData`(ced63f7c635d850d).portDatacxx . . $ portData#() {}
395
396 //------------------------------Collect the control zones-------------------------------
397
398 virtual void addButtoncxx . . $ portData#addButton(d2efea74a95ba4f0).(const char* label, float* zone) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); }
399 virtual void addToggleButtoncxx . . $ portData#addToggleButton(d2efea74a95ba4f0).(const char* label, float* zone) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); }
400 virtual void addCheckButtoncxx . . $ portData#addCheckButton(d2efea74a95ba4f0).(const char* label, float* zone) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); }
401
402 virtual void addVerticalSlidercxx . . $ portData#addVerticalSlider(dd97e545ed932d9f).(const char* label, float* zone, float init, float min, float max, float step) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); }
403 virtual void addHorizontalSlidercxx . . $ portData#addHorizontalSlider(dd97e545ed932d9f).(const char* label, float* zone, float init, float min, float max, float step) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); }
404 virtual void addNumEntrycxx . . $ portData#addNumEntry(dd97e545ed932d9f).(const char* label, float* zone, float init, float min, float max, float step) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); }
405
406 // -- passive widgets
407
408 virtual void addNumDisplaycxx . . $ portData#addNumDisplay(75b6969b25080c5b).(const char* label, float* zone, int precision) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); num_in_zonescxx . . $ portData#num_in_zones.--; }
409 virtual void addTextDisplaycxx . . $ portData#addTextDisplay(b0b4be5486cbde75).(const char* label, float* zone, const char* names[], float min, float max) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); num_in_zonescxx . . $ portData#num_in_zones.--;}
410 virtual void addHorizontalBargraphcxx . . $ portData#addHorizontalBargraph(9c4395346a0a905e).(const char* label, float* zone, float min, float max) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); num_in_zonescxx . . $ portData#num_in_zones.--;}
411 virtual void addVerticalBargraphcxx . . $ portData#addVerticalBargraph(9c4395346a0a905e).(const char* label, float* zone, float min, float max) { addZonecxx . . $ portData#addZone(e6881f009d13a851).(zone); num_in_zonescxx . . $ portData#num_in_zones.--;}
412
413 virtual void openFrameBoxcxx . . $ portData#openFrameBox(85c52e162fed56f9).(const char* label) { }
414 virtual void openTabBoxcxx . . $ portData#openTabBox(85c52e162fed56f9).(const char* label) { }
415 virtual void openHorizontalBoxcxx . . $ portData#openHorizontalBox(85c52e162fed56f9).(const char* label) { }
416 virtual void openVerticalBoxcxx . . $ portData#openVerticalBox(85c52e162fed56f9).(const char* label) { }
417 virtual void closeBoxcxx . . $ portData#closeBox(49f6e7a06ebc5aa8).() { }
418
419 virtual void showcxx . . $ portData#show(49f6e7a06ebc5aa8).() {}
420 virtual void runcxx . . $ portData#run(49f6e7a06ebc5aa8).() {}
421
422 //---------------------------------interaction with LADSPA------------------------------
423
424 void setPortDatacxx . . $ portData#setPortData(427e7d3de982672a). (unsigned long port, LADSPA_Data* data) {
425 fPortDatacxx . . $ portData#fPortData.[port] = data;
426 }
427
428 void updateCtrlZonescxx . . $ portData#updateCtrlZones(49f6e7a06ebc5aa8).() {
429 for (int i = fInsCountcxx . . $ portData#fInsCount.+fOutsCountcxx . . $ portData#fOutsCount.; i < fInsCountcxx . . $ portData#fInsCount.+fOutsCountcxx . . $ portData#fOutsCount.+fCtrlCountcxx . . $ portData#fCtrlCount.; i++)
430 *fPortZonecxx . . $ portData#fPortZone.[i] = *fPortDatacxx . . $ portData#fPortData.[i];
431 }
432
433 float** getInputscxx . . $ portData#getInputs(abb3be453774cf39).() {
434 return &fPortDatacxx . . $ portData#fPortData.[0];
435 }
436
437 float** getOutputscxx . . $ portData#getOutputs(abb3be453774cf39).() {
438 return &fPortDatacxx . . $ portData#fPortData.[fInsCountcxx . . $ portData#fInsCount.];
439 }
440 };
441
442 //--------------------------------Faust-LADSPA plugin-----------------------------------
443 //
444 // Plugin structure, callbacks and LADSPA_descriptor(i) entry point
445 //
446 //--------------------------------------------------------------------------------------
447
448 static mydspcxx . . $ `myladspa.cpp:85:9`! *create_shared_dspcxx . . $ create_shared_dsp(63315ce9707f81a4).();
449
450 LADSPA_Descriptor* gDescriptorcxx . . $ gDescriptor. = 0;
451
452 struct PLUGINcxx . . $ PLUGIN#
453 {
454 unsigned long fSampleRatecxx . . $ PLUGIN#fSampleRate.;
455 portDatacxx . . $ portData#* fPortDatacxx . . $ PLUGIN#fPortData.;
456 dspcxx . . $ dsp#* fDspcxx . . $ PLUGIN#fDsp.;
457
458 PLUGINcxx . . $ PLUGIN#PLUGIN(dea4f1969683202b).(unsigned long r, portDatacxx . . $ portData#* d, dspcxx . . $ dsp#* p) : fSampleRatecxx . . $ PLUGIN#fSampleRate.(r), fPortDatacxx . . $ PLUGIN#fPortData.(d), fDspcxx . . $ PLUGIN#fDsp.(p) {}
459 };
460
461 LADSPA_Handle instantiate_methodcxx . . $ instantiate_method(1e044dcc72cabfc1). (const struct _LADSPA_Descriptor * Descriptor, unsigned long SampleRate)
462 {
463 dspcxx . . $ dsp#* p = create_shared_dspcxx . . $ create_shared_dsp(63315ce9707f81a4).(); //new mydsp();
464 portDatacxx . . $ portData#* d = new portDatacxx . . $ portData#(p->getNumInputscxx . . $ dsp#getNumInputs(b126dc7c1de90089).(), p->getNumOutputscxx . . $ dsp#getNumOutputs(b126dc7c1de90089).());
465
466 p->buildUserInterfacecxx . . $ dsp#buildUserInterface(c644848e20fbf927).(d);
467 return new PLUGINcxx . . $ PLUGIN# (SampleRate, d, p);
468 }
469
470 void connect_methodcxx . . $ connect_method(be10225eaddd2b1). (LADSPA_Handle Instance, unsigned long Port, LADSPA_Data * DataLocation)
471 {
472 PLUGINcxx . . $ PLUGIN#* p = (PLUGINcxx . . $ PLUGIN#*) Instance;
473 p->fPortDatacxx . . $ PLUGIN#fPortData.->setPortDatacxx . . $ portData#setPortData(427e7d3de982672a).(Port, DataLocation);
474 }
475
476 void activate_methodcxx . . $ activate_method(5d22bdacc48458e8). (LADSPA_Handle Instance)
477 {
478 PLUGINcxx . . $ PLUGIN#* p = (PLUGINcxx . . $ PLUGIN#*) Instance;
479 p->fDspcxx . . $ PLUGIN#fDsp.->initcxx . . $ dsp#init(d4f767463ce0a6b3).(p->fSampleRatecxx . . $ PLUGIN#fSampleRate.);
480 }
481
482 void run_methodcxx . . $ run_method(5500c4293b1bbef0). (LADSPA_Handle Instance, unsigned long SampleCount)
483 {
484 PLUGINcxx . . $ PLUGIN#* p = (PLUGINcxx . . $ PLUGIN#*) Instance;
485 p->fPortDatacxx . . $ PLUGIN#fPortData.->updateCtrlZonescxx . . $ portData#updateCtrlZones(49f6e7a06ebc5aa8).();
486 AVOIDDENORMALScxx . . $ `myladspa.cpp:61:17`!;
487 p->fDspcxx . . $ PLUGIN#fDsp.->computecxx . . $ dsp#compute(4254ec6c518224ca).(SampleCount, p->fPortDatacxx . . $ PLUGIN#fPortData.->getInputscxx . . $ portData#getInputs(abb3be453774cf39).(), p->fPortDatacxx . . $ PLUGIN#fPortData.->getOutputscxx . . $ portData#getOutputs(abb3be453774cf39).());
488 }
489
490 void deactivate_methodcxx . . $ deactivate_method(5d22bdacc48458e8). (LADSPA_Handle Instance)
491 {}
492
493 void cleanup_methodcxx . . $ cleanup_method(5d22bdacc48458e8). (LADSPA_Handle Instance)
494 {
495 PLUGINcxx . . $ PLUGIN#* p = (PLUGINcxx . . $ PLUGIN#*) Instance;
496 delete p->fPortDatacxx . . $ PLUGIN#fPortData.;
497 delete p->fDspcxx . . $ PLUGIN#fDsp.;
498 delete p;
499 }
500
501 //--------------------------------------------------------------------------------------
502
503 void init_descriptorcxx . . $ init_descriptor(54a5ce3a0a7b46f1).(LADSPA_Descriptor* descriptor)
504 {
505 descriptor->UniqueID = 123456;
506 descriptor->Label = "none";
507 descriptor->Properties = LADSPA_PROPERTY_HARD_RT_CAPABLEcxx . . $ `<external>/14375785390476756063/ladspa.h:132:9`!;
508 descriptor->Name = "none";
509 descriptor->Maker = "Yann Orlarey";
510 descriptor->Copyright = "GPL";
511
512 descriptor->ImplementationData = 0;
513
514 // description des methods
515 descriptor->instantiate = instantiate_methodcxx . . $ instantiate_method(1e044dcc72cabfc1).;
516 descriptor->connect_port = connect_methodcxx . . $ connect_method(be10225eaddd2b1).;
517 descriptor->activate = activate_methodcxx . . $ activate_method(5d22bdacc48458e8).;
518 descriptor->run = run_methodcxx . . $ run_method(5500c4293b1bbef0).;
519 descriptor->run_adding = 0;
520 descriptor->set_run_adding_gain = 0;
521 descriptor->deactivate = deactivate_methodcxx . . $ deactivate_method(5d22bdacc48458e8).;
522 descriptor->cleanup = cleanup_methodcxx . . $ cleanup_method(5d22bdacc48458e8).;
523 }
524
525 //--------------------------------------------------------------------------------------
526
527
528 const LADSPA_Descriptor * ladspa_descriptorcxx . . $ ladspa_descriptor(5045766d2d5e96b1).(unsigned long Index)
529 {
530 if (Index == 0) {
531 if (gDescriptorcxx . . $ gDescriptor. == 0)
532 {
533 // allocate temporaries dsp and portCollector to build the plugin description
534 mydspcxx . . $ `myladspa.cpp:85:9`!* p = new mydspcxx . . $ `myladspa.cpp:85:9`!();
535 if (p) {
536 portCollectorcxx . . $ portCollector#* c=new portCollectorcxx . . $ portCollector#(p->getNumInputscxx . . $ Faust_system_compressor#getNumInputs(b126dc7c1de90089).(), p->getNumOutputscxx . . $ Faust_system_compressor#getNumOutputs(b126dc7c1de90089).());
537 p->buildUserInterfacecxx . . $ Faust_system_compressor#buildUserInterface(c644848e20fbf927).(c);
538 gDescriptorcxx . . $ gDescriptor. = new LADSPA_Descriptor;
539 init_descriptorcxx . . $ init_descriptor(54a5ce3a0a7b46f1).(gDescriptorcxx . . $ gDescriptor.);
540 c->fillPortDescriptioncxx . . $ portCollector#fillPortDescription(54a5ce3a0a7b46f1).(gDescriptorcxx . . $ gDescriptor.);
541 delete p;
542 } else {
543 printf("Memory Error : unable to allocate the dsp object\n");
544 }
545 }
546 return gDescriptorcxx . . $ gDescriptor.;
547 } else {
548 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
549 }
550 }
551
552 /********************END ARCHITECTURE SECTION (part 2/2)****************/
553
554 #if 0
555 extern void start_program(int argc, char **argv, void *compressor);
556 #endif
557
558 void *COMPRESSOR_create_ladspacxx . . $ COMPRESSOR_create_ladspa(42228c1987407501).(const char *key){
559 QSharedMemorycxx . . $ QSharedMemory# *shared = new QSharedMemorycxx . . $ QSharedMemory#(keycxx . . $ QString#QString(85c52e162fed56f9).);
560
561 if(shared->attachcxx . . $ QSharedMemory#attach(70c3218ce91e30ea).()==false){
562 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"Ladspa compressor: Couldn't attach... Error: %s\n",shared->errorcxx . . $ QSharedMemory#error(435af832cf77eb41).()==QSharedMemorycxx . . $ QSharedMemory#::NoErrorcxx . . $ QSharedMemory#NoError.?"No error (?)":shared->errorStringcxx . . $ QSharedMemory#errorString(6ef7b6c27b00b43d).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).());
563 exitcxx . . $ exit(44ed87f96534fad7).(0);
564 }
565
566 mydspcxx . . $ `myladspa.cpp:85:9`! *dsp = (mydspcxx . . $ `myladspa.cpp:85:9`!*)shared->datacxx . . $ QSharedMemory#data(50c7df7de5344ebb).();
567
568 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"dsp: %p.\n",dsp);
569 portDatacxx . . $ portData#* port_data = new portDatacxx . . $ portData#(dsp->mydspcxx . . $ `myladspa.cpp:85:9`!::getNumInputscxx . . $ Faust_system_compressor#getNumInputs(b126dc7c1de90089).(), dsp->mydspcxx . . $ `myladspa.cpp:85:9`!::getNumOutputscxx . . $ Faust_system_compressor#getNumOutputs(b126dc7c1de90089).());
570 dsp->mydspcxx . . $ `myladspa.cpp:85:9`!::buildUserInterfacecxx . . $ Faust_system_compressor#buildUserInterface(c644848e20fbf927).(port_data); // buildUserInterface is called twice on the dsp data. One time in each process.
571
572 return new PLUGINcxx . . $ PLUGIN#(0, port_data, dsp);
573 }
574
575 static mydspcxx . . $ `myladspa.cpp:85:9`! *create_shared_dspcxx . . $ create_shared_dsp(63315ce9707f81a4).(){
576 QStringcxx . . $ QString# key = "radium_crashreporter_" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(391c8d1a7da534d1).(QDateTimecxx . . $ QDateTime#::currentMSecsSinceEpochcxx . . $ QDateTime#currentMSecsSinceEpoch(9969456818c7299).());
577 QSharedMemorycxx . . $ QSharedMemory# *shared = new QSharedMemorycxx . . $ QSharedMemory#(key);
578
579 if(shared->createcxx . . $ QSharedMemory#create(81b6ab3714a70c32).(sizeof(mydspcxx . . $ `myladspa.cpp:85:9`!))==false){
580 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"COMPRESSOR_create_shared: Couldn't create... Error: %s\n",shared->errorcxx . . $ QSharedMemory#error(435af832cf77eb41).()==QSharedMemorycxx . . $ QSharedMemory#::NoErrorcxx . . $ QSharedMemory#NoError.?"No error (?)":shared->errorStringcxx . . $ QSharedMemory#errorString(6ef7b6c27b00b43d).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).());
581 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
582 }
583
584 void *memory = shared->datacxx . . $ QSharedMemory#data(50c7df7de5344ebb).();
585
586 mydspcxx . . $ `myladspa.cpp:85:9`! *dsp = new(memory) mydspcxx . . $ `myladspa.cpp:85:9`!();
587
588 #if 0
589 printf("memory: %p, shared: %p\n",memory,shared);
590 dsp->key = key;
591 dsp->shared = shared;
592 #endif
593
594 //printf("system: %d\n",system(QString(QString("xterm -e gdb /home/kjetil/radium_compressor/radium_compressor --args --ladspa-slave ")+key).toAscii()));
595 printf("system: %d\n",systemcxx . . $ system(5c4306d8553b3696).(QStringcxx . . $ QString#(QStringcxx . . $ QString#QString(85c52e162fed56f9).("xterm -e gdb --args /home/kjetil/radium_compressor/radium_compressor --ladspa-slave ")+cxx . . $ operator+(fab9b4f80031f353).key+cxx . . $ operator+(3d22f08efddf8107)." &").toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()));
596
597
598 return dsp;
599
600 #if 0
601 if(fork()!=0){
602
603 return dsp;
604
605 }else{
606
607 QSharedMemory *shared = new QSharedMemory(key);
608
609 if(shared->attach()==false){
610 fprintf(stderr,"Ladspa compressor: Couldn't attach... Error: %s\n",shared->error()==QSharedMemory::NoError?"No error (?)":shared->errorString().toAscii().data());
611 exit(0);
612 }
613
614 char *argv[1]={(char*)"radium_compressor"};
615
616 mydsp *dsp = (mydsp*)shared->data();
617 fprintf(stderr,"dsp: %p.\n",dsp);
618 portData* port_data = new portData(dsp->getNumInputs(), dsp->getNumOutputs());
619 dsp->buildUserInterface(port_data); // This is the second time buildUserInterface is called twice on the dsp data. One time in each process.
620
621 start_program(1,argv,new PLUGIN(0, port_data, dsp));
622
623 exit(0);
624 return NULL;
625 }
626 #endif
627 }
628
629
630 float COMPRESSOR_get_ladspa_parametercxx . . $ COMPRESSOR_get_ladspa_parameter(d3d647948fff6b1c).(void *Instance,int num){
631 PLUGINcxx . . $ PLUGIN#* p = (PLUGINcxx . . $ PLUGIN#*) Instance;
632 portDatacxx . . $ portData# *port_data = p->fPortDatacxx . . $ PLUGIN#fPortData.;
633
634 float *controller = port_data->getInputZonecxx . . $ portData#getInputZone(14bcf4d013640fef).(num);
635 return *controller;
636 }
637
638 void COMPRESSOR_set_ladspa_parametercxx . . $ COMPRESSOR_set_ladspa_parameter(37455279038ff541).(void *Instance,int num,float value){
639 PLUGINcxx . . $ PLUGIN#* p = (PLUGINcxx . . $ PLUGIN#*) Instance;
640 portDatacxx . . $ portData# *port_data = p->fPortDatacxx . . $ PLUGIN#fPortData.;
641
642 float *controller = port_data->getInputZonecxx . . $ portData#getInputZone(14bcf4d013640fef).(num);
643 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"port_data: %p, controller: %p, num_zones: %d, num: %d\n",port_data,controller,port_data->fCtrlCountcxx . . $ portData#fCtrlCount.,num);
644 *controller = value;
645 //printf("Setting controller %d (%p) to %f (%f)\n",num,controller,value,*controller);
646 }
647
648 float COMPRESSOR_get_ladspa_graph_valuecxx . . $ COMPRESSOR_get_ladspa_graph_value(d3d647948fff6b1c).(void *Instance, int num){
649 PLUGINcxx . . $ PLUGIN#* p = (PLUGINcxx . . $ PLUGIN#*) Instance;
650 portDatacxx . . $ portData# *port_data = p->fPortDatacxx . . $ PLUGIN#fPortData.;
651
652 float *controller = port_data->getOutputZonecxx . . $ portData#getOutputZone(14bcf4d013640fef).(num);
653 return *controller;
654 }
655
656 void COMPRESSOR_delete_ladspacxx . . $ COMPRESSOR_delete_ladspa(5d22bdacc48458e8).(void *Instance){
657 //PLUGIN* p = (PLUGIN*) Instance;
658 // fix.
659 }
660