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.

858 lines
27KB

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