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.

764 lines
25KB

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