1 //=========================================================
2 // MusE
3 // Linux Music Editor
4 // $Id: freeverb.cpp,v 1.1.1.1 2003/10/27 18:57:03 wschweer Exp $
5 // (C) Copyright 2000 Werner Schweer (ws@seh.de)
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; version 2 of
10 // the License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 //
21 //=========================================================
22
23 #include "revmodel.h"
24
25 //---------------------------------------------------------
26 // instantiateFreeverb
27 // Construct a new plugin instance.
28 //---------------------------------------------------------
29
instantiate(const LADSPA_Descriptor *,unsigned long)30 LADSPA_Handle instantiate(const LADSPA_Descriptor* /*Descriptor*/,
31 unsigned long /* samplerate*/)
32 {
33 return new Revmodel;
34 }
35
36 //---------------------------------------------------------
37 // connectPortToFreeverb
38 // Connect a port to a data location.
39 //---------------------------------------------------------
40
connect(LADSPA_Handle Instance,unsigned long port,LADSPA_Data * data)41 void connect(LADSPA_Handle Instance, unsigned long port,
42 LADSPA_Data* data)
43 {
44 ((Revmodel *)Instance)->port[port] = data;
45 }
46
47 //---------------------------------------------------------
48 // activate
49 //---------------------------------------------------------
50
activate(LADSPA_Handle instance)51 void activate(LADSPA_Handle instance)
52 {
53 ((Revmodel *)instance)->activate();
54 }
55
56 //---------------------------------------------------------
57 // deactivate
58 //---------------------------------------------------------
59
deactivate(LADSPA_Handle)60 void deactivate(LADSPA_Handle /*Instance*/)
61 {
62 }
63
64 //---------------------------------------------------------
65 // runFreeverb
66 //---------------------------------------------------------
67
run(LADSPA_Handle Instance,unsigned long n)68 void run(LADSPA_Handle Instance, unsigned long n)
69 {
70 ((Revmodel*)Instance)->processreplace(n);
71 }
72
73 //---------------------------------------------------------
74 // runAddingFreeverb
75 // *ADD* the output to the output buffer.
76 //---------------------------------------------------------
77
runAdding(LADSPA_Handle Instance,unsigned long n)78 void runAdding(LADSPA_Handle Instance, unsigned long n)
79 {
80 ((Revmodel*)Instance)->processmix(n);
81 }
82
83 //---------------------------------------------------------
84 // setFreeverbRunAddingGain
85 //---------------------------------------------------------
86
setGain(LADSPA_Handle,LADSPA_Data)87 void setGain(LADSPA_Handle /*Instance*/, LADSPA_Data /*Gain*/)
88 {
89 // ((Freeverb *)Instance)->m_fRunAddingGain = Gain;
90 }
91
92 //---------------------------------------------------------
93 // cleanupFreeverb
94 //---------------------------------------------------------
95
cleanup(LADSPA_Handle Instance)96 void cleanup(LADSPA_Handle Instance)
97 {
98 delete (Revmodel *)Instance;
99 }
100
101 static const char* portNames[] = {
102 "Input (Left)",
103 "Input (Right)",
104 "Output (Left)",
105 "Output (Right)",
106 "Room Size",
107 "Damping",
108 "Wet Level",
109 };
110
111 LADSPA_PortDescriptor portDescriptors[] = {
112 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO,
113 LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO,
114 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO,
115 LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO,
116 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
117 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
118 LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL,
119 };
120
121 LADSPA_PortRangeHint portRangeHints[] = {
122 { 0, 0.0, 0.0 },
123 { 0, 0.0, 0.0 },
124 { 0, 0.0, 0.0 },
125 { 0, 0.0, 0.0 },
126 { LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW, 0.0, 1.0 },
127 { LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_LOGARITHMIC, 0.0, 1.0 },
128 { LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_LOGARITHMIC, 0.0, 1.0 },
129 };
130
131 LADSPA_Descriptor descriptor = {
132 1050,
133 "freeverb1",
134 LADSPA_PROPERTY_HARD_RT_CAPABLE,
135 "Freeverb",
136 "Werner Schweer",
137 "None",
138 7,
139 portDescriptors,
140 portNames,
141 portRangeHints,
142 0, // impl. data
143 instantiate,
144 connect,
145 activate,
146 run,
147 runAdding,
148 setGain,
149 deactivate,
150 cleanup
151 };
152
153 //---------------------------------------------------------
154 // _init
155 // called automatically when the plugin library is first
156 // loaded.
157 //---------------------------------------------------------
158
_init()159 void _init()
160 {
161 }
162
163 //---------------------------------------------------------
164 // _fini
165 // called automatically when the library is unloaded.
166 //---------------------------------------------------------
167
_fini()168 void _fini()
169 {
170 }
171
172 //---------------------------------------------------------
173 // ladspa_descriptor
174 // Return a descriptor of the requested plugin type.
175 //---------------------------------------------------------
176
ladspa_descriptor(unsigned long i)177 const LADSPA_Descriptor* ladspa_descriptor(unsigned long i)
178 {
179 return (i == 0) ? &descriptor : 0;
180 }
181
182