1 /*
2 * Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org>
3 *
4 * This file is part of ZPlugins
5 *
6 * ZPlugins is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * ZPlugins is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Affero Public License
17 * along with ZPlugins. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 /**
21 * \file
22 *
23 * Common code for both the DSP and the UI.
24 */
25
26 #ifndef __Z_COMPRESSOR_COMMON_H__
27 #define __Z_COMPRESSOR_COMMON_H__
28
29 #include PLUGIN_CONFIG
30
31 #include "../common.h"
32
33 typedef struct CompressorUris
34 {
35 } CompressorUris;
36
37 typedef enum PortIndex
38 {
39 /** GUI to plugin communication. */
40 COMPRESSOR_CONTROL,
41 /** Plugin to UI communication. */
42 COMPRESSOR_NOTIFY,
43
44 COMPRESSOR_STEREO_IN_L,
45 COMPRESSOR_STEREO_IN_R,
46 COMPRESSOR_ATTACK,
47 COMPRESSOR_RELEASE,
48 COMPRESSOR_RATIO,
49 COMPRESSOR_THRESHOLD,
50
51 /** Outputs. */
52 COMPRESSOR_STEREO_OUT_L,
53 COMPRESSOR_STEREO_OUT_R,
54
55 NUM_PORTS,
56 } PortIndex;
57
58 /**
59 * Group of variables needed by both the DSP and
60 * the UI.
61 */
62 typedef struct CompressorCommon
63 {
64 /** URIs. */
65 CompressorUris uris;
66
67 PluginCommon pl_common;
68
69 } CompressorCommon;
70
71 static inline void
map_uris(LV2_URID_Map * urid_map,CompressorCommon * compressor_common)72 map_uris (
73 LV2_URID_Map* urid_map,
74 CompressorCommon * compressor_common)
75 {
76 map_common_uris (
77 urid_map, &compressor_common->pl_common.uris);
78
79 #define MAP(x,uri) \
80 compressor_common->uris.x = \
81 urid_map->map (urid_map->handle, uri)
82
83 /* custom URIs */
84
85 #undef MAP
86 }
87
88 #endif
89