~ubuntu-branches/ubuntu/trusty/lmms/trusty

« back to all changes in this revision

Viewing changes to plugins/ladspa_effect/swh/xfade_1915.c

  • Committer: Charlie Smotherman
  • Date: 2012-12-05 22:08:38 UTC
  • mfrom: (33.1.7 lmms_0.4.13)
  • Revision ID: cjsmo@cableone.net-20121205220838-09pjfzew9m5023hr
* New  Upstream release.
  - Minor tweaking to ZynAddSubFX, CALF, SWH plugins  and Stefan Fendt's RC
    filters.
  - Added UI fixes: Magnentic effect of knobs and Piano-roll fixes
  - Updated German localization and copyright year
* debian/lmms-common.install:
  - added /usr/share/applications so the lmms.desktop file will correctly
    install (LP: #863366)
  - This should also fix the Software Center not displaying lmms in sound
    and video (LP: #824231)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
void _init(); // forward declaration
 
24
#else
 
25
#define _WINDOWS_DLL_EXPORT_ 
 
26
#endif
 
27
 
 
28
#line 10 "xfade_1915.xml"
 
29
 
 
30
#include "ladspa-util.h"
 
31
 
 
32
#define XFADE_XFADE                    0
 
33
#define XFADE_INPUTLA                  1
 
34
#define XFADE_INPUTRA                  2
 
35
#define XFADE_INPUTLB                  3
 
36
#define XFADE_INPUTRB                  4
 
37
#define XFADE_OUTPUTL                  5
 
38
#define XFADE_OUTPUTR                  6
 
39
#define XFADE4_XFADE                   0
 
40
#define XFADE4_INPUTLA                 1
 
41
#define XFADE4_INPUTRA                 2
 
42
#define XFADE4_INPUTLB                 3
 
43
#define XFADE4_INPUTRB                 4
 
44
#define XFADE4_OUTPUTLA                5
 
45
#define XFADE4_OUTPUTRA                6
 
46
#define XFADE4_OUTPUTLB                7
 
47
#define XFADE4_OUTPUTRB                8
 
48
 
 
49
static LADSPA_Descriptor *xfadeDescriptor = NULL;
 
50
 
 
51
typedef struct {
 
52
        LADSPA_Data *xfade;
 
53
        LADSPA_Data *inputLA;
 
54
        LADSPA_Data *inputRA;
 
55
        LADSPA_Data *inputLB;
 
56
        LADSPA_Data *inputRB;
 
57
        LADSPA_Data *outputL;
 
58
        LADSPA_Data *outputR;
 
59
        LADSPA_Data run_adding_gain;
 
60
} Xfade;
 
61
 
 
62
static LADSPA_Descriptor *xfade4Descriptor = NULL;
 
63
 
 
64
typedef struct {
 
65
        LADSPA_Data *xfade;
 
66
        LADSPA_Data *inputLA;
 
67
        LADSPA_Data *inputRA;
 
68
        LADSPA_Data *inputLB;
 
69
        LADSPA_Data *inputRB;
 
70
        LADSPA_Data *outputLA;
 
71
        LADSPA_Data *outputRA;
 
72
        LADSPA_Data *outputLB;
 
73
        LADSPA_Data *outputRB;
 
74
        LADSPA_Data run_adding_gain;
 
75
} Xfade4;
 
76
 
 
77
_WINDOWS_DLL_EXPORT_
 
78
const LADSPA_Descriptor *ladspa_descriptor(unsigned long index) {
 
79
 
 
80
#ifdef WIN32
 
81
        if (bIsFirstTime) {
 
82
                _init();
 
83
                bIsFirstTime = 0;
 
84
        }
 
85
#endif
 
86
        switch (index) {
 
87
        case 0:
 
88
                return xfadeDescriptor;
 
89
        case 1:
 
90
                return xfade4Descriptor;
 
91
        default:
 
92
                return NULL;
 
93
        }
 
94
}
 
95
 
 
96
static void cleanupXfade(LADSPA_Handle instance) {
 
97
        free(instance);
 
98
}
 
99
 
 
100
static void connectPortXfade(
 
101
 LADSPA_Handle instance,
 
102
 unsigned long port,
 
103
 LADSPA_Data *data) {
 
104
        Xfade *plugin;
 
105
 
 
106
        plugin = (Xfade *)instance;
 
107
        switch (port) {
 
108
        case XFADE_XFADE:
 
109
                plugin->xfade = data;
 
110
                break;
 
111
        case XFADE_INPUTLA:
 
112
                plugin->inputLA = data;
 
113
                break;
 
114
        case XFADE_INPUTRA:
 
115
                plugin->inputRA = data;
 
116
                break;
 
117
        case XFADE_INPUTLB:
 
118
                plugin->inputLB = data;
 
119
                break;
 
120
        case XFADE_INPUTRB:
 
121
                plugin->inputRB = data;
 
122
                break;
 
123
        case XFADE_OUTPUTL:
 
124
                plugin->outputL = data;
 
125
                break;
 
126
        case XFADE_OUTPUTR:
 
127
                plugin->outputR = data;
 
128
                break;
 
129
        }
 
130
}
 
131
 
 
132
static LADSPA_Handle instantiateXfade(
 
133
 const LADSPA_Descriptor *descriptor,
 
134
 unsigned long s_rate) {
 
135
        Xfade *plugin_data = (Xfade *)malloc(sizeof(Xfade));
 
136
        plugin_data->run_adding_gain = 1.0f;
 
137
 
 
138
        return (LADSPA_Handle)plugin_data;
 
139
}
 
140
 
 
141
#undef buffer_write
 
142
#undef RUN_ADDING
 
143
#undef RUN_REPLACING
 
144
 
 
145
#define buffer_write(b, v) (b = v)
 
146
#define RUN_ADDING    0
 
147
#define RUN_REPLACING 1
 
148
 
 
149
static void runXfade(LADSPA_Handle instance, unsigned long sample_count) {
 
150
        Xfade *plugin_data = (Xfade *)instance;
 
151
 
 
152
        /* Crossfade (float value) */
 
153
        const LADSPA_Data xfade = *(plugin_data->xfade);
 
154
 
 
155
        /* Input A left (array of floats of length sample_count) */
 
156
        const LADSPA_Data * const inputLA = plugin_data->inputLA;
 
157
 
 
158
        /* Input A right (array of floats of length sample_count) */
 
159
        const LADSPA_Data * const inputRA = plugin_data->inputRA;
 
160
 
 
161
        /* Input B left (array of floats of length sample_count) */
 
162
        const LADSPA_Data * const inputLB = plugin_data->inputLB;
 
163
 
 
164
        /* Input B right (array of floats of length sample_count) */
 
165
        const LADSPA_Data * const inputRB = plugin_data->inputRB;
 
166
 
 
167
        /* Output left (array of floats of length sample_count) */
 
168
        LADSPA_Data * const outputL = plugin_data->outputL;
 
169
 
 
170
        /* Output right (array of floats of length sample_count) */
 
171
        LADSPA_Data * const outputR = plugin_data->outputR;
 
172
 
 
173
#line 19 "xfade_1915.xml"
 
174
        unsigned long pos;
 
175
        const float coefB = (xfade + 1.0f) * 0.5f;
 
176
        const float coefA = 1.0f - coefB;
 
177
 
 
178
        for (pos = 0; pos < sample_count; pos++) {
 
179
          buffer_write(outputL[pos], inputLA[pos] * coefA + inputLB[pos] * coefB);
 
180
          buffer_write(outputR[pos], inputRA[pos] * coefA + inputRB[pos] * coefB);
 
181
        }
 
182
}
 
183
#undef buffer_write
 
184
#undef RUN_ADDING
 
185
#undef RUN_REPLACING
 
186
 
 
187
#define buffer_write(b, v) (b += (v) * run_adding_gain)
 
188
#define RUN_ADDING    1
 
189
#define RUN_REPLACING 0
 
190
 
 
191
static void setRunAddingGainXfade(LADSPA_Handle instance, LADSPA_Data gain) {
 
192
        ((Xfade *)instance)->run_adding_gain = gain;
 
193
}
 
194
 
 
195
static void runAddingXfade(LADSPA_Handle instance, unsigned long sample_count) {
 
196
        Xfade *plugin_data = (Xfade *)instance;
 
197
        LADSPA_Data run_adding_gain = plugin_data->run_adding_gain;
 
198
 
 
199
        /* Crossfade (float value) */
 
200
        const LADSPA_Data xfade = *(plugin_data->xfade);
 
201
 
 
202
        /* Input A left (array of floats of length sample_count) */
 
203
        const LADSPA_Data * const inputLA = plugin_data->inputLA;
 
204
 
 
205
        /* Input A right (array of floats of length sample_count) */
 
206
        const LADSPA_Data * const inputRA = plugin_data->inputRA;
 
207
 
 
208
        /* Input B left (array of floats of length sample_count) */
 
209
        const LADSPA_Data * const inputLB = plugin_data->inputLB;
 
210
 
 
211
        /* Input B right (array of floats of length sample_count) */
 
212
        const LADSPA_Data * const inputRB = plugin_data->inputRB;
 
213
 
 
214
        /* Output left (array of floats of length sample_count) */
 
215
        LADSPA_Data * const outputL = plugin_data->outputL;
 
216
 
 
217
        /* Output right (array of floats of length sample_count) */
 
218
        LADSPA_Data * const outputR = plugin_data->outputR;
 
219
 
 
220
#line 19 "xfade_1915.xml"
 
221
        unsigned long pos;
 
222
        const float coefB = (xfade + 1.0f) * 0.5f;
 
223
        const float coefA = 1.0f - coefB;
 
224
 
 
225
        for (pos = 0; pos < sample_count; pos++) {
 
226
          buffer_write(outputL[pos], inputLA[pos] * coefA + inputLB[pos] * coefB);
 
227
          buffer_write(outputR[pos], inputRA[pos] * coefA + inputRB[pos] * coefB);
 
228
        }
 
229
}
 
230
 
 
231
static void cleanupXfade4(LADSPA_Handle instance) {
 
232
        free(instance);
 
233
}
 
234
 
 
235
static void connectPortXfade4(
 
236
 LADSPA_Handle instance,
 
237
 unsigned long port,
 
238
 LADSPA_Data *data) {
 
239
        Xfade4 *plugin;
 
240
 
 
241
        plugin = (Xfade4 *)instance;
 
242
        switch (port) {
 
243
        case XFADE4_XFADE:
 
244
                plugin->xfade = data;
 
245
                break;
 
246
        case XFADE4_INPUTLA:
 
247
                plugin->inputLA = data;
 
248
                break;
 
249
        case XFADE4_INPUTRA:
 
250
                plugin->inputRA = data;
 
251
                break;
 
252
        case XFADE4_INPUTLB:
 
253
                plugin->inputLB = data;
 
254
                break;
 
255
        case XFADE4_INPUTRB:
 
256
                plugin->inputRB = data;
 
257
                break;
 
258
        case XFADE4_OUTPUTLA:
 
259
                plugin->outputLA = data;
 
260
                break;
 
261
        case XFADE4_OUTPUTRA:
 
262
                plugin->outputRA = data;
 
263
                break;
 
264
        case XFADE4_OUTPUTLB:
 
265
                plugin->outputLB = data;
 
266
                break;
 
267
        case XFADE4_OUTPUTRB:
 
268
                plugin->outputRB = data;
 
269
                break;
 
270
        }
 
271
}
 
272
 
 
273
static LADSPA_Handle instantiateXfade4(
 
274
 const LADSPA_Descriptor *descriptor,
 
275
 unsigned long s_rate) {
 
276
        Xfade4 *plugin_data = (Xfade4 *)malloc(sizeof(Xfade4));
 
277
        plugin_data->run_adding_gain = 1.0f;
 
278
 
 
279
        return (LADSPA_Handle)plugin_data;
 
280
}
 
281
 
 
282
#undef buffer_write
 
283
#undef RUN_ADDING
 
284
#undef RUN_REPLACING
 
285
 
 
286
#define buffer_write(b, v) (b = v)
 
287
#define RUN_ADDING    0
 
288
#define RUN_REPLACING 1
 
289
 
 
290
static void runXfade4(LADSPA_Handle instance, unsigned long sample_count) {
 
291
        Xfade4 *plugin_data = (Xfade4 *)instance;
 
292
 
 
293
        /* Crossfade (float value) */
 
294
        const LADSPA_Data xfade = *(plugin_data->xfade);
 
295
 
 
296
        /* Input A left (array of floats of length sample_count) */
 
297
        const LADSPA_Data * const inputLA = plugin_data->inputLA;
 
298
 
 
299
        /* Input A right (array of floats of length sample_count) */
 
300
        const LADSPA_Data * const inputRA = plugin_data->inputRA;
 
301
 
 
302
        /* Input B left (array of floats of length sample_count) */
 
303
        const LADSPA_Data * const inputLB = plugin_data->inputLB;
 
304
 
 
305
        /* Input B right (array of floats of length sample_count) */
 
306
        const LADSPA_Data * const inputRB = plugin_data->inputRB;
 
307
 
 
308
        /* Output A left (array of floats of length sample_count) */
 
309
        LADSPA_Data * const outputLA = plugin_data->outputLA;
 
310
 
 
311
        /* Output A right (array of floats of length sample_count) */
 
312
        LADSPA_Data * const outputRA = plugin_data->outputRA;
 
313
 
 
314
        /* Output B left (array of floats of length sample_count) */
 
315
        LADSPA_Data * const outputLB = plugin_data->outputLB;
 
316
 
 
317
        /* Output B right (array of floats of length sample_count) */
 
318
        LADSPA_Data * const outputRB = plugin_data->outputRB;
 
319
 
 
320
#line 19 "xfade_1915.xml"
 
321
        unsigned long pos;
 
322
        const float coefB = (xfade + 1.0f) * 0.5f;
 
323
        const float coefA = 1.0f - coefB;
 
324
 
 
325
        for (pos = 0; pos < sample_count; pos++) {
 
326
          buffer_write(outputLA[pos], inputLA[pos] * coefA);
 
327
          buffer_write(outputRA[pos], inputRA[pos] * coefA);
 
328
          buffer_write(outputLB[pos], inputLB[pos] * coefB);
 
329
          buffer_write(outputRB[pos], inputRB[pos] * coefB);
 
330
        }
 
331
}
 
332
#undef buffer_write
 
333
#undef RUN_ADDING
 
334
#undef RUN_REPLACING
 
335
 
 
336
#define buffer_write(b, v) (b += (v) * run_adding_gain)
 
337
#define RUN_ADDING    1
 
338
#define RUN_REPLACING 0
 
339
 
 
340
static void setRunAddingGainXfade4(LADSPA_Handle instance, LADSPA_Data gain) {
 
341
        ((Xfade4 *)instance)->run_adding_gain = gain;
 
342
}
 
343
 
 
344
static void runAddingXfade4(LADSPA_Handle instance, unsigned long sample_count) {
 
345
        Xfade4 *plugin_data = (Xfade4 *)instance;
 
346
        LADSPA_Data run_adding_gain = plugin_data->run_adding_gain;
 
347
 
 
348
        /* Crossfade (float value) */
 
349
        const LADSPA_Data xfade = *(plugin_data->xfade);
 
350
 
 
351
        /* Input A left (array of floats of length sample_count) */
 
352
        const LADSPA_Data * const inputLA = plugin_data->inputLA;
 
353
 
 
354
        /* Input A right (array of floats of length sample_count) */
 
355
        const LADSPA_Data * const inputRA = plugin_data->inputRA;
 
356
 
 
357
        /* Input B left (array of floats of length sample_count) */
 
358
        const LADSPA_Data * const inputLB = plugin_data->inputLB;
 
359
 
 
360
        /* Input B right (array of floats of length sample_count) */
 
361
        const LADSPA_Data * const inputRB = plugin_data->inputRB;
 
362
 
 
363
        /* Output A left (array of floats of length sample_count) */
 
364
        LADSPA_Data * const outputLA = plugin_data->outputLA;
 
365
 
 
366
        /* Output A right (array of floats of length sample_count) */
 
367
        LADSPA_Data * const outputRA = plugin_data->outputRA;
 
368
 
 
369
        /* Output B left (array of floats of length sample_count) */
 
370
        LADSPA_Data * const outputLB = plugin_data->outputLB;
 
371
 
 
372
        /* Output B right (array of floats of length sample_count) */
 
373
        LADSPA_Data * const outputRB = plugin_data->outputRB;
 
374
 
 
375
#line 19 "xfade_1915.xml"
 
376
        unsigned long pos;
 
377
        const float coefB = (xfade + 1.0f) * 0.5f;
 
378
        const float coefA = 1.0f - coefB;
 
379
 
 
380
        for (pos = 0; pos < sample_count; pos++) {
 
381
          buffer_write(outputLA[pos], inputLA[pos] * coefA);
 
382
          buffer_write(outputRA[pos], inputRA[pos] * coefA);
 
383
          buffer_write(outputLB[pos], inputLB[pos] * coefB);
 
384
          buffer_write(outputRB[pos], inputRB[pos] * coefB);
 
385
        }
 
386
}
 
387
 
 
388
void _init() {
 
389
        char **port_names;
 
390
        LADSPA_PortDescriptor *port_descriptors;
 
391
        LADSPA_PortRangeHint *port_range_hints;
 
392
 
 
393
#ifdef ENABLE_NLS
 
394
#define D_(s) dgettext(PACKAGE, s)
 
395
        setlocale(LC_ALL, "");
 
396
        bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR);
 
397
#else
 
398
#define D_(s) (s)
 
399
#endif
 
400
 
 
401
 
 
402
        xfadeDescriptor =
 
403
         (LADSPA_Descriptor *)malloc(sizeof(LADSPA_Descriptor));
 
404
 
 
405
        if (xfadeDescriptor) {
 
406
                xfadeDescriptor->UniqueID = 1915;
 
407
                xfadeDescriptor->Label = "xfade";
 
408
                xfadeDescriptor->Properties =
 
409
                 LADSPA_PROPERTY_HARD_RT_CAPABLE;
 
410
                xfadeDescriptor->Name =
 
411
                 D_("Crossfade");
 
412
                xfadeDescriptor->Maker =
 
413
                 "Steve Harris <steve@plugin.org.uk>";
 
414
                xfadeDescriptor->Copyright =
 
415
                 "GPL";
 
416
                xfadeDescriptor->PortCount = 7;
 
417
 
 
418
                port_descriptors = (LADSPA_PortDescriptor *)calloc(7,
 
419
                 sizeof(LADSPA_PortDescriptor));
 
420
                xfadeDescriptor->PortDescriptors =
 
421
                 (const LADSPA_PortDescriptor *)port_descriptors;
 
422
 
 
423
                port_range_hints = (LADSPA_PortRangeHint *)calloc(7,
 
424
                 sizeof(LADSPA_PortRangeHint));
 
425
                xfadeDescriptor->PortRangeHints =
 
426
                 (const LADSPA_PortRangeHint *)port_range_hints;
 
427
 
 
428
                port_names = (char **)calloc(7, sizeof(char*));
 
429
                xfadeDescriptor->PortNames =
 
430
                 (const char **)port_names;
 
431
 
 
432
                /* Parameters for Crossfade */
 
433
                port_descriptors[XFADE_XFADE] =
 
434
                 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL;
 
435
                port_names[XFADE_XFADE] =
 
436
                 D_("Crossfade");
 
437
                port_range_hints[XFADE_XFADE].HintDescriptor =
 
438
                 LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0;
 
439
                port_range_hints[XFADE_XFADE].LowerBound = -1;
 
440
                port_range_hints[XFADE_XFADE].UpperBound = 1;
 
441
 
 
442
                /* Parameters for Input A left */
 
443
                port_descriptors[XFADE_INPUTLA] =
 
444
                 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
 
445
                port_names[XFADE_INPUTLA] =
 
446
                 D_("Input A left");
 
447
                port_range_hints[XFADE_INPUTLA].HintDescriptor = 0;
 
448
 
 
449
                /* Parameters for Input A right */
 
450
                port_descriptors[XFADE_INPUTRA] =
 
451
                 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
 
452
                port_names[XFADE_INPUTRA] =
 
453
                 D_("Input A right");
 
454
                port_range_hints[XFADE_INPUTRA].HintDescriptor = 0;
 
455
 
 
456
                /* Parameters for Input B left */
 
457
                port_descriptors[XFADE_INPUTLB] =
 
458
                 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
 
459
                port_names[XFADE_INPUTLB] =
 
460
                 D_("Input B left");
 
461
                port_range_hints[XFADE_INPUTLB].HintDescriptor = 0;
 
462
 
 
463
                /* Parameters for Input B right */
 
464
                port_descriptors[XFADE_INPUTRB] =
 
465
                 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
 
466
                port_names[XFADE_INPUTRB] =
 
467
                 D_("Input B right");
 
468
                port_range_hints[XFADE_INPUTRB].HintDescriptor = 0;
 
469
 
 
470
                /* Parameters for Output left */
 
471
                port_descriptors[XFADE_OUTPUTL] =
 
472
                 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
 
473
                port_names[XFADE_OUTPUTL] =
 
474
                 D_("Output left");
 
475
                port_range_hints[XFADE_OUTPUTL].HintDescriptor = 0;
 
476
 
 
477
                /* Parameters for Output right */
 
478
                port_descriptors[XFADE_OUTPUTR] =
 
479
                 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
 
480
                port_names[XFADE_OUTPUTR] =
 
481
                 D_("Output right");
 
482
                port_range_hints[XFADE_OUTPUTR].HintDescriptor = 0;
 
483
 
 
484
                xfadeDescriptor->activate = NULL;
 
485
                xfadeDescriptor->cleanup = cleanupXfade;
 
486
                xfadeDescriptor->connect_port = connectPortXfade;
 
487
                xfadeDescriptor->deactivate = NULL;
 
488
                xfadeDescriptor->instantiate = instantiateXfade;
 
489
                xfadeDescriptor->run = runXfade;
 
490
                xfadeDescriptor->run_adding = runAddingXfade;
 
491
                xfadeDescriptor->set_run_adding_gain = setRunAddingGainXfade;
 
492
        }
 
493
 
 
494
        xfade4Descriptor =
 
495
         (LADSPA_Descriptor *)malloc(sizeof(LADSPA_Descriptor));
 
496
 
 
497
        if (xfade4Descriptor) {
 
498
                xfade4Descriptor->UniqueID = 1917;
 
499
                xfade4Descriptor->Label = "xfade4";
 
500
                xfade4Descriptor->Properties =
 
501
                 LADSPA_PROPERTY_HARD_RT_CAPABLE;
 
502
                xfade4Descriptor->Name =
 
503
                 D_("Crossfade (4 outs)");
 
504
                xfade4Descriptor->Maker =
 
505
                 "Steve Harris <steve@plugin.org.uk>";
 
506
                xfade4Descriptor->Copyright =
 
507
                 "GPL";
 
508
                xfade4Descriptor->PortCount = 9;
 
509
 
 
510
                port_descriptors = (LADSPA_PortDescriptor *)calloc(9,
 
511
                 sizeof(LADSPA_PortDescriptor));
 
512
                xfade4Descriptor->PortDescriptors =
 
513
                 (const LADSPA_PortDescriptor *)port_descriptors;
 
514
 
 
515
                port_range_hints = (LADSPA_PortRangeHint *)calloc(9,
 
516
                 sizeof(LADSPA_PortRangeHint));
 
517
                xfade4Descriptor->PortRangeHints =
 
518
                 (const LADSPA_PortRangeHint *)port_range_hints;
 
519
 
 
520
                port_names = (char **)calloc(9, sizeof(char*));
 
521
                xfade4Descriptor->PortNames =
 
522
                 (const char **)port_names;
 
523
 
 
524
                /* Parameters for Crossfade */
 
525
                port_descriptors[XFADE4_XFADE] =
 
526
                 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL;
 
527
                port_names[XFADE4_XFADE] =
 
528
                 D_("Crossfade");
 
529
                port_range_hints[XFADE4_XFADE].HintDescriptor =
 
530
                 LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0;
 
531
                port_range_hints[XFADE4_XFADE].LowerBound = -1;
 
532
                port_range_hints[XFADE4_XFADE].UpperBound = 1;
 
533
 
 
534
                /* Parameters for Input A left */
 
535
                port_descriptors[XFADE4_INPUTLA] =
 
536
                 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
 
537
                port_names[XFADE4_INPUTLA] =
 
538
                 D_("Input A left");
 
539
                port_range_hints[XFADE4_INPUTLA].HintDescriptor = 0;
 
540
 
 
541
                /* Parameters for Input A right */
 
542
                port_descriptors[XFADE4_INPUTRA] =
 
543
                 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
 
544
                port_names[XFADE4_INPUTRA] =
 
545
                 D_("Input A right");
 
546
                port_range_hints[XFADE4_INPUTRA].HintDescriptor = 0;
 
547
 
 
548
                /* Parameters for Input B left */
 
549
                port_descriptors[XFADE4_INPUTLB] =
 
550
                 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
 
551
                port_names[XFADE4_INPUTLB] =
 
552
                 D_("Input B left");
 
553
                port_range_hints[XFADE4_INPUTLB].HintDescriptor = 0;
 
554
 
 
555
                /* Parameters for Input B right */
 
556
                port_descriptors[XFADE4_INPUTRB] =
 
557
                 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO;
 
558
                port_names[XFADE4_INPUTRB] =
 
559
                 D_("Input B right");
 
560
                port_range_hints[XFADE4_INPUTRB].HintDescriptor = 0;
 
561
 
 
562
                /* Parameters for Output A left */
 
563
                port_descriptors[XFADE4_OUTPUTLA] =
 
564
                 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
 
565
                port_names[XFADE4_OUTPUTLA] =
 
566
                 D_("Output A left");
 
567
                port_range_hints[XFADE4_OUTPUTLA].HintDescriptor = 0;
 
568
 
 
569
                /* Parameters for Output A right */
 
570
                port_descriptors[XFADE4_OUTPUTRA] =
 
571
                 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
 
572
                port_names[XFADE4_OUTPUTRA] =
 
573
                 D_("Output A right");
 
574
                port_range_hints[XFADE4_OUTPUTRA].HintDescriptor = 0;
 
575
 
 
576
                /* Parameters for Output B left */
 
577
                port_descriptors[XFADE4_OUTPUTLB] =
 
578
                 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
 
579
                port_names[XFADE4_OUTPUTLB] =
 
580
                 D_("Output B left");
 
581
                port_range_hints[XFADE4_OUTPUTLB].HintDescriptor = 0;
 
582
 
 
583
                /* Parameters for Output B right */
 
584
                port_descriptors[XFADE4_OUTPUTRB] =
 
585
                 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO;
 
586
                port_names[XFADE4_OUTPUTRB] =
 
587
                 D_("Output B right");
 
588
                port_range_hints[XFADE4_OUTPUTRB].HintDescriptor = 0;
 
589
 
 
590
                xfade4Descriptor->activate = NULL;
 
591
                xfade4Descriptor->cleanup = cleanupXfade4;
 
592
                xfade4Descriptor->connect_port = connectPortXfade4;
 
593
                xfade4Descriptor->deactivate = NULL;
 
594
                xfade4Descriptor->instantiate = instantiateXfade4;
 
595
                xfade4Descriptor->run = runXfade4;
 
596
                xfade4Descriptor->run_adding = runAddingXfade4;
 
597
                xfade4Descriptor->set_run_adding_gain = setRunAddingGainXfade4;
 
598
        }
 
599
}
 
600
 
 
601
void _fini() {
 
602
        if (xfadeDescriptor) {
 
603
                free((LADSPA_PortDescriptor *)xfadeDescriptor->PortDescriptors);
 
604
                free((char **)xfadeDescriptor->PortNames);
 
605
                free((LADSPA_PortRangeHint *)xfadeDescriptor->PortRangeHints);
 
606
                free(xfadeDescriptor);
 
607
        }
 
608
        if (xfade4Descriptor) {
 
609
                free((LADSPA_PortDescriptor *)xfade4Descriptor->PortDescriptors);
 
610
                free((char **)xfade4Descriptor->PortNames);
 
611
                free((LADSPA_PortRangeHint *)xfade4Descriptor->PortRangeHints);
 
612
                free(xfade4Descriptor);
 
613
        }
 
614
 
 
615
}