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_PITCH_COMMON_H__
27 #define __Z_PITCH_COMMON_H__
28 
29 #include PLUGIN_CONFIG
30 
31 #include "../common.h"
32 
33 typedef struct PitchUris
34 {
35 } PitchUris;
36 
37 typedef enum PortIndex
38 {
39   /** GUI to plugin communication. */
40   PITCH_CONTROL,
41   /** Plugin to UI communication. */
42   PITCH_NOTIFY,
43 
44   PITCH_STEREO_IN_L,
45   PITCH_STEREO_IN_R,
46 
47   PITCH_SHIFT,
48   PITCH_WINDOW,
49   PITCH_XFADE,
50 
51   /** Outputs. */
52   PITCH_STEREO_OUT_L,
53   PITCH_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 PitchCommon
63 {
64   /** URIs. */
65   PitchUris  uris;
66 
67   PluginCommon    pl_common;
68 
69 } PitchCommon;
70 
71 static inline void
map_uris(LV2_URID_Map * urid_map,PitchCommon * pitch_common)72 map_uris (
73   LV2_URID_Map*      urid_map,
74   PitchCommon * pitch_common)
75 {
76   map_common_uris (
77     urid_map, &pitch_common->pl_common.uris);
78 
79 #define MAP(x,uri) \
80   pitch_common->uris.x = \
81     urid_map->map (urid_map->handle, uri)
82 
83   /* custom URIs */
84 
85 #undef MAP
86 }
87 
88 #endif
89