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.

767 lines
25KB

  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. // 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. const char* Comment;
  354. LV2_RDF_PortMidiMap MidiMap;
  355. LV2_RDF_PortPoints Points;
  356. LV2_RDF_PortUnit Unit;
  357. uint32_t MinimumSize;
  358. uint32_t ScalePointCount;
  359. LV2_RDF_PortScalePoint* ScalePoints;
  360. LV2_RDF_Port() noexcept
  361. : Types(0x0),
  362. Properties(0x0),
  363. Designation(0),
  364. Name(nullptr),
  365. Symbol(nullptr),
  366. Comment(nullptr),
  367. MidiMap(),
  368. Points(),
  369. Unit(),
  370. MinimumSize(0),
  371. ScalePointCount(0),
  372. ScalePoints(nullptr) {}
  373. ~LV2_RDF_Port() noexcept
  374. {
  375. if (Name != nullptr)
  376. {
  377. delete[] Name;
  378. Name = nullptr;
  379. }
  380. if (Symbol != nullptr)
  381. {
  382. delete[] Symbol;
  383. Symbol = nullptr;
  384. }
  385. if (Comment != nullptr)
  386. {
  387. delete[] Comment;
  388. Comment = nullptr;
  389. }
  390. if (ScalePoints != nullptr)
  391. {
  392. delete[] ScalePoints;
  393. ScalePoints = nullptr;
  394. }
  395. }
  396. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Port)
  397. };
  398. // Parameter
  399. struct LV2_RDF_Parameter {
  400. LV2_URI URI;
  401. LV2_URI Range;
  402. bool Input;
  403. const char* Label;
  404. const char* Comment;
  405. LV2_RDF_PortMidiMap MidiMap;
  406. LV2_RDF_PortPoints Points;
  407. LV2_RDF_PortUnit Unit;
  408. LV2_RDF_Parameter() noexcept
  409. : URI(nullptr),
  410. Range(nullptr),
  411. Input(true),
  412. Label(nullptr),
  413. Comment(nullptr),
  414. MidiMap(),
  415. Points(),
  416. Unit() {}
  417. ~LV2_RDF_Parameter() noexcept
  418. {
  419. if (URI != nullptr)
  420. {
  421. delete[] URI;
  422. URI = nullptr;
  423. }
  424. if (Range != nullptr)
  425. {
  426. delete[] Range;
  427. Range = nullptr;
  428. }
  429. if (Label != nullptr)
  430. {
  431. delete[] Label;
  432. Label = nullptr;
  433. }
  434. if (Comment != nullptr)
  435. {
  436. delete[] Comment;
  437. Comment = nullptr;
  438. }
  439. }
  440. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Parameter)
  441. };
  442. // Preset
  443. struct LV2_RDF_Preset {
  444. LV2_URI URI;
  445. const char* Label;
  446. LV2_RDF_Preset() noexcept
  447. : URI(nullptr),
  448. Label(nullptr) {}
  449. ~LV2_RDF_Preset() noexcept
  450. {
  451. if (URI != nullptr)
  452. {
  453. delete[] URI;
  454. URI = nullptr;
  455. }
  456. if (Label != nullptr)
  457. {
  458. delete[] Label;
  459. Label = nullptr;
  460. }
  461. }
  462. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Preset)
  463. };
  464. // Feature
  465. struct LV2_RDF_Feature {
  466. bool Required;
  467. LV2_URI URI;
  468. LV2_RDF_Feature() noexcept
  469. : Required(false),
  470. URI(nullptr) {}
  471. ~LV2_RDF_Feature() noexcept
  472. {
  473. if (URI != nullptr)
  474. {
  475. delete[] URI;
  476. URI = nullptr;
  477. }
  478. }
  479. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Feature)
  480. };
  481. // Port Notification
  482. struct LV2_RDF_UI_PortNotification {
  483. const char* Symbol;
  484. uint32_t Index;
  485. LV2_Property Protocol;
  486. LV2_RDF_UI_PortNotification() noexcept
  487. : Symbol(nullptr),
  488. Index(LV2UI_INVALID_PORT_INDEX),
  489. Protocol(0) {}
  490. ~LV2_RDF_UI_PortNotification() noexcept
  491. {
  492. if (Symbol != nullptr)
  493. {
  494. delete[] Symbol;
  495. Symbol = nullptr;
  496. }
  497. }
  498. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_UI_PortNotification)
  499. };
  500. // UI
  501. struct LV2_RDF_UI {
  502. LV2_Property Type;
  503. LV2_URI URI;
  504. const char* Binary;
  505. const char* Bundle;
  506. uint32_t FeatureCount;
  507. LV2_RDF_Feature* Features;
  508. uint32_t ExtensionCount;
  509. LV2_URI* Extensions;
  510. uint32_t PortNotificationCount;
  511. LV2_RDF_UI_PortNotification* PortNotifications;
  512. LV2_RDF_UI() noexcept
  513. : Type(0),
  514. URI(nullptr),
  515. Binary(nullptr),
  516. Bundle(nullptr),
  517. FeatureCount(0),
  518. Features(nullptr),
  519. ExtensionCount(0),
  520. Extensions(nullptr),
  521. PortNotificationCount(0),
  522. PortNotifications(nullptr) {}
  523. ~LV2_RDF_UI() noexcept
  524. {
  525. if (URI != nullptr)
  526. {
  527. delete[] URI;
  528. URI = nullptr;
  529. }
  530. if (Binary != nullptr)
  531. {
  532. delete[] Binary;
  533. Binary = nullptr;
  534. }
  535. if (Bundle != nullptr)
  536. {
  537. delete[] Bundle;
  538. Bundle = nullptr;
  539. }
  540. if (Features != nullptr)
  541. {
  542. delete[] Features;
  543. Features = nullptr;
  544. }
  545. if (Extensions != nullptr)
  546. {
  547. for (uint32_t i=0; i<ExtensionCount; ++i)
  548. {
  549. if (Extensions[i] != nullptr)
  550. {
  551. delete[] Extensions[i];
  552. Extensions[i] = nullptr;
  553. }
  554. }
  555. delete[] Extensions;
  556. Extensions = nullptr;
  557. }
  558. if (PortNotifications != nullptr)
  559. {
  560. delete[] PortNotifications;
  561. PortNotifications = nullptr;
  562. }
  563. }
  564. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_UI)
  565. };
  566. // Plugin Descriptor
  567. struct LV2_RDF_Descriptor {
  568. LV2_Property Type[2];
  569. LV2_URI URI;
  570. const char* Name;
  571. const char* Author;
  572. const char* License;
  573. const char* Binary;
  574. const char* Bundle;
  575. ulong UniqueID;
  576. uint32_t PortCount;
  577. LV2_RDF_Port* Ports;
  578. uint32_t ParameterCount;
  579. LV2_RDF_Parameter* Parameters;
  580. uint32_t PresetCount;
  581. LV2_RDF_Preset* Presets;
  582. uint32_t FeatureCount;
  583. LV2_RDF_Feature* Features;
  584. uint32_t ExtensionCount;
  585. LV2_URI* Extensions;
  586. uint32_t UICount;
  587. LV2_RDF_UI* UIs;
  588. LV2_RDF_Descriptor() noexcept
  589. : URI(nullptr),
  590. Name(nullptr),
  591. Author(nullptr),
  592. License(nullptr),
  593. Binary(nullptr),
  594. Bundle(nullptr),
  595. UniqueID(0),
  596. PortCount(0),
  597. Ports(nullptr),
  598. ParameterCount(0),
  599. Parameters(nullptr),
  600. PresetCount(0),
  601. Presets(nullptr),
  602. FeatureCount(0),
  603. Features(nullptr),
  604. ExtensionCount(0),
  605. Extensions(nullptr),
  606. UICount(0),
  607. UIs(nullptr)
  608. {
  609. Type[0] = Type[1] = 0x0;
  610. }
  611. ~LV2_RDF_Descriptor() noexcept
  612. {
  613. if (URI != nullptr)
  614. {
  615. delete[] URI;
  616. URI = nullptr;
  617. }
  618. if (Name != nullptr)
  619. {
  620. delete[] Name;
  621. Name = nullptr;
  622. }
  623. if (Author != nullptr)
  624. {
  625. delete[] Author;
  626. Author = nullptr;
  627. }
  628. if (License != nullptr)
  629. {
  630. delete[] License;
  631. License = nullptr;
  632. }
  633. if (Binary != nullptr)
  634. {
  635. delete[] Binary;
  636. Binary = nullptr;
  637. }
  638. if (Bundle != nullptr)
  639. {
  640. delete[] Bundle;
  641. Bundle = nullptr;
  642. }
  643. if (Ports != nullptr)
  644. {
  645. delete[] Ports;
  646. Ports = nullptr;
  647. }
  648. if (Parameters != nullptr)
  649. {
  650. delete[] Parameters;
  651. Parameters = nullptr;
  652. }
  653. if (Presets != nullptr)
  654. {
  655. delete[] Presets;
  656. Presets = nullptr;
  657. }
  658. if (Features != nullptr)
  659. {
  660. delete[] Features;
  661. Features = nullptr;
  662. }
  663. if (Extensions != nullptr)
  664. {
  665. for (uint32_t i=0; i<ExtensionCount; ++i)
  666. {
  667. if (Extensions[i] != nullptr)
  668. {
  669. delete[] Extensions[i];
  670. Extensions[i] = nullptr;
  671. }
  672. }
  673. delete[] Extensions;
  674. Extensions = nullptr;
  675. }
  676. if (UIs != nullptr)
  677. {
  678. delete[] UIs;
  679. UIs = nullptr;
  680. }
  681. }
  682. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Descriptor)
  683. };
  684. #endif // LV2_RDF_HPP_INCLUDED