Add initial bits for Qt6 support
[carla.git] / source / includes / ladspa_rdf.hpp
blobeb4496da60590f76eff75ae8d6effb70ede3b9d1
1 /*
2 * Custom types to store LADSPA-RDF information
3 * Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #ifndef LADSPA_RDF_HPP_INCLUDED
19 #define LADSPA_RDF_HPP_INCLUDED
21 #include "CarlaDefines.h"
22 #include "ladspa/ladspa.h"
24 // Base Types
25 typedef int LADSPA_RDF_Property;
26 typedef unsigned long long LADSPA_RDF_PluginType;
28 // Unit Types
29 #define LADSPA_RDF_UNIT_DB 0x01
30 #define LADSPA_RDF_UNIT_COEF 0x02
31 #define LADSPA_RDF_UNIT_HZ 0x04
32 #define LADSPA_RDF_UNIT_S 0x08
33 #define LADSPA_RDF_UNIT_MS 0x10
34 #define LADSPA_RDF_UNIT_MIN 0x20
36 #define LADSPA_RDF_UNIT_CLASS_AMPLITUDE (LADSPA_RDF_UNIT_DB|LADSPA_RDF_UNIT_COEF)
37 #define LADSPA_RDF_UNIT_CLASS_FREQUENCY (LADSPA_RDF_UNIT_HZ)
38 #define LADSPA_RDF_UNIT_CLASS_TIME (LADSPA_RDF_UNIT_S|LADSPA_RDF_UNIT_MS|LADSPA_RDF_UNIT_MIN)
40 #define LADSPA_RDF_IS_UNIT_DB(x) ((x) == LADSPA_RDF_UNIT_DB)
41 #define LADSPA_RDF_IS_UNIT_COEF(x) ((x) == LADSPA_RDF_UNIT_COEF)
42 #define LADSPA_RDF_IS_UNIT_HZ(x) ((x) == LADSPA_RDF_UNIT_HZ)
43 #define LADSPA_RDF_IS_UNIT_S(x) ((x) == LADSPA_RDF_UNIT_S)
44 #define LADSPA_RDF_IS_UNIT_MS(x) ((x) == LADSPA_RDF_UNIT_MS)
45 #define LADSPA_RDF_IS_UNIT_MIN(x) ((x) == LADSPA_RDF_UNIT_MIN)
47 #define LADSPA_RDF_IS_UNIT_CLASS_AMPLITUDE(x) ((x) & LADSPA_RDF_UNIT_CLASS_AMPLITUDE)
48 #define LADSPA_RDF_IS_UNIT_CLASS_FREQUENCY(x) ((x) & LADSPA_RDF_UNIT_CLASS_FREQUENCY)
49 #define LADSPA_RDF_IS_UNIT_CLASS_TIME(x) ((x) & LADSPA_RDF_UNIT_CLASS_TIME)
51 // Port Hints
52 #define LADSPA_RDF_PORT_UNIT 0x1
53 #define LADSPA_RDF_PORT_DEFAULT 0x2
54 #define LADSPA_RDF_PORT_LABEL 0x4
56 #define LADSPA_RDF_PORT_HAS_UNIT(x) ((x) & LADSPA_RDF_PORT_UNIT)
57 #define LADSPA_RDF_PORT_HAS_DEFAULT(x) ((x) & LADSPA_RDF_PORT_DEFAULT)
58 #define LADSPA_RDF_PORT_HAS_LABEL(x) ((x) & LADSPA_RDF_PORT_LABEL)
60 // Plugin Types
61 #define LADSPA_RDF_PLUGIN_UTILITY 0x000000001LL
62 #define LADSPA_RDF_PLUGIN_GENERATOR 0x000000002LL
63 #define LADSPA_RDF_PLUGIN_SIMULATOR 0x000000004LL
64 #define LADSPA_RDF_PLUGIN_OSCILLATOR 0x000000008LL
65 #define LADSPA_RDF_PLUGIN_TIME 0x000000010LL
66 #define LADSPA_RDF_PLUGIN_DELAY 0x000000020LL
67 #define LADSPA_RDF_PLUGIN_PHASER 0x000000040LL
68 #define LADSPA_RDF_PLUGIN_FLANGER 0x000000080LL
69 #define LADSPA_RDF_PLUGIN_CHORUS 0x000000100LL
70 #define LADSPA_RDF_PLUGIN_REVERB 0x000000200LL
71 #define LADSPA_RDF_PLUGIN_FREQUENCY 0x000000400LL
72 #define LADSPA_RDF_PLUGIN_FREQUENCY_METER 0x000000800LL
73 #define LADSPA_RDF_PLUGIN_FILTER 0x000001000LL
74 #define LADSPA_RDF_PLUGIN_LOWPASS 0x000002000LL
75 #define LADSPA_RDF_PLUGIN_HIGHPASS 0x000004000LL
76 #define LADSPA_RDF_PLUGIN_BANDPASS 0x000008000LL
77 #define LADSPA_RDF_PLUGIN_COMB 0x000010000LL
78 #define LADSPA_RDF_PLUGIN_ALLPASS 0x000020000LL
79 #define LADSPA_RDF_PLUGIN_EQ 0x000040000LL
80 #define LADSPA_RDF_PLUGIN_PARAEQ 0x000080000LL
81 #define LADSPA_RDF_PLUGIN_MULTIEQ 0x000100000LL
82 #define LADSPA_RDF_PLUGIN_AMPLITUDE 0x000200000LL
83 #define LADSPA_RDF_PLUGIN_PITCH 0x000400000LL
84 #define LADSPA_RDF_PLUGIN_AMPLIFIER 0x000800000LL
85 #define LADSPA_RDF_PLUGIN_WAVESHAPER 0x001000000LL
86 #define LADSPA_RDF_PLUGIN_MODULATOR 0x002000000LL
87 #define LADSPA_RDF_PLUGIN_DISTORTION 0x004000000LL
88 #define LADSPA_RDF_PLUGIN_DYNAMICS 0x008000000LL
89 #define LADSPA_RDF_PLUGIN_COMPRESSOR 0x010000000LL
90 #define LADSPA_RDF_PLUGIN_EXPANDER 0x020000000LL
91 #define LADSPA_RDF_PLUGIN_LIMITER 0x040000000LL
92 #define LADSPA_RDF_PLUGIN_GATE 0x080000000LL
93 #define LADSPA_RDF_PLUGIN_SPECTRAL 0x100000000LL
94 #define LADSPA_RDF_PLUGIN_NOTCH 0x200000000LL
96 #define LADSPA_RDF_GROUP_DYNAMICS (LADSPA_RDF_PLUGIN_DYNAMICS|LADSPA_RDF_PLUGIN_COMPRESSOR|LADSPA_RDF_PLUGIN_EXPANDER|LADSPA_RDF_PLUGIN_LIMITER|LADSPA_RDF_PLUGIN_GATE)
97 #define LADSPA_RDF_GROUP_AMPLITUDE (LADSPA_RDF_PLUGIN_AMPLITUDE|LADSPA_RDF_PLUGIN_AMPLIFIER|LADSPA_RDF_PLUGIN_WAVESHAPER|LADSPA_RDF_PLUGIN_MODULATOR|LADSPA_RDF_PLUGIN_DISTORTION|LADSPA_RDF_GROUP_DYNAMICS)
98 #define LADSPA_RDF_GROUP_EQ (LADSPA_RDF_PLUGIN_EQ|LADSPA_RDF_PLUGIN_PARAEQ|LADSPA_RDF_PLUGIN_MULTIEQ)
99 #define LADSPA_RDF_GROUP_FILTER (LADSPA_RDF_PLUGIN_FILTER|LADSPA_RDF_PLUGIN_LOWPASS|LADSPA_RDF_PLUGIN_HIGHPASS|LADSPA_RDF_PLUGIN_BANDPASS|LADSPA_RDF_PLUGIN_COMB|LADSPA_RDF_PLUGIN_ALLPASS|LADSPA_RDF_PLUGIN_NOTCH)
100 #define LADSPA_RDF_GROUP_FREQUENCY (LADSPA_RDF_PLUGIN_FREQUENCY|LADSPA_RDF_PLUGIN_FREQUENCY_METER|LADSPA_RDF_GROUP_FILTER|LADSPA_RDF_GROUP_EQ|LADSPA_RDF_PLUGIN_PITCH)
101 #define LADSPA_RDF_GROUP_SIMULATOR (LADSPA_RDF_PLUGIN_SIMULATOR|LADSPA_RDF_PLUGIN_REVERB)
102 #define LADSPA_RDF_GROUP_TIME (LADSPA_RDF_PLUGIN_TIME|LADSPA_RDF_PLUGIN_DELAY|LADSPA_RDF_PLUGIN_PHASER|LADSPA_RDF_PLUGIN_FLANGER|LADSPA_RDF_PLUGIN_CHORUS|LADSPA_RDF_PLUGIN_REVERB)
103 #define LADSPA_RDF_GROUP_GENERATOR (LADSPA_RDF_PLUGIN_GENERATOR|LADSPA_RDF_PLUGIN_OSCILLATOR)
105 #define LADSPA_RDF_IS_PLUGIN_DYNAMICS(x) ((x) & LADSPA_RDF_GROUP_DYNAMICS)
106 #define LADSPA_RDF_IS_PLUGIN_AMPLITUDE(x) ((x) & LADSPA_RDF_GROUP_AMPLITUDE)
107 #define LADSPA_RDF_IS_PLUGIN_EQ(x) ((x) & LADSPA_RDF_GROUP_EQ)
108 #define LADSPA_RDF_IS_PLUGIN_FILTER(x) ((x) & LADSPA_RDF_GROUP_FILTER)
109 #define LADSPA_RDF_IS_PLUGIN_FREQUENCY(x) ((x) & LADSPA_RDF_GROUP_FREQUENCY)
110 #define LADSPA_RDF_IS_PLUGIN_SIMULATOR(x) ((x) & LADSPA_RDF_GROUP_SIMULATOR)
111 #define LADSPA_RDF_IS_PLUGIN_TIME(x) ((x) & LADSPA_RDF_GROUP_TIME)
112 #define LADSPA_RDF_IS_PLUGIN_GENERATOR(x) ((x) & LADSPA_RDF_GROUP_GENERATOR)
114 // Scale Point
115 struct LADSPA_RDF_ScalePoint {
116 LADSPA_Data Value;
117 const char* Label;
119 LADSPA_RDF_ScalePoint() noexcept
120 : Value(0.0f),
121 Label(nullptr) {}
123 ~LADSPA_RDF_ScalePoint() noexcept
125 if (Label != nullptr)
127 delete[] Label;
128 Label = nullptr;
132 CARLA_DECLARE_NON_COPYABLE(LADSPA_RDF_ScalePoint)
135 // Port
136 struct LADSPA_RDF_Port {
137 LADSPA_RDF_Property Type;
138 LADSPA_RDF_Property Hints;
139 const char* Label;
140 LADSPA_Data Default;
141 LADSPA_RDF_Property Unit;
143 unsigned long ScalePointCount;
144 LADSPA_RDF_ScalePoint* ScalePoints;
146 LADSPA_RDF_Port() noexcept
147 : Type(0x0),
148 Hints(0x0),
149 Label(nullptr),
150 Default(0.0f),
151 Unit(0),
152 ScalePointCount(0),
153 ScalePoints(nullptr) {}
155 ~LADSPA_RDF_Port() noexcept
157 if (Label != nullptr)
159 delete[] Label;
160 Label = nullptr;
162 if (ScalePoints != nullptr)
164 delete[] ScalePoints;
165 ScalePoints = nullptr;
169 CARLA_DECLARE_NON_COPYABLE(LADSPA_RDF_Port)
172 // Plugin Descriptor
173 struct LADSPA_RDF_Descriptor {
174 LADSPA_RDF_PluginType Type;
175 unsigned long UniqueID;
176 const char* Title;
177 const char* Creator;
179 unsigned long PortCount;
180 LADSPA_RDF_Port* Ports;
182 LADSPA_RDF_Descriptor() noexcept
183 : Type(0x0),
184 UniqueID(0),
185 Title(nullptr),
186 Creator(nullptr),
187 PortCount(0),
188 Ports(nullptr) {}
190 ~LADSPA_RDF_Descriptor() noexcept
192 if (Title != nullptr)
194 delete[] Title;
195 Title = nullptr;
197 if (Creator != nullptr)
199 delete[] Creator;
200 Creator = nullptr;
202 if (Ports != nullptr)
204 delete[] Ports;
205 Ports = nullptr;
209 CARLA_DECLARE_NON_COPYABLE(LADSPA_RDF_Descriptor)
212 #endif // LADSPA_RDF_HPP_INCLUDED