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.

772 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_IS_UI_GTK2(x) ((x) == LV2_UI_GTK2)
  214. #define LV2_IS_UI_GTK3(x) ((x) == LV2_UI_GTK3)
  215. #define LV2_IS_UI_QT4(x) ((x) == LV2_UI_QT4)
  216. #define LV2_IS_UI_QT5(x) ((x) == LV2_UI_QT5)
  217. #define LV2_IS_UI_COCOA(x) ((x) == LV2_UI_COCOA)
  218. #define LV2_IS_UI_WINDOWS(x) ((x) == LV2_UI_WINDOWS)
  219. #define LV2_IS_UI_X11(x) ((x) == LV2_UI_X11)
  220. #define LV2_IS_UI_EXTERNAL(x) ((x) == LV2_UI_EXTERNAL)
  221. #define LV2_IS_UI_OLD_EXTERNAL(x) ((x) == LV2_UI_OLD_EXTERNAL)
  222. // Plugin Types
  223. #define LV2_PLUGIN_DELAY 0x000001
  224. #define LV2_PLUGIN_REVERB 0x000002
  225. #define LV2_PLUGIN_SIMULATOR 0x000004
  226. #define LV2_PLUGIN_DISTORTION 0x000008
  227. #define LV2_PLUGIN_WAVESHAPER 0x000010
  228. #define LV2_PLUGIN_DYNAMICS 0x000020
  229. #define LV2_PLUGIN_AMPLIFIER 0x000040
  230. #define LV2_PLUGIN_COMPRESSOR 0x000080
  231. #define LV2_PLUGIN_ENVELOPE 0x000100
  232. #define LV2_PLUGIN_EXPANDER 0x000200
  233. #define LV2_PLUGIN_GATE 0x000400
  234. #define LV2_PLUGIN_LIMITER 0x000800
  235. #define LV2_PLUGIN_EQ 0x001000
  236. #define LV2_PLUGIN_MULTI_EQ 0x002000
  237. #define LV2_PLUGIN_PARA_EQ 0x004000
  238. #define LV2_PLUGIN_FILTER 0x008000
  239. #define LV2_PLUGIN_ALLPASS 0x010000
  240. #define LV2_PLUGIN_BANDPASS 0x020000
  241. #define LV2_PLUGIN_COMB 0x040000
  242. #define LV2_PLUGIN_HIGHPASS 0x080000
  243. #define LV2_PLUGIN_LOWPASS 0x100000
  244. #define LV2_PLUGIN_GENERATOR 0x000001
  245. #define LV2_PLUGIN_CONSTANT 0x000002
  246. #define LV2_PLUGIN_INSTRUMENT 0x000004
  247. #define LV2_PLUGIN_OSCILLATOR 0x000008
  248. #define LV2_PLUGIN_MODULATOR 0x000010
  249. #define LV2_PLUGIN_CHORUS 0x000020
  250. #define LV2_PLUGIN_FLANGER 0x000040
  251. #define LV2_PLUGIN_PHASER 0x000080
  252. #define LV2_PLUGIN_SPATIAL 0x000100
  253. #define LV2_PLUGIN_SPECTRAL 0x000200
  254. #define LV2_PLUGIN_PITCH 0x000400
  255. #define LV2_PLUGIN_UTILITY 0x000800
  256. #define LV2_PLUGIN_ANALYSER 0x001000
  257. #define LV2_PLUGIN_CONVERTER 0x002000
  258. #define LV2_PLUGIN_FUNCTION 0x008000
  259. #define LV2_PLUGIN_MIXER 0x010000
  260. #define LV2_GROUP_DELAY (LV2_PLUGIN_DELAY|LV2_PLUGIN_REVERB)
  261. #define LV2_GROUP_DISTORTION (LV2_PLUGIN_DISTORTION|LV2_PLUGIN_WAVESHAPER)
  262. #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)
  263. #define LV2_GROUP_EQ (LV2_PLUGIN_EQ|LV2_PLUGIN_MULTI_EQ|LV2_PLUGIN_PARA_EQ)
  264. #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)
  265. #define LV2_GROUP_GENERATOR (LV2_PLUGIN_GENERATOR|LV2_PLUGIN_CONSTANT|LV2_PLUGIN_INSTRUMENT|LV2_PLUGIN_OSCILLATOR)
  266. #define LV2_GROUP_MODULATOR (LV2_PLUGIN_MODULATOR|LV2_PLUGIN_CHORUS|LV2_PLUGIN_FLANGER|LV2_PLUGIN_PHASER)
  267. #define LV2_GROUP_REVERB (LV2_PLUGIN_REVERB)
  268. #define LV2_GROUP_SIMULATOR (LV2_PLUGIN_SIMULATOR|LV2_PLUGIN_REVERB)
  269. #define LV2_GROUP_SPATIAL (LV2_PLUGIN_SPATIAL)
  270. #define LV2_GROUP_SPECTRAL (LV2_PLUGIN_SPECTRAL|LV2_PLUGIN_PITCH)
  271. #define LV2_GROUP_UTILITY (LV2_PLUGIN_UTILITY|LV2_PLUGIN_ANALYSER|LV2_PLUGIN_CONVERTER|LV2_PLUGIN_FUNCTION|LV2_PLUGIN_MIXER)
  272. #define LV2_IS_DELAY(x, y) ((x) & LV2_GROUP_DELAY)
  273. #define LV2_IS_DISTORTION(x, y) ((x) & LV2_GROUP_DISTORTION)
  274. #define LV2_IS_DYNAMICS(x, y) ((x) & LV2_GROUP_DYNAMICS)
  275. #define LV2_IS_EQ(x, y) ((x) & LV2_GROUP_EQ)
  276. #define LV2_IS_FILTER(x, y) ((x) & LV2_GROUP_FILTER)
  277. #define LV2_IS_GENERATOR(x, y) ((y) & LV2_GROUP_GENERATOR)
  278. #define LV2_IS_INSTRUMENT(x, y) ((y) & LV2_PLUGIN_INSTRUMENT)
  279. #define LV2_IS_MODULATOR(x, y) ((y) & LV2_GROUP_MODULATOR)
  280. #define LV2_IS_REVERB(x, y) ((x) & LV2_GROUP_REVERB)
  281. #define LV2_IS_SIMULATOR(x, y) ((x) & LV2_GROUP_SIMULATOR)
  282. #define LV2_IS_SPATIAL(x, y) ((y) & LV2_GROUP_SPATIAL)
  283. #define LV2_IS_SPECTRAL(x, y) ((y) & LV2_GROUP_SPECTRAL)
  284. #define LV2_IS_UTILITY(x, y) ((y) & LV2_GROUP_UTILITY)
  285. // Port Midi Map
  286. struct LV2_RDF_PortMidiMap {
  287. LV2_Property Type;
  288. uint32_t Number;
  289. LV2_RDF_PortMidiMap() noexcept
  290. : Type(0),
  291. Number(0) {}
  292. };
  293. // Port Points
  294. struct LV2_RDF_PortPoints {
  295. LV2_Property Hints;
  296. float Default;
  297. float Minimum;
  298. float Maximum;
  299. LV2_RDF_PortPoints() noexcept
  300. : Hints(0x0),
  301. Default(0.0f),
  302. Minimum(0.0f),
  303. Maximum(1.0f) {}
  304. };
  305. // Port Unit
  306. struct LV2_RDF_PortUnit {
  307. LV2_Property Hints;
  308. const char* Name;
  309. const char* Render;
  310. const char* Symbol;
  311. LV2_Property Unit;
  312. LV2_RDF_PortUnit() noexcept
  313. : Hints(0x0),
  314. Name(nullptr),
  315. Render(nullptr),
  316. Symbol(nullptr),
  317. Unit(0) {}
  318. ~LV2_RDF_PortUnit() noexcept
  319. {
  320. if (Name != nullptr)
  321. {
  322. delete[] Name;
  323. Name = nullptr;
  324. }
  325. if (Render != nullptr)
  326. {
  327. delete[] Render;
  328. Render = nullptr;
  329. }
  330. if (Symbol != nullptr)
  331. {
  332. delete[] Symbol;
  333. Symbol = nullptr;
  334. }
  335. }
  336. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_PortUnit)
  337. };
  338. // Port Scale Point
  339. struct LV2_RDF_PortScalePoint {
  340. const char* Label;
  341. float Value;
  342. LV2_RDF_PortScalePoint() noexcept
  343. : Label(nullptr),
  344. Value(0.0f) {}
  345. ~LV2_RDF_PortScalePoint() noexcept
  346. {
  347. if (Label != nullptr)
  348. {
  349. delete[] Label;
  350. Label = nullptr;
  351. }
  352. }
  353. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_PortScalePoint)
  354. };
  355. // Port
  356. struct LV2_RDF_Port {
  357. LV2_Property Types;
  358. LV2_Property Properties;
  359. LV2_Property Designation;
  360. const char* Name;
  361. const char* Symbol;
  362. const char* Comment;
  363. LV2_RDF_PortMidiMap MidiMap;
  364. LV2_RDF_PortPoints Points;
  365. LV2_RDF_PortUnit Unit;
  366. uint32_t MinimumSize;
  367. uint32_t ScalePointCount;
  368. LV2_RDF_PortScalePoint* ScalePoints;
  369. LV2_RDF_Port() noexcept
  370. : Types(0x0),
  371. Properties(0x0),
  372. Designation(0),
  373. Name(nullptr),
  374. Symbol(nullptr),
  375. Comment(nullptr),
  376. MidiMap(),
  377. Points(),
  378. Unit(),
  379. MinimumSize(0),
  380. ScalePointCount(0),
  381. ScalePoints(nullptr) {}
  382. ~LV2_RDF_Port() noexcept
  383. {
  384. if (Name != nullptr)
  385. {
  386. delete[] Name;
  387. Name = nullptr;
  388. }
  389. if (Symbol != nullptr)
  390. {
  391. delete[] Symbol;
  392. Symbol = nullptr;
  393. }
  394. if (Comment != nullptr)
  395. {
  396. delete[] Comment;
  397. Comment = nullptr;
  398. }
  399. if (ScalePoints != nullptr)
  400. {
  401. delete[] ScalePoints;
  402. ScalePoints = nullptr;
  403. }
  404. }
  405. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Port)
  406. };
  407. // Parameter
  408. struct LV2_RDF_Parameter {
  409. LV2_URI URI;
  410. LV2_Property Type;
  411. bool Input;
  412. const char* Label;
  413. const char* Comment;
  414. LV2_RDF_PortMidiMap MidiMap;
  415. LV2_RDF_PortPoints Points;
  416. LV2_RDF_PortUnit Unit;
  417. LV2_RDF_Parameter() noexcept
  418. : URI(nullptr),
  419. Type(0),
  420. Input(true),
  421. Label(nullptr),
  422. Comment(nullptr),
  423. MidiMap(),
  424. Points(),
  425. Unit() {}
  426. ~LV2_RDF_Parameter() noexcept
  427. {
  428. if (URI != nullptr)
  429. {
  430. delete[] URI;
  431. URI = nullptr;
  432. }
  433. if (Label != nullptr)
  434. {
  435. delete[] Label;
  436. Label = nullptr;
  437. }
  438. if (Comment != nullptr)
  439. {
  440. delete[] Comment;
  441. Comment = nullptr;
  442. }
  443. }
  444. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Parameter)
  445. };
  446. // Preset
  447. struct LV2_RDF_Preset {
  448. LV2_URI URI;
  449. const char* Label;
  450. LV2_RDF_Preset() noexcept
  451. : URI(nullptr),
  452. Label(nullptr) {}
  453. ~LV2_RDF_Preset() noexcept
  454. {
  455. if (URI != nullptr)
  456. {
  457. delete[] URI;
  458. URI = nullptr;
  459. }
  460. if (Label != nullptr)
  461. {
  462. delete[] Label;
  463. Label = nullptr;
  464. }
  465. }
  466. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Preset)
  467. };
  468. // Feature
  469. struct LV2_RDF_Feature {
  470. bool Required;
  471. LV2_URI URI;
  472. LV2_RDF_Feature() noexcept
  473. : Required(false),
  474. URI(nullptr) {}
  475. ~LV2_RDF_Feature() noexcept
  476. {
  477. if (URI != nullptr)
  478. {
  479. delete[] URI;
  480. URI = nullptr;
  481. }
  482. }
  483. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Feature)
  484. };
  485. // Port Notification
  486. struct LV2_RDF_UI_PortNotification {
  487. const char* Symbol;
  488. uint32_t Index;
  489. LV2_Property Protocol;
  490. LV2_RDF_UI_PortNotification() noexcept
  491. : Symbol(nullptr),
  492. Index(LV2UI_INVALID_PORT_INDEX),
  493. Protocol(0) {}
  494. ~LV2_RDF_UI_PortNotification() noexcept
  495. {
  496. if (Symbol != nullptr)
  497. {
  498. delete[] Symbol;
  499. Symbol = nullptr;
  500. }
  501. }
  502. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_UI_PortNotification)
  503. };
  504. // UI
  505. struct LV2_RDF_UI {
  506. LV2_Property Type;
  507. LV2_URI URI;
  508. const char* Binary;
  509. const char* Bundle;
  510. uint32_t FeatureCount;
  511. LV2_RDF_Feature* Features;
  512. uint32_t ExtensionCount;
  513. LV2_URI* Extensions;
  514. uint32_t PortNotificationCount;
  515. LV2_RDF_UI_PortNotification* PortNotifications;
  516. LV2_RDF_UI() noexcept
  517. : Type(0),
  518. URI(nullptr),
  519. Binary(nullptr),
  520. Bundle(nullptr),
  521. FeatureCount(0),
  522. Features(nullptr),
  523. ExtensionCount(0),
  524. Extensions(nullptr),
  525. PortNotificationCount(0),
  526. PortNotifications(nullptr) {}
  527. ~LV2_RDF_UI() noexcept
  528. {
  529. if (URI != nullptr)
  530. {
  531. delete[] URI;
  532. URI = nullptr;
  533. }
  534. if (Binary != nullptr)
  535. {
  536. delete[] Binary;
  537. Binary = nullptr;
  538. }
  539. if (Bundle != nullptr)
  540. {
  541. delete[] Bundle;
  542. Bundle = nullptr;
  543. }
  544. if (Features != nullptr)
  545. {
  546. delete[] Features;
  547. Features = nullptr;
  548. }
  549. if (Extensions != nullptr)
  550. {
  551. for (uint32_t i=0; i<ExtensionCount; ++i)
  552. {
  553. if (Extensions[i] != nullptr)
  554. {
  555. delete[] Extensions[i];
  556. Extensions[i] = nullptr;
  557. }
  558. }
  559. delete[] Extensions;
  560. Extensions = nullptr;
  561. }
  562. if (PortNotifications != nullptr)
  563. {
  564. delete[] PortNotifications;
  565. PortNotifications = nullptr;
  566. }
  567. }
  568. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_UI)
  569. };
  570. // Plugin Descriptor
  571. struct LV2_RDF_Descriptor {
  572. LV2_Property Type[2];
  573. LV2_URI URI;
  574. const char* Name;
  575. const char* Author;
  576. const char* License;
  577. const char* Binary;
  578. const char* Bundle;
  579. ulong UniqueID;
  580. uint32_t PortCount;
  581. LV2_RDF_Port* Ports;
  582. uint32_t ParameterCount;
  583. LV2_RDF_Parameter* Parameters;
  584. uint32_t PresetCount;
  585. LV2_RDF_Preset* Presets;
  586. uint32_t FeatureCount;
  587. LV2_RDF_Feature* Features;
  588. uint32_t ExtensionCount;
  589. LV2_URI* Extensions;
  590. uint32_t UICount;
  591. LV2_RDF_UI* UIs;
  592. LV2_RDF_Descriptor() noexcept
  593. : URI(nullptr),
  594. Name(nullptr),
  595. Author(nullptr),
  596. License(nullptr),
  597. Binary(nullptr),
  598. Bundle(nullptr),
  599. UniqueID(0),
  600. PortCount(0),
  601. Ports(nullptr),
  602. ParameterCount(0),
  603. Parameters(nullptr),
  604. PresetCount(0),
  605. Presets(nullptr),
  606. FeatureCount(0),
  607. Features(nullptr),
  608. ExtensionCount(0),
  609. Extensions(nullptr),
  610. UICount(0),
  611. UIs(nullptr)
  612. {
  613. Type[0] = Type[1] = 0x0;
  614. }
  615. ~LV2_RDF_Descriptor() noexcept
  616. {
  617. if (URI != nullptr)
  618. {
  619. delete[] URI;
  620. URI = nullptr;
  621. }
  622. if (Name != nullptr)
  623. {
  624. delete[] Name;
  625. Name = nullptr;
  626. }
  627. if (Author != nullptr)
  628. {
  629. delete[] Author;
  630. Author = nullptr;
  631. }
  632. if (License != nullptr)
  633. {
  634. delete[] License;
  635. License = nullptr;
  636. }
  637. if (Binary != nullptr)
  638. {
  639. delete[] Binary;
  640. Binary = nullptr;
  641. }
  642. if (Bundle != nullptr)
  643. {
  644. delete[] Bundle;
  645. Bundle = nullptr;
  646. }
  647. if (Ports != nullptr)
  648. {
  649. delete[] Ports;
  650. Ports = nullptr;
  651. }
  652. if (Parameters != nullptr)
  653. {
  654. delete[] Parameters;
  655. Parameters = nullptr;
  656. }
  657. if (Presets != nullptr)
  658. {
  659. delete[] Presets;
  660. Presets = nullptr;
  661. }
  662. if (Features != nullptr)
  663. {
  664. delete[] Features;
  665. Features = nullptr;
  666. }
  667. if (Extensions != nullptr)
  668. {
  669. for (uint32_t i=0; i<ExtensionCount; ++i)
  670. {
  671. if (Extensions[i] != nullptr)
  672. {
  673. delete[] Extensions[i];
  674. Extensions[i] = nullptr;
  675. }
  676. }
  677. delete[] Extensions;
  678. Extensions = nullptr;
  679. }
  680. if (UIs != nullptr)
  681. {
  682. delete[] UIs;
  683. UIs = nullptr;
  684. }
  685. }
  686. CARLA_DECLARE_NON_COPY_STRUCT(LV2_RDF_Descriptor)
  687. };
  688. #endif // LV2_RDF_HPP_INCLUDED