1 /*
2  * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3  *           (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com>
4  *
5  * This file is part of lsp-plugins
6  * Created on: 3 нояб. 2016 г.
7  *
8  * lsp-plugins is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * any later version.
12  *
13  * lsp-plugins is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with lsp-plugins. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #include <core/types.h>
23 #include <metadata/plugins.h>
24 #include <metadata/ports.h>
25 #include <metadata/developers.h>
26 
27 namespace lsp
28 {
29     //-------------------------------------------------------------------------
30     // Expander
31     static const int expander_classes[] = { C_EXPANDER, -1 };
32 
33     static const port_item_t exp_sc_modes[] =
34     {
35         { "Peak",       "sidechain.peak"           },
36         { "RMS",        "sidechain.rms"            },
37         { "Low-Pass",   "sidechain.lowpass"        },
38         { "Uniform",    "sidechain.uniform"        },
39         { NULL, NULL }
40     };
41 
42     static const port_item_t exp_sc_sources[] =
43     {
44         { "Middle",     "sidechain.middle" },
45         { "Side",       "sidechain.side" },
46         { "Left",       "sidechain.left" },
47         { "Right",      "sidechain.right" },
48         { NULL, NULL }
49     };
50 
51     static const port_item_t exp_sc_type[] =
52     {
53         { "Internal",   "sidechain.internal" },
54         { "External",   "sidechain.external" },
55         { NULL, NULL }
56     };
57 
58     static const port_item_t exp_modes[] =
59     {
60         { "Down",       "expander.down_ward" },
61         { "Up",         "expander.up_ward" },
62         { NULL, NULL }
63     };
64 
65     static const port_item_t exp_filter_slope[] =
66     {
67         { "off",        "eq.slope.off"      },
68         { "12 dB/oct",  "eq.slope.12dbo"    },
69         { "24 dB/oct",  "eq.slope.24dbo"    },
70         { "36 dB/oct",  "eq.slope.36dbo"    },
71         { NULL, NULL }
72     };
73 
74     #define EXP_COMMON     \
75         BYPASS,             \
76         IN_GAIN,            \
77         OUT_GAIN,           \
78         SWITCH("pause", "Pause graph analysis", 0.0f), \
79         TRIGGER("clear", "Clear graph analysis")
80 
81     #define EXP_MS_COMMON  \
82         EXP_COMMON,        \
83         SWITCH("msl", "Mid/Side listen", 0.0f)
84 
85     #define EXP_MONO_CHANNEL \
86         COMBO("scm", "Sidechain mode", expander_base_metadata::SC_MODE_DFL, exp_sc_modes), \
87         CONTROL("sla", "Sidechain lookahead", U_MSEC, expander_base_metadata::LOOKAHEAD), \
88         SWITCH("scl", "Sidechain listen", 0.0f), \
89         LOG_CONTROL("scr", "Sidechain reactivity", U_MSEC, expander_base_metadata::REACTIVITY), \
90         AMP_GAIN100("scp", "Sidechain preamp", GAIN_AMP_0_DB), \
91         COMBO("shpm", "High-pass filter mode", 0, exp_filter_slope),      \
92         LOG_CONTROL("shpf", "High-pass filter frequency", U_HZ, expander_base_metadata::HPF),   \
93         COMBO("slpm", "Low-pass filter mode", 0, exp_filter_slope),      \
94         LOG_CONTROL("slpf", "Low-pass filter frequency", U_HZ, expander_base_metadata::LPF)
95 
96     #define EXP_SC_MONO_CHANNEL \
97         COMBO("sci", "Sidechain input", expander_base_metadata::SC_TYPE_DFL, exp_sc_type), \
98         EXP_MONO_CHANNEL
99 
100     #define EXP_STEREO_CHANNEL(id, label) \
101         COMBO("scm" id, "Sidechain mode" label, expander_base_metadata::SC_MODE_DFL, exp_sc_modes), \
102         CONTROL("sla" id, "Sidechain lookahead" label, U_MSEC, expander_base_metadata::LOOKAHEAD), \
103         SWITCH("scl" id, "Sidechain listen" label, 0.0f), \
104         COMBO("scs" id, "Sidechain source" label, expander_base_metadata::SC_SOURCE_DFL, exp_sc_sources), \
105         LOG_CONTROL("scr" id, "Sidechain reactivity" label, U_MSEC, expander_base_metadata::REACTIVITY), \
106         AMP_GAIN100("scp" id, "Sidechain preamp" label, GAIN_AMP_0_DB), \
107         COMBO("shpm" id, "High-pass filter mode" label, 0, exp_filter_slope),      \
108         LOG_CONTROL("shpf" id, "High-pass filter frequency" label, U_HZ, expander_base_metadata::HPF),   \
109         COMBO("slpm" id, "Low-pass filter mode" label, 0, exp_filter_slope),      \
110         LOG_CONTROL("slpf" id, "Low-pass filter frequency" label, U_HZ, expander_base_metadata::LPF)
111 
112     #define EXP_SC_STEREO_CHANNEL(id, label) \
113         COMBO("sci" id, "Sidechain input" label, expander_base_metadata::SC_TYPE_DFL, exp_sc_type), \
114         EXP_STEREO_CHANNEL(id, label)
115 
116     #define EXP_CHANNEL(id, label) \
117         COMBO("em" id, "Expander mode" label, expander_base_metadata::EM_DEFAULT, exp_modes), \
118         LOG_CONTROL("al" id, "Attack threshold" label, U_GAIN_AMP, expander_base_metadata::ATTACK_LVL), \
119         LOG_CONTROL("at" id, "Attack time" label, U_MSEC, expander_base_metadata::ATTACK_TIME), \
120         LOG_CONTROL("rrl" id, "Release threshold" label, U_GAIN_AMP, expander_base_metadata::RELEASE_LVL), \
121         LOG_CONTROL("rt" id, "Release time" label, U_MSEC, expander_base_metadata::RELEASE_TIME), \
122         LOG_CONTROL("er" id, "Ratio" label, U_NONE, expander_base_metadata::RATIO), \
123         LOG_CONTROL("kn" id, "Knee" label, U_GAIN_AMP, expander_base_metadata::KNEE), \
124         LOG_CONTROL("mk" id, "Makeup gain" label, U_GAIN_AMP, expander_base_metadata::MAKEUP), \
125         AMP_GAIN10("cdr" id, "Dry gain" label, GAIN_AMP_M_INF_DB),     \
126         AMP_GAIN10("cwt" id, "Wet gain" label, GAIN_AMP_0_DB), \
127         METER_OUT_GAIN("rl" id, "Release level" label, 20.0f), \
128         SWITCH("slv" id, "Sidechain level visibility" label, 1.0f), \
129         SWITCH("elv" id, "Envelope level visibility" label, 1.0f), \
130         SWITCH("grv" id, "Gain reduction visibility" label, 1.0f), \
131         MESH("ecg" id, "Expander curve graph" label, 2, expander_base_metadata::CURVE_MESH_SIZE), \
132         MESH("scg" id, "Expander sidechain graph" label, 2, expander_base_metadata::TIME_MESH_SIZE), \
133         MESH("evg" id, "Expander envelope graph" label, 2, expander_base_metadata::TIME_MESH_SIZE), \
134         MESH("grg" id, "Expander gain reduciton" label, 2, expander_base_metadata::TIME_MESH_SIZE), \
135         METER_OUT_GAIN("slm" id, "Sidechain level meter" label, GAIN_AMP_P_24_DB), \
136         METER_OUT_GAIN("clm" id, "Curve level meter" label, GAIN_AMP_P_24_DB), \
137         METER_OUT_GAIN("elm" id, "Envelope level meter" label, GAIN_AMP_P_24_DB), \
138         METER_GAIN_DFL("rlm" id, "Reduction level meter" label, GAIN_AMP_P_48_DB, GAIN_AMP_0_DB)
139 
140     #define EXP_AUDIO_METER(id, label) \
141         SWITCH("ilv" id, "Input level visibility" label, 1.0f), \
142         SWITCH("olv" id, "Output level visibility" label, 1.0f), \
143         MESH("icg" id, "Expander input" label, 2, expander_base_metadata::TIME_MESH_SIZE), \
144         MESH("ocg" id, "Expander output" label, 2, expander_base_metadata::TIME_MESH_SIZE), \
145         METER_GAIN("ilm" id, "Input level meter" label, GAIN_AMP_P_24_DB), \
146         METER_GAIN("olm" id, "Output level meter" label, GAIN_AMP_P_24_DB)
147 
148     static const port_t expander_mono_ports[] =
149     {
150         PORTS_MONO_PLUGIN,
151         EXP_COMMON,
152         EXP_MONO_CHANNEL,
153         EXP_CHANNEL("", ""),
154         EXP_AUDIO_METER("", ""),
155 
156         PORTS_END
157     };
158 
159     static const port_t expander_stereo_ports[] =
160     {
161         PORTS_STEREO_PLUGIN,
162         EXP_COMMON,
163         EXP_STEREO_CHANNEL("", ""),
164         EXP_CHANNEL("", ""),
165         EXP_AUDIO_METER("_l", " Left"),
166         EXP_AUDIO_METER("_r", " Right"),
167 
168         PORTS_END
169     };
170 
171     static const port_t expander_lr_ports[] =
172     {
173         PORTS_STEREO_PLUGIN,
174         EXP_COMMON,
175         EXP_STEREO_CHANNEL("_l", " Left"),
176         EXP_STEREO_CHANNEL("_r", " Right"),
177         EXP_CHANNEL("_l", " Left"),
178         EXP_CHANNEL("_r", " Right"),
179         EXP_AUDIO_METER("_l", " Left"),
180         EXP_AUDIO_METER("_r", " Right"),
181 
182         PORTS_END
183     };
184 
185     static const port_t expander_ms_ports[] =
186     {
187         PORTS_STEREO_PLUGIN,
188         EXP_MS_COMMON,
189         EXP_STEREO_CHANNEL("_m", " Mid"),
190         EXP_STEREO_CHANNEL("_s", " Side"),
191         EXP_CHANNEL("_m", " Mid"),
192         EXP_CHANNEL("_s", " Side"),
193         EXP_AUDIO_METER("_m", " Mid"),
194         EXP_AUDIO_METER("_s", " Side"),
195 
196         PORTS_END
197     };
198 
199     static const port_t sc_expander_mono_ports[] =
200     {
201         PORTS_MONO_PLUGIN,
202         PORTS_MONO_SIDECHAIN,
203         EXP_COMMON,
204         EXP_SC_MONO_CHANNEL,
205         EXP_CHANNEL("", ""),
206         EXP_AUDIO_METER("", ""),
207 
208         PORTS_END
209     };
210 
211     static const port_t sc_expander_stereo_ports[] =
212     {
213         PORTS_STEREO_PLUGIN,
214         PORTS_STEREO_SIDECHAIN,
215         EXP_COMMON,
216         EXP_SC_STEREO_CHANNEL("", ""),
217         EXP_CHANNEL("", ""),
218         EXP_AUDIO_METER("_l", " Left"),
219         EXP_AUDIO_METER("_r", " Right"),
220 
221         PORTS_END
222     };
223 
224     static const port_t sc_expander_lr_ports[] =
225     {
226         PORTS_STEREO_PLUGIN,
227         PORTS_STEREO_SIDECHAIN,
228         EXP_COMMON,
229         EXP_SC_STEREO_CHANNEL("_l", " Left"),
230         EXP_SC_STEREO_CHANNEL("_r", " Right"),
231         EXP_CHANNEL("_l", " Left"),
232         EXP_CHANNEL("_r", " Right"),
233         EXP_AUDIO_METER("_l", " Left"),
234         EXP_AUDIO_METER("_r", " Right"),
235 
236         PORTS_END
237     };
238 
239     static const port_t sc_expander_ms_ports[] =
240     {
241         PORTS_STEREO_PLUGIN,
242         PORTS_STEREO_SIDECHAIN,
243         EXP_MS_COMMON,
244         EXP_SC_STEREO_CHANNEL("_m", " Mid"),
245         EXP_SC_STEREO_CHANNEL("_s", " Side"),
246         EXP_CHANNEL("_m", " Mid"),
247         EXP_CHANNEL("_s", " Side"),
248         EXP_AUDIO_METER("_m", " Mid"),
249         EXP_AUDIO_METER("_s", " Side"),
250 
251         PORTS_END
252     };
253 
254     // Expander
255     const plugin_metadata_t  expander_mono_metadata::metadata =
256     {
257         "Expander Mono",
258         "Expander Mono",
259         "E1M",
260         &developers::v_sadovnikov,
261         "expander_mono",
262         "tddq",
263         LSP_EXPANDER_BASE + 0,
264         LSP_VERSION(1, 0, 2),
265         expander_classes,
266         E_INLINE_DISPLAY,
267         expander_mono_ports,
268         "dynamics/expander/single/mono.xml",
269         NULL,
270         mono_plugin_port_groups
271     };
272 
273     const plugin_metadata_t  expander_stereo_metadata::metadata =
274     {
275         "Expander Stereo",
276         "Expander Stereo",
277         "E1S",
278         &developers::v_sadovnikov,
279         "expander_stereo",
280         "au0f",
281         LSP_EXPANDER_BASE + 1,
282         LSP_VERSION(1, 0, 2),
283         expander_classes,
284         E_INLINE_DISPLAY,
285         expander_stereo_ports,
286         "dynamics/expander/single/stereo.xml",
287         NULL,
288         stereo_plugin_port_groups
289     };
290 
291     const plugin_metadata_t  expander_lr_metadata::metadata =
292     {
293         "Expander LeftRight",
294         "Expander LeftRight",
295         "E1LR",
296         &developers::v_sadovnikov,
297         "expander_lr",
298         "zvsf",
299         LSP_EXPANDER_BASE + 2,
300         LSP_VERSION(1, 0, 2),
301         expander_classes,
302         E_INLINE_DISPLAY,
303         expander_lr_ports,
304         "dynamics/expander/single/lr.xml",
305         NULL,
306         stereo_plugin_port_groups
307     };
308 
309     const plugin_metadata_t  expander_ms_metadata::metadata =
310     {
311         "Expander MidSide",
312         "Expander MidSide",
313         "E1MS",
314         &developers::v_sadovnikov,
315         "expander_ms",
316         "ebhk",
317         LSP_EXPANDER_BASE + 3,
318         LSP_VERSION(1, 0, 2),
319         expander_classes,
320         E_INLINE_DISPLAY,
321         expander_ms_ports,
322         "dynamics/expander/single/ms.xml",
323         NULL,
324         stereo_plugin_port_groups
325     };
326 
327     // Sidechain expander
328     const plugin_metadata_t  sc_expander_mono_metadata::metadata =
329     {
330         "Sidechain-Expander Mono",
331         "Sidechain Expander Mono",
332         "SCE1M",
333         &developers::v_sadovnikov,
334         "sc_expander_mono",
335         "utul",
336         LSP_EXPANDER_BASE + 4,
337         LSP_VERSION(1, 0, 2),
338         expander_classes,
339         E_INLINE_DISPLAY,
340         sc_expander_mono_ports,
341         "dynamics/expander/single/mono.xml",
342         NULL,
343         mono_plugin_sidechain_port_groups
344     };
345 
346     const plugin_metadata_t  sc_expander_stereo_metadata::metadata =
347     {
348         "Sidechain-Expander Stereo",
349         "Sidechain Expander Stereo",
350         "SCE1S",
351         &developers::v_sadovnikov,
352         "sc_expander_stereo",
353         "lwqv",
354         LSP_EXPANDER_BASE + 5,
355         LSP_VERSION(1, 0, 2),
356         expander_classes,
357         E_INLINE_DISPLAY,
358         sc_expander_stereo_ports,
359         "dynamics/expander/single/stereo.xml",
360         NULL,
361         stereo_plugin_sidechain_port_groups
362     };
363 
364     const plugin_metadata_t  sc_expander_lr_metadata::metadata =
365     {
366         "Sidechain-Expander LeftRight",
367         "Sidechain Expander LeftRight",
368         "SCE1LR",
369         &developers::v_sadovnikov,
370         "sc_expander_lr",
371         "pnvw",
372         LSP_EXPANDER_BASE + 6,
373         LSP_VERSION(1, 0, 2),
374         expander_classes,
375         E_INLINE_DISPLAY,
376         sc_expander_lr_ports,
377         "dynamics/expander/single/lr.xml",
378         NULL,
379         stereo_plugin_sidechain_port_groups
380     };
381 
382     const plugin_metadata_t  sc_expander_ms_metadata::metadata =
383     {
384         "Sidechain-Expander MidSide",
385         "Sidechain Expander MidSide",
386         "SCE1MS",
387         &developers::v_sadovnikov,
388         "sc_expander_ms",
389         "zc0d",
390         LSP_EXPANDER_BASE + 7,
391         LSP_VERSION(1, 0, 2),
392         expander_classes,
393         E_INLINE_DISPLAY,
394         sc_expander_ms_ports,
395         "dynamics/expander/single/ms.xml",
396         NULL,
397         stereo_plugin_sidechain_port_groups
398     };
399 }
400 
401 
402 
403