File: interface.cc

package info (click to toggle)
lmms 0.4.10-2.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 45,240 kB
  • sloc: ansic: 435,620; cpp: 175,422; sh: 609; makefile: 75; xml: 14
file content (140 lines) | stat: -rw-r--r-- 3,318 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
  interface.cc

	Copyright 2004-9 Tim Goetze <tim@quitte.de>
	
	http://quitte.de/dsp/

	LADSPA descriptor factory, host interface.

 */
/*
	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
	02111-1307, USA or point your web browser to http://www.gnu.org.
*/

#include <sys/time.h>

#include "basics.h"

#include "Cabinet.h"
#include "Chorus.h"
#include "Phaser.h"
#include "Sin.h"
#include "Lorenz.h"
#include "Roessler.h"
#include "Reverb.h"
#include "Compress.h"
#include "Click.h"
#include "Eq.h"
#include "Clip.h"
#include "White.h"
#include "SweepVF.h"
#include "VCO.h"
#include "Amp.h"
#include "HRTF.h"
#include "Pan.h"
#include "Scape.h"
#include "ToneStack.h" 

#include "Descriptor.h"

#define N 38 
static DescriptorStub * descriptors [N];

/*static inline void
seed()
{
	static struct timeval tv;
  gettimeofday (&tv, 0);

	srand (tv.tv_sec ^ tv.tv_usec);
}*/

extern "C" {

__attribute__ ((constructor)) 
void _init()
{
	DescriptorStub ** d = descriptors;

	*d++ = new Descriptor<Eq>();
	*d++ = new Descriptor<Eq2x2>();
	*d++ = new Descriptor<Compress>();
	*d++ = new Descriptor<Pan>();

	*d++ = new Descriptor<PreampIII>();
	*d++ = new Descriptor<PreampIV>();
	*d++ = new Descriptor<ToneStack>();  
	*d++ = new Descriptor<ToneStackLT>();    
	*d++ = new Descriptor<AmpIII>();
	*d++ = new Descriptor<AmpIV>();
	*d++ = new Descriptor<AmpV>();
	*d++ = new Descriptor<AmpVTS>();     
	*d++ = new Descriptor<CabinetI>();
	*d++ = new Descriptor<CabinetII>();
	*d++ = new Descriptor<Clip>();

	*d++ = new Descriptor<ChorusI>();
	*d++ = new Descriptor<StereoChorusI>();
	*d++ = new Descriptor<ChorusII>();
	*d++ = new Descriptor<StereoChorusII>();
	*d++ = new Descriptor<PhaserI>();
	*d++ = new Descriptor<PhaserII>();
	*d++ = new Descriptor<SweepVFI>();
	*d++ = new Descriptor<SweepVFII>();
	*d++ = new Descriptor<AutoWah>();
	*d++ = new Descriptor<Scape>();

	*d++ = new Descriptor<VCOs>();
	*d++ = new Descriptor<VCOd>();
	*d++ = new Descriptor<CEO>();
	*d++ = new Descriptor<Sin>();
	*d++ = new Descriptor<White>();
	*d++ = new Descriptor<Lorenz>();
	*d++ = new Descriptor<Roessler>();

	*d++ = new Descriptor<JVRev>();
	*d++ = new Descriptor<Plate>();
	*d++ = new Descriptor<Plate2x2>();

	*d++ = new Descriptor<Click>();
	*d++ = new Descriptor<Dirac>();
	*d++ = new Descriptor<HRTF>();

	/* make sure N is correct */
	assert (d - descriptors == N);

	//seed();
}

__attribute__ ((destructor)) 
void _fini()
{
	for (ulong i = 0; i < N; ++i)
		delete descriptors[i];
}

/* /////////////////////////////////////////////////////////////////////// */

const LADSPA_Descriptor *
ladspa_descriptor (unsigned long i)
{
	if (i < N)
		return descriptors[i];
	return 0;
}

}; /* extern "C" */