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.

826 lines
26KB

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