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.

701 lines
24KB

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