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.

667 lines
23KB

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