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.

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