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.

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