1 #include <stdlib.h>
2 #include <string.h>
3 #ifndef WIN32
4 #include "config.h"
5 #endif
6
7 #ifdef ENABLE_NLS
8 #include <libintl.h>
9 #endif
10
11 #define _ISOC9X_SOURCE 1
12 #define _ISOC99_SOURCE 1
13 #define __USE_ISOC99 1
14 #define __USE_ISOC9X 1
15
16 #include <math.h>
17
18 #include "ladspa.h"
19
20 #ifdef WIN32
21 #define _WINDOWS_DLL_EXPORT_ __declspec(dllexport)
22 int bIsFirstTime = 1;
23 static void __attribute__((constructor)) swh_init(); // forward declaration
24 #else
25 #define _WINDOWS_DLL_EXPORT_
26 #endif
27
28 #line 10 "dj_eq_1901.xml"
29
30 #include "ladspa-util.h"
31 #include "util/biquad.h"
32
33 #define BANDS 3
34
35 #define PEAK_BW 0.3f /* Peak EQ bandwidth (octaves) */
36 #define SHELF_SLOPE 1.5f /* Shelf EQ slope (arb. units) */
37
38 #define DJ_EQ_MONO_LO 0
39 #define DJ_EQ_MONO_MID 1
40 #define DJ_EQ_MONO_HI 2
41 #define DJ_EQ_MONO_INPUT 3
42 #define DJ_EQ_MONO_OUTPUT 4
43 #define DJ_EQ_MONO_LATENCY 5
44 #define DJ_EQ_LO 0
45 #define DJ_EQ_MID 1
46 #define DJ_EQ_HI 2
47 #define DJ_EQ_LEFT_INPUT 3
48 #define DJ_EQ_RIGHT_INPUT 4
49 #define DJ_EQ_LEFT_OUTPUT 5
50 #define DJ_EQ_RIGHT_OUTPUT 6
51 #define DJ_EQ_LATENCY 7
52
53 static LADSPA_Descriptor *dj_eq_monoDescriptor = NULL;
54
55 typedef struct {
56 LADSPA_Data *lo;
57 LADSPA_Data *mid;
58 LADSPA_Data *hi;
59 LADSPA_Data *input;
60 LADSPA_Data *output;
61 LADSPA_Data *latency;
62 biquad * filters;
63 float fs;
64 LADSPA_Data run_adding_gain;
65 } Dj_eq_mono;
66
67 static LADSPA_Descriptor *dj_eqDescriptor = NULL;
68
69 typedef struct {
70 LADSPA_Data *lo;
71 LADSPA_Data *mid;
72 LADSPA_Data *hi;
73 LADSPA_Data *left_input;
74 LADSPA_Data *right_input;
75 LADSPA_Data *left_output;
76 LADSPA_Data *right_output;
77 LADSPA_Data *latency;
78 biquad * filters;
79 float fs;
80 LADSPA_Data run_adding_gain;
81 } Dj_eq;
82
83 _WINDOWS_DLL_EXPORT_
ladspa_descriptor(unsigned long index)84 const LADSPA_Descriptor *ladspa_descriptor(unsigned long index) {
85
86 #ifdef WIN32
87 if (bIsFirstTime) {
88 swh_init();
89 bIsFirstTime = 0;
90 }
91 #endif
92 switch (index) {
93 case 0:
94 return dj_eq_monoDescriptor;
95 case 1:
96 return dj_eqDescriptor;
97 default:
98 return NULL;
99 }
100 }
101
activateDj_eq_mono(LADSPA_Handle instance)102 static void activateDj_eq_mono(LADSPA_Handle instance) {
103 Dj_eq_mono *plugin_data = (Dj_eq_mono *)instance;
104 biquad *filters = plugin_data->filters;
105 float fs = plugin_data->fs;
106 #line 33 "dj_eq_1901.xml"
107 biquad_init(&filters[0]);
108 eq_set_params(&filters[0], 100.0f, 0.0f, PEAK_BW, fs);
109 biquad_init(&filters[1]);
110 eq_set_params(&filters[1], 1000.0f, 0.0f, PEAK_BW, fs);
111 biquad_init(&filters[2]);
112 hs_set_params(&filters[2], 10000.0f, 0.0f, SHELF_SLOPE, fs);
113 plugin_data->filters = filters;
114 plugin_data->fs = fs;
115
116 }
117
cleanupDj_eq_mono(LADSPA_Handle instance)118 static void cleanupDj_eq_mono(LADSPA_Handle instance) {
119 #line 60 "dj_eq_1901.xml"
120 Dj_eq_mono *plugin_data = (Dj_eq_mono *)instance;
121 free(plugin_data->filters);
122 free(instance);
123 }
124
connectPortDj_eq_mono(LADSPA_Handle instance,unsigned long port,LADSPA_Data * data)125 static void connectPortDj_eq_mono(
126 LADSPA_Handle instance,
127 unsigned long port,
128 LADSPA_Data *data) {
129 Dj_eq_mono *plugin;
130
131 plugin = (Dj_eq_mono *)instance;
132 switch (port) {
133 case DJ_EQ_MONO_LO:
134 plugin->lo = data;
135 break;
136 case DJ_EQ_MONO_MID:
137 plugin->mid = data;
138 break;
139 case DJ_EQ_MONO_HI:
140 plugin->hi = data;
141 break;
142 case DJ_EQ_MONO_INPUT:
143 plugin->input = data;
144 break;
145 case DJ_EQ_MONO_OUTPUT:
146 plugin->output = data;
147 break;
148 case DJ_EQ_MONO_LATENCY:
149 plugin->latency = data;
150 break;
151 }
152 }
153
instantiateDj_eq_mono(const LADSPA_Descriptor * descriptor,unsigned long s_rate)154 static LADSPA_Handle instantiateDj_eq_mono(
155 const LADSPA_Descriptor *descriptor,
156 unsigned long s_rate) {
157 Dj_eq_mono *plugin_data = (Dj_eq_mono *)calloc(1, sizeof(Dj_eq_mono));
158 biquad *filters = NULL;
159 float fs;
160
161 #line 27 "dj_eq_1901.xml"
162 fs = s_rate;
163
164 filters = calloc(BANDS, sizeof(biquad));
165
166 plugin_data->filters = filters;
167 plugin_data->fs = fs;
168
169 return (LADSPA_Handle)plugin_data;
170 }
171
172 #undef buffer_write
173 #undef RUN_ADDING
174 #undef RUN_REPLACING
175
176 #define buffer_write(b, v) (b = v)
177 #define RUN_ADDING 0
178 #define RUN_REPLACING 1
179
runDj_eq_mono(LADSPA_Handle instance,unsigned long sample_count)180 static void runDj_eq_mono(LADSPA_Handle instance, unsigned long sample_count) {
181 Dj_eq_mono *plugin_data = (Dj_eq_mono *)instance;
182
183 /* Lo gain (dB) (float value) */
184 const LADSPA_Data lo = *(plugin_data->lo);
185
186 /* Mid gain (dB) (float value) */
187 const LADSPA_Data mid = *(plugin_data->mid);
188
189 /* Hi gain (dB) (float value) */
190 const LADSPA_Data hi = *(plugin_data->hi);
191
192 /* Input (array of floats of length sample_count) */
193 const LADSPA_Data * const input = plugin_data->input;
194
195 /* Output (array of floats of length sample_count) */
196 LADSPA_Data * const output = plugin_data->output;
197 biquad * filters = plugin_data->filters;
198 float fs = plugin_data->fs;
199
200 #line 42 "dj_eq_1901.xml"
201 unsigned long pos;
202 float samp;
203
204 eq_set_params(&filters[0], 100.0f, lo, PEAK_BW, fs);
205 eq_set_params(&filters[1], 1000.0f, mid, PEAK_BW, fs);
206 hs_set_params(&filters[2], 10000.0f, hi, SHELF_SLOPE, fs);
207
208 for (pos = 0; pos < sample_count; pos++) {
209 samp = biquad_run(&filters[0], input[pos]);
210 samp = biquad_run(&filters[1], samp);
211 samp = biquad_run(&filters[2], samp);
212 buffer_write(output[pos], samp);
213 }
214
215 *(plugin_data->latency) = 3; //XXX is this right?
216 }
217 #undef buffer_write
218 #undef RUN_ADDING
219 #undef RUN_REPLACING
220
221 #define buffer_write(b, v) (b += (v) * run_adding_gain)
222 #define RUN_ADDING 1
223 #define RUN_REPLACING 0
224
setRunAddingGainDj_eq_mono(LADSPA_Handle instance,LADSPA_Data gain)225 static void setRunAddingGainDj_eq_mono(LADSPA_Handle instance, LADSPA_Data gain) {
226 ((Dj_eq_mono *)instance)->run_adding_gain = gain;
227 }
228
runAddingDj_eq_mono(LADSPA_Handle instance,unsigned long sample_count)229 static void runAddingDj_eq_mono(LADSPA_Handle instance, unsigned long sample_count) {
230 Dj_eq_mono *plugin_data = (Dj_eq_mono *)instance;
231 LADSPA_Data run_adding_gain = plugin_data->run_adding_gain;
232
233 /* Lo gain (dB) (float value) */
234 const LADSPA_Data lo = *(plugin_data->lo);
235
236 /* Mid gain (dB) (float value) */
237 const LADSPA_Data mid = *(plugin_data->mid);
238
239 /* Hi gain (dB) (float value) */
240 const LADSPA_Data hi = *(plugin_data->hi);
241
242 /* Input (array of floats of length sample_count) */
243 const LADSPA_Data * const input = plugin_data->input;
244
245 /* Output (array of floats of length sample_count) */
246 LADSPA_Data * const output = plugin_data->output;
247 biquad * filters = plugin_data->filters;
248 float fs = plugin_data->fs;
249
250 #line 42 "dj_eq_1901.xml"
251 unsigned long pos;
252 float samp;
253
254 eq_set_params(&filters[0], 100.0f, lo, PEAK_BW, fs);
255 eq_set_params(&filters[1], 1000.0f, mid, PEAK_BW, fs);
256 hs_set_params(&filters[2], 10000.0f, hi, SHELF_SLOPE, fs);
257
258 for (pos = 0; pos < sample_count; pos++) {
259 samp = biquad_run(&filters[0], input[pos]);
260 samp = biquad_run(&filters[1], samp);
261 samp = biquad_run(&filters[2], samp);
262 buffer_write(output[pos], samp);
263 }
264
265 *(plugin_data->latency) = 3; //XXX is this right?
266 }
267
activateDj_eq(LADSPA_Handle instance)268 static void activateDj_eq(LADSPA_Handle instance) {
269 Dj_eq *plugin_data = (Dj_eq *)instance;
270 biquad *filters = plugin_data->filters;
271 float fs = plugin_data->fs;
272 #line 33 "dj_eq_1901.xml"
273 int i;
274
275 for (i=0; i<2; i++) {
276 biquad_init(&filters[i*BANDS + 0]);
277 eq_set_params(&filters[i*BANDS + 0], 100.0f, 0.0f, PEAK_BW, fs);
278 biquad_init(&filters[i*BANDS + 1]);
279 eq_set_params(&filters[i*BANDS + 1], 1000.0f, 0.0f, PEAK_BW, fs);
280 biquad_init(&filters[i*BANDS + 2]);
281 hs_set_params(&filters[i*BANDS + 2], 10000.0f, 0.0f, SHELF_SLOPE, fs);
282 }
283 plugin_data->filters = filters;
284 plugin_data->fs = fs;
285
286 }
287
cleanupDj_eq(LADSPA_Handle instance)288 static void cleanupDj_eq(LADSPA_Handle instance) {
289 #line 60 "dj_eq_1901.xml"
290 Dj_eq *plugin_data = (Dj_eq *)instance;
291 free(plugin_data->filters);
292 free(instance);
293 }
294
connectPortDj_eq(LADSPA_Handle instance,unsigned long port,LADSPA_Data * data)295 static void connectPortDj_eq(
296 LADSPA_Handle instance,
297 unsigned long port,
298 LADSPA_Data *data) {
299 Dj_eq *plugin;
300
301 plugin = (Dj_eq *)instance;
302 switch (port) {
303 case DJ_EQ_LO:
304 plugin->lo = data;
305 break;
306 case DJ_EQ_MID:
307 plugin->mid = data;
308 break;
309 case DJ_EQ_HI:
310 plugin->hi = data;
311 break;
312 case DJ_EQ_LEFT_INPUT:
313 plugin->left_input = data;
314 break;
315 case DJ_EQ_RIGHT_INPUT:
316 plugin->right_input = data;
317 break;
318 case DJ_EQ_LEFT_OUTPUT:
319 plugin->left_output = data;
320 break;
321 case DJ_EQ_RIGHT_OUTPUT:
322 plugin->right_output = data;
323 break;
324 case DJ_EQ_LATENCY:
325 plugin->latency = data;
326 break;
327 }
328 }
329
instantiateDj_eq(const LADSPA_Descriptor * descriptor,unsigned long s_rate)330 static LADSPA_Handle instantiateDj_eq(
331 const LADSPA_Descriptor *descriptor,
332 unsigned long s_rate) {
333 Dj_eq *plugin_data = (Dj_eq *)calloc(1, sizeof(Dj_eq));
334 biquad *filters = NULL;
335 float fs;
336
337 #line 27 "dj_eq_1901.xml"
338 fs = s_rate;
339
340 filters = calloc(BANDS * 2, sizeof(biquad));
341
342 plugin_data->filters = filters;
343 plugin_data->fs = fs;
344
345 return (LADSPA_Handle)plugin_data;
346 }
347
348 #undef buffer_write
349 #undef RUN_ADDING
350 #undef RUN_REPLACING
351
352 #define buffer_write(b, v) (b = v)
353 #define RUN_ADDING 0
354 #define RUN_REPLACING 1
355
runDj_eq(LADSPA_Handle instance,unsigned long sample_count)356 static void runDj_eq(LADSPA_Handle instance, unsigned long sample_count) {
357 Dj_eq *plugin_data = (Dj_eq *)instance;
358
359 /* Lo gain (dB) (float value) */
360 const LADSPA_Data lo = *(plugin_data->lo);
361
362 /* Mid gain (dB) (float value) */
363 const LADSPA_Data mid = *(plugin_data->mid);
364
365 /* Hi gain (dB) (float value) */
366 const LADSPA_Data hi = *(plugin_data->hi);
367
368 /* Input L (array of floats of length sample_count) */
369 const LADSPA_Data * const left_input = plugin_data->left_input;
370
371 /* Input R (array of floats of length sample_count) */
372 const LADSPA_Data * const right_input = plugin_data->right_input;
373
374 /* Output L (array of floats of length sample_count) */
375 LADSPA_Data * const left_output = plugin_data->left_output;
376
377 /* Output R (array of floats of length sample_count) */
378 LADSPA_Data * const right_output = plugin_data->right_output;
379 biquad * filters = plugin_data->filters;
380 float fs = plugin_data->fs;
381
382 #line 42 "dj_eq_1901.xml"
383 unsigned long pos;
384 unsigned int i;
385 float samp;
386
387 for (i=0; i<2; i++) {
388 eq_set_params(&filters[i*BANDS + 0], 100.0f, lo, PEAK_BW, fs);
389 eq_set_params(&filters[i*BANDS + 1], 1000.0f, mid, PEAK_BW, fs);
390 hs_set_params(&filters[i*BANDS + 2], 10000.0f, hi, SHELF_SLOPE, fs);
391 }
392
393 for (pos = 0; pos < sample_count; pos++) {
394 samp = biquad_run(&filters[0], left_input[pos]);
395 samp = biquad_run(&filters[1], samp);
396 samp = biquad_run(&filters[2], samp);
397 buffer_write(left_output[pos], samp);
398
399 samp = biquad_run(&filters[3], right_input[pos]);
400 samp = biquad_run(&filters[4], samp);
401 samp = biquad_run(&filters[5], samp);
402 buffer_write(right_output[pos], samp);
403 }
404
405 *(plugin_data->latency) = 3; //XXX is this right?
406 }
407 #undef buffer_write
408 #undef RUN_ADDING
409 #undef RUN_REPLACING
410
411 #define buffer_write(b, v) (b += (v) * run_adding_gain)
412 #define RUN_ADDING 1
413 #define RUN_REPLACING 0
414
setRunAddingGainDj_eq(LADSPA_Handle instance,LADSPA_Data gain)415 static void setRunAddingGainDj_eq(LADSPA_Handle instance, LADSPA_Data gain) {
416 ((Dj_eq *)instance)->run_adding_gain = gain;
417 }
418
runAddingDj_eq(LADSPA_Handle instance,unsigned long sample_count)419 static void runAddingDj_eq(LADSPA_Handle instance, unsigned long sample_count) {
420 Dj_eq *plugin_data = (Dj_eq *)instance;
421 LADSPA_Data run_adding_gain = plugin_data->run_adding_gain;
422
423 /* Lo gain (dB) (float value) */
424 const LADSPA_Data lo = *(plugin_data->lo);
425
426 /* Mid gain (dB) (float value) */
427 const LADSPA_Data mid = *(plugin_data->mid);
428
429 /* Hi gain (dB) (float value) */
430 const LADSPA_Data hi = *(plugin_data->hi);
431
432 /* Input L (array of floats of length sample_count) */
433 const LADSPA_Data * const left_input = plugin_data->left_input;
434
435 /* Input R (array of floats of length sample_count) */
436 const LADSPA_Data * const right_input = plugin_data->right_input;
437
438 /* Output L (array of floats of length sample_count) */
439 LADSPA_Data * const left_output = plugin_data->left_output;
440
441 /* Output R (array of floats of length sample_count) */
442 LADSPA_Data * const right_output = plugin_data->right_output;
443 biquad * filters = plugin_data->filters;
444 float fs = plugin_data->fs;
445
446 #line 42 "dj_eq_1901.xml"
447 unsigned long pos;
448 unsigned int i;
449 float samp;
450
451 for (i=0; i<2; i++) {
452 eq_set_params(&filters[i*BANDS + 0], 100.0f, lo, PEAK_BW, fs);
453 eq_set_params(&filters[i*BANDS + 1], 1000.0f, mid, PEAK_BW, fs);
454 hs_set_params(&filters[i*BANDS + 2], 10000.0f, hi, SHELF_SLOPE, fs);
455 }
456
457 for (pos = 0; pos < sample_count; pos++) {
458 samp = biquad_run(&filters[0], left_input[pos]);
459 samp = biquad_run(&filters[1], samp);
460 samp = biquad_run(&filters[2], samp);
461 buffer_write(left_output[pos], samp);
462
463 samp = biquad_run(&filters[3], right_input[pos]);
464 samp = biquad_run(&filters[4], samp);
465 samp = biquad_run(&filters[5], samp);
466 buffer_write(right_output[pos], samp);
467 }
468
469 *(plugin_data->latency) = 3; //XXX is this right?
470 }
471
swh_init()472 static void __attribute__((constructor)) swh_init() {
473 char **port_names;
474 LADSPA_PortDescriptor *port_descriptors;
475 LADSPA_PortRangeHint *port_range_hints;
476
477 #ifdef ENABLE_NLS
478 #define D_(s) dgettext(PACKAGE, s)
479 bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR);
480 #else
481 #define D_(s) (s)
482 #endif
483
484
485 dj_eq_monoDescriptor =
486 (LADSPA_Descriptor *)malloc(sizeof(LADSPA_Descriptor));
487
488 if (dj_eq_monoDescriptor) {
489 dj_eq_monoDescriptor->UniqueID = 1907;
490 dj_eq_monoDescriptor->Label = "dj_eq_mono";
491 dj_eq_monoDescriptor->Properties =
492 LADSPA_PROPERTY_HARD_RT_CAPABLE;
493 dj_eq_monoDescriptor->Name =
494 D_("DJ EQ (mono)");
495 dj_eq_monoDescriptor->Maker =
496 "Steve Harris <steve@plugin.org.uk>";
497 dj_eq_monoDescriptor->Copyright =
498 "GPL";
499 dj_eq_monoDescriptor->PortCount = 6;
500
501 port_descriptors = (LADSPA_PortDescriptor *)calloc(6,
502 sizeof(LADSPA_PortDescriptor));
503 dj_eq_monoDescriptor->PortDescriptors =
504 (const LADSPA_PortDescriptor *)port_descriptors;
505
506 port_range_hints = (LADSPA_PortRangeHint *)calloc(6,
507 sizeof(LADSPA_PortRangeHint));
508 dj_eq_monoDescriptor->PortRangeHints =
509 (const LADSPA_PortRangeHint *)port_range_hints;
510
511 port_names = (char **)calloc(6, sizeof(char*));
512 dj_eq_monoDescriptor->PortNames =
513 (const char **)port_names;
514
515 /* Parameters for Lo gain (dB) */
516 port_descriptors[DJ_EQ_MONO_LO] =
517 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL;
518 port_names[DJ_EQ_MONO_LO] =
519 D_("Lo gain (dB)");
520 port_range_hints[DJ_EQ_MONO_LO].HintDescriptor =
521 LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0;
522 port_range_hints[DJ_EQ_MONO_LO].LowerBound = -70;
523 port_range_hints[DJ_EQ_MONO_LO].UpperBound = +6;
524
525 /* Parameters for Mid gain (dB) */
526 port_descriptors[DJ_EQ_MONO_MID] =
527 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL;
528 port_names[DJ_EQ_MONO_MID] =
529 D_("Mid gain (dB)");
530 port_range_hints[DJ_EQ_MONO_MID].HintDescriptor =
531 LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0;
532 port_range_hints[DJ_EQ_MONO_MID].LowerBound = -70;
533 port_range_hints[DJ_EQ_MONO_MID].UpperBound = +6;
534
535 /* Parameters for Hi gain (dB) */
536 port_descriptors[DJ_EQ_MONO_HI] =
537 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL;
538 port_names[DJ_EQ_MONO_HI] =
539 D_("Hi gain (dB)");
540 port_range_hints[DJ_EQ_MONO_HI].HintDescriptor =
541 LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0;
542 port_range_hints[DJ_EQ_MONO_HI].LowerBound = -70;
543 port_range_hints[DJ_EQ_MONO_HI].UpperBound = +6;
544
545 /* Parameters for Input */
546 port_descriptors[DJ_EQ_MONO_INPUT] =
547 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
548 port_names[DJ_EQ_MONO_INPUT] =
549 D_("Input");
550 port_range_hints[DJ_EQ_MONO_INPUT].HintDescriptor = 0;
551
552 /* Parameters for Output */
553 port_descriptors[DJ_EQ_MONO_OUTPUT] =
554 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
555 port_names[DJ_EQ_MONO_OUTPUT] =
556 D_("Output");
557 port_range_hints[DJ_EQ_MONO_OUTPUT].HintDescriptor = 0;
558
559 /* Parameters for latency */
560 port_descriptors[DJ_EQ_MONO_LATENCY] =
561 LADSPA_PORT_OUTPUT | LADSPA_PORT_CONTROL;
562 port_names[DJ_EQ_MONO_LATENCY] =
563 D_("latency");
564 port_range_hints[DJ_EQ_MONO_LATENCY].HintDescriptor = 0;
565
566 dj_eq_monoDescriptor->activate = activateDj_eq_mono;
567 dj_eq_monoDescriptor->cleanup = cleanupDj_eq_mono;
568 dj_eq_monoDescriptor->connect_port = connectPortDj_eq_mono;
569 dj_eq_monoDescriptor->deactivate = NULL;
570 dj_eq_monoDescriptor->instantiate = instantiateDj_eq_mono;
571 dj_eq_monoDescriptor->run = runDj_eq_mono;
572 dj_eq_monoDescriptor->run_adding = runAddingDj_eq_mono;
573 dj_eq_monoDescriptor->set_run_adding_gain = setRunAddingGainDj_eq_mono;
574 }
575
576 dj_eqDescriptor =
577 (LADSPA_Descriptor *)malloc(sizeof(LADSPA_Descriptor));
578
579 if (dj_eqDescriptor) {
580 dj_eqDescriptor->UniqueID = 1901;
581 dj_eqDescriptor->Label = "dj_eq";
582 dj_eqDescriptor->Properties =
583 LADSPA_PROPERTY_HARD_RT_CAPABLE;
584 dj_eqDescriptor->Name =
585 D_("DJ EQ");
586 dj_eqDescriptor->Maker =
587 "Steve Harris <steve@plugin.org.uk>";
588 dj_eqDescriptor->Copyright =
589 "GPL";
590 dj_eqDescriptor->PortCount = 8;
591
592 port_descriptors = (LADSPA_PortDescriptor *)calloc(8,
593 sizeof(LADSPA_PortDescriptor));
594 dj_eqDescriptor->PortDescriptors =
595 (const LADSPA_PortDescriptor *)port_descriptors;
596
597 port_range_hints = (LADSPA_PortRangeHint *)calloc(8,
598 sizeof(LADSPA_PortRangeHint));
599 dj_eqDescriptor->PortRangeHints =
600 (const LADSPA_PortRangeHint *)port_range_hints;
601
602 port_names = (char **)calloc(8, sizeof(char*));
603 dj_eqDescriptor->PortNames =
604 (const char **)port_names;
605
606 /* Parameters for Lo gain (dB) */
607 port_descriptors[DJ_EQ_LO] =
608 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL;
609 port_names[DJ_EQ_LO] =
610 D_("Lo gain (dB)");
611 port_range_hints[DJ_EQ_LO].HintDescriptor =
612 LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0;
613 port_range_hints[DJ_EQ_LO].LowerBound = -70;
614 port_range_hints[DJ_EQ_LO].UpperBound = +6;
615
616 /* Parameters for Mid gain (dB) */
617 port_descriptors[DJ_EQ_MID] =
618 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL;
619 port_names[DJ_EQ_MID] =
620 D_("Mid gain (dB)");
621 port_range_hints[DJ_EQ_MID].HintDescriptor =
622 LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0;
623 port_range_hints[DJ_EQ_MID].LowerBound = -70;
624 port_range_hints[DJ_EQ_MID].UpperBound = +6;
625
626 /* Parameters for Hi gain (dB) */
627 port_descriptors[DJ_EQ_HI] =
628 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL;
629 port_names[DJ_EQ_HI] =
630 D_("Hi gain (dB)");
631 port_range_hints[DJ_EQ_HI].HintDescriptor =
632 LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0;
633 port_range_hints[DJ_EQ_HI].LowerBound = -70;
634 port_range_hints[DJ_EQ_HI].UpperBound = +6;
635
636 /* Parameters for Input L */
637 port_descriptors[DJ_EQ_LEFT_INPUT] =
638 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
639 port_names[DJ_EQ_LEFT_INPUT] =
640 D_("Input L");
641 port_range_hints[DJ_EQ_LEFT_INPUT].HintDescriptor = 0;
642
643 /* Parameters for Input R */
644 port_descriptors[DJ_EQ_RIGHT_INPUT] =
645 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
646 port_names[DJ_EQ_RIGHT_INPUT] =
647 D_("Input R");
648 port_range_hints[DJ_EQ_RIGHT_INPUT].HintDescriptor = 0;
649
650 /* Parameters for Output L */
651 port_descriptors[DJ_EQ_LEFT_OUTPUT] =
652 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
653 port_names[DJ_EQ_LEFT_OUTPUT] =
654 D_("Output L");
655 port_range_hints[DJ_EQ_LEFT_OUTPUT].HintDescriptor = 0;
656
657 /* Parameters for Output R */
658 port_descriptors[DJ_EQ_RIGHT_OUTPUT] =
659 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
660 port_names[DJ_EQ_RIGHT_OUTPUT] =
661 D_("Output R");
662 port_range_hints[DJ_EQ_RIGHT_OUTPUT].HintDescriptor = 0;
663
664 /* Parameters for latency */
665 port_descriptors[DJ_EQ_LATENCY] =
666 LADSPA_PORT_OUTPUT | LADSPA_PORT_CONTROL;
667 port_names[DJ_EQ_LATENCY] =
668 D_("latency");
669 port_range_hints[DJ_EQ_LATENCY].HintDescriptor = 0;
670
671 dj_eqDescriptor->activate = activateDj_eq;
672 dj_eqDescriptor->cleanup = cleanupDj_eq;
673 dj_eqDescriptor->connect_port = connectPortDj_eq;
674 dj_eqDescriptor->deactivate = NULL;
675 dj_eqDescriptor->instantiate = instantiateDj_eq;
676 dj_eqDescriptor->run = runDj_eq;
677 dj_eqDescriptor->run_adding = runAddingDj_eq;
678 dj_eqDescriptor->set_run_adding_gain = setRunAddingGainDj_eq;
679 }
680 }
681
swh_fini()682 static void __attribute__((destructor)) swh_fini() {
683 if (dj_eq_monoDescriptor) {
684 free((LADSPA_PortDescriptor *)dj_eq_monoDescriptor->PortDescriptors);
685 free((char **)dj_eq_monoDescriptor->PortNames);
686 free((LADSPA_PortRangeHint *)dj_eq_monoDescriptor->PortRangeHints);
687 free(dj_eq_monoDescriptor);
688 }
689 dj_eq_monoDescriptor = NULL;
690 if (dj_eqDescriptor) {
691 free((LADSPA_PortDescriptor *)dj_eqDescriptor->PortDescriptors);
692 free((char **)dj_eqDescriptor->PortNames);
693 free((LADSPA_PortRangeHint *)dj_eqDescriptor->PortRangeHints);
694 free(dj_eqDescriptor);
695 }
696 dj_eqDescriptor = NULL;
697
698 }
699