Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

854 lines
27KB

  1. /*
  2. * Custom types to store LV2 information
  3. * Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
  4. *
  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.
  9. *
  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.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #ifndef LV2_RDF_HPP_INCLUDED
  18. #define LV2_RDF_HPP_INCLUDED
  19. #include "CarlaDefines.h"
  20. #ifdef CARLA_PROPER_CPP11_SUPPORT
  21. # include <cstdint>
  22. #else
  23. # include <stdint.h>
  24. #endif
  25. // Base Types
  26. typedef const char* LV2_URI;
  27. typedef uint32_t LV2_Property;
  28. #define LV2UI_INVALID_PORT_INDEX ((uint32_t)-1)
  29. // Parameter FLAGS
  30. #define LV2_PARAMETER_FLAG_INPUT 0x1
  31. #define LV2_PARAMETER_FLAG_OUTPUT 0x2
  32. // Parameter Types
  33. #define LV2_PARAMETER_TYPE_BOOL 1
  34. #define LV2_PARAMETER_TYPE_INT 2
  35. #define LV2_PARAMETER_TYPE_LONG 3
  36. #define LV2_PARAMETER_TYPE_FLOAT 4
  37. #define LV2_PARAMETER_TYPE_DOUBLE 5
  38. #define LV2_PARAMETER_TYPE_PATH 6
  39. #define LV2_PARAMETER_TYPE_STRING 7
  40. // Port Midi Map Types
  41. #define LV2_PORT_MIDI_MAP_CC 1
  42. #define LV2_PORT_MIDI_MAP_NRPN 2
  43. #define LV2_IS_PORT_MIDI_MAP_CC(x) ((x) == LV2_PORT_MIDI_MAP_CC)
  44. #define LV2_IS_PORT_MIDI_MAP_NRPN(x) ((x) == LV2_PORT_MIDI_MAP_NRPN)
  45. // Port Point Hints
  46. #define LV2_PORT_POINT_DEFAULT 0x1
  47. #define LV2_PORT_POINT_MINIMUM 0x2
  48. #define LV2_PORT_POINT_MAXIMUM 0x4
  49. #define LV2_HAVE_DEFAULT_PORT_POINT(x) ((x) & LV2_PORT_POINT_DEFAULT)
  50. #define LV2_HAVE_MINIMUM_PORT_POINT(x) ((x) & LV2_PORT_POINT_MINIMUM)
  51. #define LV2_HAVE_MAXIMUM_PORT_POINT(x) ((x) & LV2_PORT_POINT_MAXIMUM)
  52. // Port Unit Hints
  53. #define LV2_PORT_UNIT_NAME 0x1
  54. #define LV2_PORT_UNIT_RENDER 0x2
  55. #define LV2_PORT_UNIT_SYMBOL 0x4
  56. #define LV2_PORT_UNIT_UNIT 0x8
  57. #define LV2_HAVE_PORT_UNIT_NAME(x) ((x) & LV2_PORT_UNIT_NAME)
  58. #define LV2_HAVE_PORT_UNIT_RENDER(x) ((x) & LV2_PORT_UNIT_RENDER)
  59. #define LV2_HAVE_PORT_UNIT_SYMBOL(x) ((x) & LV2_PORT_UNIT_SYMBOL)
  60. #define LV2_HAVE_PORT_UNIT_UNIT(x) ((x) & LV2_PORT_UNIT_UNIT)
  61. // Port Unit Unit
  62. #define LV2_PORT_UNIT_BAR 1
  63. #define LV2_PORT_UNIT_BEAT 2
  64. #define LV2_PORT_UNIT_BPM 3
  65. #define LV2_PORT_UNIT_CENT 4
  66. #define LV2_PORT_UNIT_CM 5
  67. #define LV2_PORT_UNIT_COEF 6
  68. #define LV2_PORT_UNIT_DB 7
  69. #define LV2_PORT_UNIT_DEGREE 8
  70. #define LV2_PORT_UNIT_FRAME 9
  71. #define LV2_PORT_UNIT_HZ 10
  72. #define LV2_PORT_UNIT_INCH 11
  73. #define LV2_PORT_UNIT_KHZ 12
  74. #define LV2_PORT_UNIT_KM 13
  75. #define LV2_PORT_UNIT_M 14
  76. #define LV2_PORT_UNIT_MHZ 15
  77. #define LV2_PORT_UNIT_MIDINOTE 16
  78. #define LV2_PORT_UNIT_MILE 17
  79. #define LV2_PORT_UNIT_MIN 18
  80. #define LV2_PORT_UNIT_MM 19
  81. #define LV2_PORT_UNIT_MS 20
  82. #define LV2_PORT_UNIT_OCT 21
  83. #define LV2_PORT_UNIT_PC 22
  84. #define LV2_PORT_UNIT_S 23
  85. #define LV2_PORT_UNIT_SEMITONE 24
  86. #define LV2_IS_PORT_UNIT_BAR(x) ((x) == LV2_PORT_UNIT_BAR)
  87. #define LV2_IS_PORT_UNIT_BEAT(x) ((x) == LV2_PORT_UNIT_BEAT)
  88. #define LV2_IS_PORT_UNIT_BPM(x) ((x) == LV2_PORT_UNIT_BPM)
  89. #define LV2_IS_PORT_UNIT_CENT(x) ((x) == LV2_PORT_UNIT_CENT)
  90. #define LV2_IS_PORT_UNIT_CM(x) ((x) == LV2_PORT_UNIT_CM)
  91. #define LV2_IS_PORT_UNIT_COEF(x) ((x) == LV2_PORT_UNIT_COEF)
  92. #define LV2_IS_PORT_UNIT_DB(x) ((x) == LV2_PORT_UNIT_DB)
  93. #define LV2_IS_PORT_UNIT_DEGREE(x) ((x) == LV2_PORT_UNIT_DEGREE)
  94. #define LV2_IS_PORT_UNIT_FRAME(x) ((x) == LV2_PORT_UNIT_FRAME)
  95. #define LV2_IS_PORT_UNIT_HZ(x) ((x) == LV2_PORT_UNIT_HZ)
  96. #define LV2_IS_PORT_UNIT_INCH(x) ((x) == LV2_PORT_UNIT_INCH)
  97. #define LV2_IS_PORT_UNIT_KHZ(x) ((x) == LV2_PORT_UNIT_KHZ)
  98. #define LV2_IS_PORT_UNIT_KM(x) ((x) == LV2_PORT_UNIT_KM)
  99. #define LV2_IS_PORT_UNIT_M(x) ((x) == LV2_PORT_UNIT_M)
  100. #define LV2_IS_PORT_UNIT_MHZ(x) ((x) == LV2_PORT_UNIT_MHZ)
  101. #define LV2_IS_PORT_UNIT_MIDINOTE(x) ((x) == LV2_PORT_UNIT_MIDINOTE)
  102. #define LV2_IS_PORT_UNIT_MILE(x) ((x) == LV2_PORT_UNIT_MILE)
  103. #define LV2_IS_PORT_UNIT_MIN(x) ((x) == LV2_PORT_UNIT_MIN)
  104. #define LV2_IS_PORT_UNIT_MM(x) ((x) == LV2_PORT_UNIT_MM)
  105. #define LV2_IS_PORT_UNIT_MS(x) ((x) == LV2_PORT_UNIT_MS)
  106. #define LV2_IS_PORT_UNIT_OCT(x) ((x) == LV2_PORT_UNIT_OCT)
  107. #define LV2_IS_PORT_UNIT_PC(x) ((x) == LV2_PORT_UNIT_PC)
  108. #define LV2_IS_PORT_UNIT_S(x) ((x) == LV2_PORT_UNIT_S)
  109. #define LV2_IS_PORT_UNIT_SEMITONE(x) ((x) == LV2_PORT_UNIT_SEMITONE)
  110. // Port Types
  111. #define LV2_PORT_INPUT 0x001
  112. #define LV2_PORT_OUTPUT 0x002
  113. #define LV2_PORT_CONTROL 0x004
  114. #define LV2_PORT_AUDIO 0x008
  115. #define LV2_PORT_CV 0x010
  116. #define LV2_PORT_ATOM 0x020
  117. #define LV2_PORT_ATOM_SEQUENCE (0x040 | LV2_PORT_ATOM)
  118. #define LV2_PORT_EVENT 0x080
  119. #define LV2_PORT_MIDI_LL 0x100
  120. // Port Data Types
  121. #define LV2_PORT_DATA_MIDI_EVENT 0x1000
  122. #define LV2_PORT_DATA_OSC_EVENT 0x2000
  123. #define LV2_PORT_DATA_PATCH_MESSAGE 0x4000
  124. #define LV2_PORT_DATA_TIME_POSITION 0x8000
  125. #define LV2_IS_PORT_INPUT(x) ((x) & LV2_PORT_INPUT)
  126. #define LV2_IS_PORT_OUTPUT(x) ((x) & LV2_PORT_OUTPUT)
  127. #define LV2_IS_PORT_CONTROL(x) ((x) & LV2_PORT_CONTROL)
  128. #define LV2_IS_PORT_AUDIO(x) ((x) & LV2_PORT_AUDIO)
  129. #define LV2_IS_PORT_CV(x) ((x) & LV2_PORT_CV)
  130. #define LV2_IS_PORT_ATOM_SEQUENCE(x) ((x) & LV2_PORT_ATOM_SEQUENCE)
  131. #define LV2_IS_PORT_EVENT(x) ((x) & LV2_PORT_EVENT)
  132. #define LV2_IS_PORT_MIDI_LL(x) ((x) & LV2_PORT_MIDI_LL)
  133. #define LV2_PORT_SUPPORTS_MIDI_EVENT(x) ((x) & LV2_PORT_DATA_MIDI_EVENT)
  134. #define LV2_PORT_SUPPORTS_OSC_EVENT(x) ((x) & LV2_PORT_DATA_OSC_EVENT)
  135. #define LV2_PORT_SUPPORTS_PATCH_MESSAGE(x) ((x) & LV2_PORT_DATA_PATCH_MESSAGE)
  136. #define LV2_PORT_SUPPORTS_TIME_POSITION(x) ((x) & LV2_PORT_DATA_TIME_POSITION)
  137. // Port Properties
  138. #define LV2_PORT_OPTIONAL 0x0001
  139. #define LV2_PORT_ENUMERATION 0x0002
  140. #define LV2_PORT_INTEGER 0x0004
  141. #define LV2_PORT_SAMPLE_RATE 0x0008
  142. #define LV2_PORT_TOGGLED 0x0010
  143. #define LV2_PORT_CAUSES_ARTIFACTS 0x0020
  144. #define LV2_PORT_CONTINUOUS_CV 0x0040
  145. #define LV2_PORT_DISCRETE_CV 0x0080
  146. #define LV2_PORT_EXPENSIVE 0x0100
  147. #define LV2_PORT_STRICT_BOUNDS 0x0200
  148. #define LV2_PORT_LOGARITHMIC 0x0400
  149. #define LV2_PORT_NOT_AUTOMATIC 0x0800
  150. #define LV2_PORT_NOT_ON_GUI 0x1000
  151. #define LV2_PORT_TRIGGER 0x2000
  152. #define LV2_PORT_NON_AUTOMABLE 0x4000
  153. #define LV2_IS_PORT_OPTIONAL(x) ((x) & LV2_PORT_OPTIONAL)
  154. #define LV2_IS_PORT_ENUMERATION(x) ((x) & LV2_PORT_ENUMERATION)
  155. #define LV2_IS_PORT_INTEGER(x) ((x) & LV2_PORT_INTEGER)
  156. #define LV2_IS_PORT_SAMPLE_RATE(x) ((x) & LV2_PORT_SAMPLE_RATE)
  157. #define LV2_IS_PORT_TOGGLED(x) ((x) & LV2_PORT_TOGGLED)
  158. #define LV2_IS_PORT_CAUSES_ARTIFACTS(x) ((x) & LV2_PORT_CAUSES_ARTIFACTS)
  159. #define LV2_IS_PORT_CONTINUOUS_CV(x) ((x) & LV2_PORT_CONTINUOUS_CV)
  160. #define LV2_IS_PORT_DISCRETE_CV(x) ((x) & LV2_PORT_DISCRETE_CV)
  161. #define LV2_IS_PORT_EXPENSIVE(x) ((x) & LV2_PORT_EXPENSIVE)
  162. #define LV2_IS_PORT_STRICT_BOUNDS(x) ((x) & LV2_PORT_STRICT_BOUNDS)
  163. #define LV2_IS_PORT_LOGARITHMIC(x) ((x) & LV2_PORT_LOGARITHMIC)
  164. #define LV2_IS_PORT_NOT_AUTOMATIC(x) ((x) & LV2_PORT_NOT_AUTOMATIC)
  165. #define LV2_IS_PORT_NOT_ON_GUI(x) ((x) & LV2_PORT_NOT_ON_GUI)
  166. #define LV2_IS_PORT_TRIGGER(x) ((x) & LV2_PORT_TRIGGER)
  167. #define LV2_IS_PORT_NON_AUTOMABLE(x) ((x) & LV2_PORT_NON_AUTOMABLE)
  168. // Port Designation
  169. #define LV2_PORT_DESIGNATION_CONTROL 1
  170. #define LV2_PORT_DESIGNATION_ENABLED 2
  171. #define LV2_PORT_DESIGNATION_FREEWHEELING 3
  172. #define LV2_PORT_DESIGNATION_LATENCY 4
  173. #define LV2_PORT_DESIGNATION_SAMPLE_RATE 5
  174. #define LV2_PORT_DESIGNATION_TIME_BAR 6
  175. #define LV2_PORT_DESIGNATION_TIME_BAR_BEAT 7
  176. #define LV2_PORT_DESIGNATION_TIME_BEAT 8
  177. #define LV2_PORT_DESIGNATION_TIME_BEAT_UNIT 9
  178. #define LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR 10
  179. #define LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE 11
  180. #define LV2_PORT_DESIGNATION_TIME_FRAME 12
  181. #define LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND 13
  182. #define LV2_PORT_DESIGNATION_TIME_SPEED 14
  183. #define LV2_PORT_DESIGNATION_TIME_TICKS_PER_BEAT 15
  184. #define LV2_IS_PORT_DESIGNATION_CONTROL(x) ((x) == LV2_PORT_DESIGNATION_CONTROL)
  185. #define LV2_IS_PORT_DESIGNATION_ENABLED(x) ((x) == LV2_PORT_DESIGNATION_ENABLED)
  186. #define LV2_IS_PORT_DESIGNATION_FREEWHEELING(x) ((x) == LV2_PORT_DESIGNATION_FREEWHEELING)
  187. #define LV2_IS_PORT_DESIGNATION_LATENCY(x) ((x) == LV2_PORT_DESIGNATION_LATENCY)
  188. #define LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(x) ((x) == LV2_PORT_DESIGNATION_SAMPLE_RATE)
  189. #define LV2_IS_PORT_DESIGNATION_TIME_BAR(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR)
  190. #define LV2_IS_PORT_DESIGNATION_TIME_BAR_BEAT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR_BEAT)
  191. #define LV2_IS_PORT_DESIGNATION_TIME_BEAT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEAT)
  192. #define LV2_IS_PORT_DESIGNATION_TIME_BEAT_UNIT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEAT_UNIT)
  193. #define LV2_IS_PORT_DESIGNATION_TIME_BEATS_PER_BAR(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR)
  194. #define LV2_IS_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE)
  195. #define LV2_IS_PORT_DESIGNATION_TIME_FRAME(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAME)
  196. #define LV2_IS_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND)
  197. #define LV2_IS_PORT_DESIGNATION_TIME_SPEED(x) ((x) == LV2_PORT_DESIGNATION_TIME_SPEED)
  198. #define LV2_IS_PORT_DESIGNATION_TIME_TICKS_PER_BEAT(x) ((x) == LV2_PORT_DESIGNATION_TIME_TICKS_PER_BEAT)
  199. #define LV2_IS_PORT_DESIGNATION_TIME(x) ((x) >= LV2_PORT_DESIGNATION_TIME_BAR && (x) <= LV2_PORT_DESIGNATION_TIME_TICKS_PER_BEAT)
  200. // UI Port Protocol
  201. #define LV2_UI_PORT_PROTOCOL_FLOAT 1
  202. #define LV2_UI_PORT_PROTOCOL_PEAK 2
  203. #define LV2_IS_UI_PORT_PROTOCOL_FLOAT(x) ((x) == LV2_UI_PORT_PROTOCOL_FLOAT)
  204. #define LV2_IS_UI_PORT_PROTOCOL_PEAK(x) ((x) == LV2_UI_PORT_PROTOCOL_PEAK)
  205. // UI Types
  206. #define LV2_UI_NONE 0
  207. #define LV2_UI_GTK2 1
  208. #define LV2_UI_GTK3 2
  209. #define LV2_UI_QT4 3
  210. #define LV2_UI_QT5 4
  211. #define LV2_UI_COCOA 5
  212. #define LV2_UI_WINDOWS 6
  213. #define LV2_UI_X11 7
  214. #define LV2_UI_EXTERNAL 8
  215. #define LV2_UI_OLD_EXTERNAL 9
  216. #define LV2_UI_MOD 10
  217. #define LV2_IS_UI_GTK2(x) ((x) == LV2_UI_GTK2)
  218. #define LV2_IS_UI_GTK3(x) ((x) == LV2_UI_GTK3)
  219. #define LV2_IS_UI_QT4(x) ((x) == LV2_UI_QT4)
  220. #define LV2_IS_UI_QT5(x) ((x) == LV2_UI_QT5)
  221. #define LV2_IS_UI_COCOA(x) ((x) == LV2_UI_COCOA)
  222. #define LV2_IS_UI_WINDOWS(x) ((x) == LV2_UI_WINDOWS)
  223. #define LV2_IS_UI_X11(x) ((x) == LV2_UI_X11)
  224. #define LV2_IS_UI_EXTERNAL(x) ((x) == LV2_UI_EXTERNAL)
  225. #define LV2_IS_UI_OLD_EXTERNAL(x) ((x) == LV2_UI_OLD_EXTERNAL)
  226. #define LV2_IS_UI_MOD(x) ((x) == LV2_UI_MOD)
  227. // Plugin Types
  228. #define LV2_PLUGIN_DELAY 0x000001
  229. #define LV2_PLUGIN_REVERB 0x000002
  230. #define LV2_PLUGIN_SIMULATOR 0x000004
  231. #define LV2_PLUGIN_DISTORTION 0x000008
  232. #define LV2_PLUGIN_WAVESHAPER 0x000010
  233. #define LV2_PLUGIN_DYNAMICS 0x000020
  234. #define LV2_PLUGIN_AMPLIFIER 0x000040
  235. #define LV2_PLUGIN_COMPRESSOR 0x000080
  236. #define LV2_PLUGIN_ENVELOPE 0x000100
  237. #define LV2_PLUGIN_EXPANDER 0x000200
  238. #define LV2_PLUGIN_GATE 0x000400
  239. #define LV2_PLUGIN_LIMITER 0x000800
  240. #define LV2_PLUGIN_EQ 0x001000
  241. #define LV2_PLUGIN_MULTI_EQ 0x002000
  242. #define LV2_PLUGIN_PARA_EQ 0x004000
  243. #define LV2_PLUGIN_FILTER 0x008000
  244. #define LV2_PLUGIN_ALLPASS 0x010000
  245. #define LV2_PLUGIN_BANDPASS 0x020000
  246. #define LV2_PLUGIN_COMB 0x040000
  247. #define LV2_PLUGIN_HIGHPASS 0x080000
  248. #define LV2_PLUGIN_LOWPASS 0x100000
  249. #define LV2_PLUGIN_GENERATOR 0x000001
  250. #define LV2_PLUGIN_CONSTANT 0x000002
  251. #define LV2_PLUGIN_INSTRUMENT 0x000004
  252. #define LV2_PLUGIN_OSCILLATOR 0x000008
  253. #define LV2_PLUGIN_MODULATOR 0x000010
  254. #define LV2_PLUGIN_CHORUS 0x000020
  255. #define LV2_PLUGIN_FLANGER 0x000040
  256. #define LV2_PLUGIN_PHASER 0x000080
  257. #define LV2_PLUGIN_SPATIAL 0x000100
  258. #define LV2_PLUGIN_SPECTRAL 0x000200
  259. #define LV2_PLUGIN_PITCH 0x000400
  260. #define LV2_PLUGIN_UTILITY 0x000800
  261. #define LV2_PLUGIN_ANALYSER 0x001000
  262. #define LV2_PLUGIN_CONVERTER 0x002000
  263. #define LV2_PLUGIN_FUNCTION 0x008000
  264. #define LV2_PLUGIN_MIXER 0x010000
  265. #define LV2_GROUP_DELAY (LV2_PLUGIN_DELAY|LV2_PLUGIN_REVERB)
  266. #define LV2_GROUP_DISTORTION (LV2_PLUGIN_DISTORTION|LV2_PLUGIN_WAVESHAPER)
  267. #define LV2_GROUP_DYNAMICS (LV2_PLUGIN_DYNAMICS|LV2_PLUGIN_AMPLIFIER|LV2_PLUGIN_COMPRESSOR|LV2_PLUGIN_ENVELOPE|LV2_PLUGIN_EXPANDER|LV2_PLUGIN_GATE|LV2_PLUGIN_LIMITER)
  268. #define LV2_GROUP_EQ (LV2_PLUGIN_EQ|LV2_PLUGIN_MULTI_EQ|LV2_PLUGIN_PARA_EQ)
  269. #define LV2_GROUP_FILTER (LV2_PLUGIN_FILTER|LV2_PLUGIN_ALLPASS|LV2_PLUGIN_BANDPASS|LV2_PLUGIN_COMB|LV2_GROUP_EQ|LV2_PLUGIN_HIGHPASS|LV2_PLUGIN_LOWPASS)
  270. #define LV2_GROUP_GENERATOR (LV2_PLUGIN_GENERATOR|LV2_PLUGIN_CONSTANT|LV2_PLUGIN_INSTRUMENT|LV2_PLUGIN_OSCILLATOR)
  271. #define LV2_GROUP_MODULATOR (LV2_PLUGIN_MODULATOR|LV2_PLUGIN_CHORUS|LV2_PLUGIN_FLANGER|LV2_PLUGIN_PHASER)
  272. #define LV2_GROUP_REVERB (LV2_PLUGIN_REVERB)
  273. #define LV2_GROUP_SIMULATOR (LV2_PLUGIN_SIMULATOR|LV2_PLUGIN_REVERB)
  274. #define LV2_GROUP_SPATIAL (LV2_PLUGIN_SPATIAL)
  275. #define LV2_GROUP_SPECTRAL (LV2_PLUGIN_SPECTRAL|LV2_PLUGIN_PITCH)
  276. #define LV2_GROUP_UTILITY (LV2_PLUGIN_UTILITY|LV2_PLUGIN_ANALYSER|LV2_PLUGIN_CONVERTER|LV2_PLUGIN_FUNCTION|LV2_PLUGIN_MIXER)
  277. #define LV2_IS_DELAY(x, y) ((x) & LV2_GROUP_DELAY)
  278. #define LV2_IS_DISTORTION(x, y) ((x) & LV2_GROUP_DISTORTION)
  279. #define LV2_IS_DYNAMICS(x, y) ((x) & LV2_GROUP_DYNAMICS)
  280. #define LV2_IS_EQ(x, y) ((x) & LV2_GROUP_EQ)
  281. #define LV2_IS_FILTER(x, y) ((x) & LV2_GROUP_FILTER)
  282. #define LV2_IS_GENERATOR(x, y) ((y) & LV2_GROUP_GENERATOR)
  283. #define LV2_IS_INSTRUMENT(x, y) ((y) & LV2_PLUGIN_INSTRUMENT)
  284. #define LV2_IS_MODULATOR(x, y) ((y) & LV2_GROUP_MODULATOR)
  285. #define LV2_IS_REVERB(x, y) ((x) & LV2_GROUP_REVERB)
  286. #define LV2_IS_SIMULATOR(x, y) ((x) & LV2_GROUP_SIMULATOR)
  287. #define LV2_IS_SPATIAL(x, y) ((y) & LV2_GROUP_SPATIAL)
  288. #define LV2_IS_SPECTRAL(x, y) ((y) & LV2_GROUP_SPECTRAL)
  289. #define LV2_IS_UTILITY(x, y) ((y) & LV2_GROUP_UTILITY)
  290. // Port Midi Map
  291. struct LV2_RDF_PortMidiMap {
  292. LV2_Property Type;
  293. uint32_t Number;
  294. LV2_RDF_PortMidiMap() noexcept
  295. : Type(0),
  296. Number(0) {}
  297. };
  298. // Port Points
  299. struct LV2_RDF_PortPoints {
  300. LV2_Property Hints;
  301. float Default;
  302. float Minimum;
  303. float Maximum;
  304. LV2_RDF_PortPoints() noexcept
  305. : Hints(0x0),
  306. Default(0.0f),
  307. Minimum(0.0f),
  308. Maximum(1.0f) {}
  309. };
  310. // Port Unit
  311. struct LV2_RDF_PortUnit {
  312. LV2_Property Hints;
  313. const char* Name;
  314. const char* Render;
  315. const char* Symbol;
  316. LV2_Property Unit;
  317. LV2_RDF_PortUnit() noexcept
  318. : Hints(0x0),
  319. Name(nullptr),
  320. Render(nullptr),
  321. Symbol(nullptr),
  322. Unit(0) {}
  323. ~LV2_RDF_PortUnit() noexcept
  324. {
  325. if (Name != nullptr)
  326. {
  327. delete[] Name;
  328. Name = nullptr;
  329. }
  330. if (Render != nullptr)
  331. {
  332. delete[] Render;
  333. Render = nullptr;
  334. }
  335. if (Symbol != nullptr)
  336. {
  337. delete[] Symbol;
  338. Symbol = nullptr;
  339. }
  340. }
  341. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_PortUnit)
  342. };
  343. // Port Scale Point
  344. struct LV2_RDF_PortScalePoint {
  345. const char* Label;
  346. float Value;
  347. LV2_RDF_PortScalePoint() noexcept
  348. : Label(nullptr),
  349. Value(0.0f) {}
  350. ~LV2_RDF_PortScalePoint() noexcept
  351. {
  352. if (Label != nullptr)
  353. {
  354. delete[] Label;
  355. Label = nullptr;
  356. }
  357. }
  358. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_PortScalePoint)
  359. };
  360. // Port
  361. struct LV2_RDF_Port {
  362. LV2_Property Types;
  363. LV2_Property Properties;
  364. LV2_Property Designation;
  365. const char* Name;
  366. const char* Symbol;
  367. const char* Comment;
  368. const char* GroupURI;
  369. LV2_RDF_PortMidiMap MidiMap;
  370. LV2_RDF_PortPoints Points;
  371. LV2_RDF_PortUnit Unit;
  372. uint32_t MinimumSize;
  373. uint32_t ScalePointCount;
  374. LV2_RDF_PortScalePoint* ScalePoints;
  375. LV2_RDF_Port() noexcept
  376. : Types(0x0),
  377. Properties(0x0),
  378. Designation(0),
  379. Name(nullptr),
  380. Symbol(nullptr),
  381. Comment(nullptr),
  382. GroupURI(nullptr),
  383. MidiMap(),
  384. Points(),
  385. Unit(),
  386. MinimumSize(0),
  387. ScalePointCount(0),
  388. ScalePoints(nullptr) {}
  389. ~LV2_RDF_Port() noexcept
  390. {
  391. if (Name != nullptr)
  392. {
  393. delete[] Name;
  394. Name = nullptr;
  395. }
  396. if (Symbol != nullptr)
  397. {
  398. delete[] Symbol;
  399. Symbol = nullptr;
  400. }
  401. if (Comment != nullptr)
  402. {
  403. delete[] Comment;
  404. Comment = nullptr;
  405. }
  406. if (GroupURI != nullptr)
  407. {
  408. delete[] GroupURI;
  409. GroupURI = nullptr;
  410. }
  411. if (ScalePoints != nullptr)
  412. {
  413. delete[] ScalePoints;
  414. ScalePoints = nullptr;
  415. }
  416. }
  417. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Port)
  418. };
  419. // Port
  420. struct LV2_RDF_PortGroup {
  421. LV2_URI URI; // shared value, do not deallocate
  422. const char* Name;
  423. const char* Symbol;
  424. LV2_RDF_PortGroup() noexcept
  425. : URI(nullptr),
  426. Name(nullptr),
  427. Symbol(nullptr) {}
  428. ~LV2_RDF_PortGroup() noexcept
  429. {
  430. if (Name != nullptr)
  431. {
  432. delete[] Name;
  433. Name = nullptr;
  434. }
  435. if (Symbol != nullptr)
  436. {
  437. delete[] Symbol;
  438. Symbol = nullptr;
  439. }
  440. }
  441. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_PortGroup)
  442. };
  443. // Parameter
  444. struct LV2_RDF_Parameter {
  445. LV2_URI URI;
  446. LV2_Property Type;
  447. LV2_Property Flags;
  448. const char* Label;
  449. const char* Comment;
  450. const char* GroupURI;
  451. LV2_RDF_PortMidiMap MidiMap;
  452. LV2_RDF_PortPoints Points;
  453. LV2_RDF_PortUnit Unit;
  454. LV2_RDF_Parameter() noexcept
  455. : URI(nullptr),
  456. Type(0),
  457. Flags(0x0),
  458. Label(nullptr),
  459. Comment(nullptr),
  460. GroupURI(nullptr),
  461. MidiMap(),
  462. Points(),
  463. Unit() {}
  464. ~LV2_RDF_Parameter() noexcept
  465. {
  466. if (URI != nullptr)
  467. {
  468. delete[] URI;
  469. URI = nullptr;
  470. }
  471. if (Label != nullptr)
  472. {
  473. delete[] Label;
  474. Label = nullptr;
  475. }
  476. if (Comment != nullptr)
  477. {
  478. delete[] Comment;
  479. Comment = nullptr;
  480. }
  481. if (GroupURI != nullptr)
  482. {
  483. delete[] GroupURI;
  484. GroupURI = nullptr;
  485. }
  486. }
  487. void copyAndReplace(LV2_RDF_Parameter& other) noexcept
  488. {
  489. URI = other.URI;
  490. Type = other.Type;
  491. Flags = other.Flags;
  492. Label = other.Label;
  493. Comment = other.Comment;
  494. GroupURI = other.GroupURI;
  495. MidiMap = other.MidiMap;
  496. Points = other.Points;
  497. Unit.Hints = other.Unit.Hints;
  498. Unit.Name = other.Unit.Name;
  499. Unit.Render = other.Unit.Render;
  500. Unit.Symbol = other.Unit.Symbol;
  501. Unit.Unit = other.Unit.Unit;
  502. other.URI = nullptr;
  503. other.Label = nullptr;
  504. other.Comment = nullptr;
  505. other.GroupURI = nullptr;
  506. other.Unit.Name = nullptr;
  507. other.Unit.Render = nullptr;
  508. other.Unit.Symbol = nullptr;
  509. }
  510. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Parameter)
  511. };
  512. // Preset
  513. struct LV2_RDF_Preset {
  514. LV2_URI URI;
  515. const char* Label;
  516. LV2_RDF_Preset() noexcept
  517. : URI(nullptr),
  518. Label(nullptr) {}
  519. ~LV2_RDF_Preset() noexcept
  520. {
  521. if (URI != nullptr)
  522. {
  523. delete[] URI;
  524. URI = nullptr;
  525. }
  526. if (Label != nullptr)
  527. {
  528. delete[] Label;
  529. Label = nullptr;
  530. }
  531. }
  532. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Preset)
  533. };
  534. // Feature
  535. struct LV2_RDF_Feature {
  536. bool Required;
  537. LV2_URI URI;
  538. LV2_RDF_Feature() noexcept
  539. : Required(false),
  540. URI(nullptr) {}
  541. ~LV2_RDF_Feature() noexcept
  542. {
  543. if (URI != nullptr)
  544. {
  545. delete[] URI;
  546. URI = nullptr;
  547. }
  548. }
  549. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Feature)
  550. };
  551. // Port Notification
  552. struct LV2_RDF_UI_PortNotification {
  553. const char* Symbol;
  554. uint32_t Index;
  555. LV2_Property Protocol;
  556. LV2_RDF_UI_PortNotification() noexcept
  557. : Symbol(nullptr),
  558. Index(LV2UI_INVALID_PORT_INDEX),
  559. Protocol(0) {}
  560. ~LV2_RDF_UI_PortNotification() noexcept
  561. {
  562. if (Symbol != nullptr)
  563. {
  564. delete[] Symbol;
  565. Symbol = nullptr;
  566. }
  567. }
  568. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_UI_PortNotification)
  569. };
  570. // UI
  571. struct LV2_RDF_UI {
  572. LV2_Property Type;
  573. LV2_URI URI;
  574. const char* Binary;
  575. const char* Bundle;
  576. uint32_t FeatureCount;
  577. LV2_RDF_Feature* Features;
  578. uint32_t ExtensionCount;
  579. LV2_URI* Extensions;
  580. uint32_t PortNotificationCount;
  581. LV2_RDF_UI_PortNotification* PortNotifications;
  582. LV2_RDF_UI() noexcept
  583. : Type(0),
  584. URI(nullptr),
  585. Binary(nullptr),
  586. Bundle(nullptr),
  587. FeatureCount(0),
  588. Features(nullptr),
  589. ExtensionCount(0),
  590. Extensions(nullptr),
  591. PortNotificationCount(0),
  592. PortNotifications(nullptr) {}
  593. ~LV2_RDF_UI() noexcept
  594. {
  595. if (URI != nullptr)
  596. {
  597. delete[] URI;
  598. URI = nullptr;
  599. }
  600. if (Binary != nullptr)
  601. {
  602. delete[] Binary;
  603. Binary = nullptr;
  604. }
  605. if (Bundle != nullptr)
  606. {
  607. delete[] Bundle;
  608. Bundle = nullptr;
  609. }
  610. if (Features != nullptr)
  611. {
  612. delete[] Features;
  613. Features = nullptr;
  614. }
  615. if (Extensions != nullptr)
  616. {
  617. for (uint32_t i=0; i<ExtensionCount; ++i)
  618. {
  619. if (Extensions[i] != nullptr)
  620. {
  621. delete[] Extensions[i];
  622. Extensions[i] = nullptr;
  623. }
  624. }
  625. delete[] Extensions;
  626. Extensions = nullptr;
  627. }
  628. if (PortNotifications != nullptr)
  629. {
  630. delete[] PortNotifications;
  631. PortNotifications = nullptr;
  632. }
  633. }
  634. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_UI)
  635. };
  636. // Plugin Descriptor
  637. struct LV2_RDF_Descriptor {
  638. LV2_Property Type[2];
  639. LV2_URI URI;
  640. const char* Name;
  641. const char* Author;
  642. const char* License;
  643. const char* Binary;
  644. const char* Bundle;
  645. ulong UniqueID;
  646. uint32_t PortCount;
  647. LV2_RDF_Port* Ports;
  648. uint32_t PortGroupCount;
  649. LV2_RDF_PortGroup* PortGroups;
  650. uint32_t ParameterCount;
  651. LV2_RDF_Parameter* Parameters;
  652. uint32_t PresetCount;
  653. LV2_RDF_Preset* Presets;
  654. uint32_t FeatureCount;
  655. LV2_RDF_Feature* Features;
  656. uint32_t ExtensionCount;
  657. LV2_URI* Extensions;
  658. uint32_t UICount;
  659. LV2_RDF_UI* UIs;
  660. LV2_RDF_Descriptor() noexcept
  661. : URI(nullptr),
  662. Name(nullptr),
  663. Author(nullptr),
  664. License(nullptr),
  665. Binary(nullptr),
  666. Bundle(nullptr),
  667. UniqueID(0),
  668. PortCount(0),
  669. Ports(nullptr),
  670. PortGroupCount(0),
  671. PortGroups(nullptr),
  672. ParameterCount(0),
  673. Parameters(nullptr),
  674. PresetCount(0),
  675. Presets(nullptr),
  676. FeatureCount(0),
  677. Features(nullptr),
  678. ExtensionCount(0),
  679. Extensions(nullptr),
  680. UICount(0),
  681. UIs(nullptr)
  682. {
  683. Type[0] = Type[1] = 0x0;
  684. }
  685. ~LV2_RDF_Descriptor() noexcept
  686. {
  687. if (URI != nullptr)
  688. {
  689. delete[] URI;
  690. URI = nullptr;
  691. }
  692. if (Name != nullptr)
  693. {
  694. delete[] Name;
  695. Name = nullptr;
  696. }
  697. if (Author != nullptr)
  698. {
  699. delete[] Author;
  700. Author = nullptr;
  701. }
  702. if (License != nullptr)
  703. {
  704. delete[] License;
  705. License = nullptr;
  706. }
  707. if (Binary != nullptr)
  708. {
  709. delete[] Binary;
  710. Binary = nullptr;
  711. }
  712. if (Bundle != nullptr)
  713. {
  714. delete[] Bundle;
  715. Bundle = nullptr;
  716. }
  717. if (Ports != nullptr)
  718. {
  719. delete[] Ports;
  720. Ports = nullptr;
  721. }
  722. if (PortGroups != nullptr)
  723. {
  724. delete[] PortGroups;
  725. PortGroups = nullptr;
  726. }
  727. if (Parameters != nullptr)
  728. {
  729. delete[] Parameters;
  730. Parameters = nullptr;
  731. }
  732. if (Presets != nullptr)
  733. {
  734. delete[] Presets;
  735. Presets = nullptr;
  736. }
  737. if (Features != nullptr)
  738. {
  739. delete[] Features;
  740. Features = nullptr;
  741. }
  742. if (Extensions != nullptr)
  743. {
  744. for (uint32_t i=0; i<ExtensionCount; ++i)
  745. {
  746. if (Extensions[i] != nullptr)
  747. {
  748. delete[] Extensions[i];
  749. Extensions[i] = nullptr;
  750. }
  751. }
  752. delete[] Extensions;
  753. Extensions = nullptr;
  754. }
  755. if (UIs != nullptr)
  756. {
  757. delete[] UIs;
  758. UIs = nullptr;
  759. }
  760. }
  761. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Descriptor)
  762. };
  763. #endif // LV2_RDF_HPP_INCLUDED