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.

lv2_rdf.hpp 20KB

11 years ago
11 years ago
11 years ago
12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. /*
  2. * Custom types to store LV2 information
  3. * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * 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 COPYING file
  16. */
  17. #ifndef LV2_RDF_INCLUDED
  18. #define LV2_RDF_INCLUDED
  19. #include <cstdint>
  20. #include <cstdlib>
  21. // Base Types
  22. typedef const char* LV2_URI;
  23. typedef uint32_t LV2_Property;
  24. struct LV2_Type {
  25. LV2_Property Value;
  26. LV2_URI URI;
  27. LV2_Type()
  28. : Value(0),
  29. URI(nullptr) {}
  30. ~LV2_Type()
  31. {
  32. if (URI)
  33. ::free((void*)URI);
  34. }
  35. };
  36. // Port Midi Map Types
  37. #define LV2_PORT_MIDI_MAP_CC 0x1
  38. #define LV2_PORT_MIDI_MAP_NRPN 0x2
  39. #define LV2_IS_PORT_MIDI_MAP_CC(x) ((x) == LV2_PORT_MIDI_MAP_CC)
  40. #define LV2_IS_PORT_MIDI_MAP_NRPN(x) ((x) == LV2_PORT_MIDI_MAP_NRPN)
  41. // Port Point Hints
  42. #define LV2_PORT_POINT_DEFAULT 0x1
  43. #define LV2_PORT_POINT_MINIMUM 0x2
  44. #define LV2_PORT_POINT_MAXIMUM 0x4
  45. #define LV2_HAVE_DEFAULT_PORT_POINT(x) ((x) & LV2_PORT_POINT_DEFAULT)
  46. #define LV2_HAVE_MINIMUM_PORT_POINT(x) ((x) & LV2_PORT_POINT_MINIMUM)
  47. #define LV2_HAVE_MAXIMUM_PORT_POINT(x) ((x) & LV2_PORT_POINT_MAXIMUM)
  48. // Port Unit Hints
  49. #define LV2_PORT_UNIT_NAME 0x1
  50. #define LV2_PORT_UNIT_RENDER 0x2
  51. #define LV2_PORT_UNIT_SYMBOL 0x4
  52. #define LV2_PORT_UNIT_UNIT 0x8
  53. #define LV2_HAVE_PORT_UNIT_NAME(x) ((x) & LV2_PORT_UNIT_NAME)
  54. #define LV2_HAVE_PORT_UNIT_RENDER(x) ((x) & LV2_PORT_UNIT_RENDER)
  55. #define LV2_HAVE_PORT_UNIT_SYMBOL(x) ((x) & LV2_PORT_UNIT_SYMBOL)
  56. #define LV2_HAVE_PORT_UNIT_UNIT(x) ((x) & LV2_PORT_UNIT_UNIT)
  57. // Port Unit Unit
  58. #define LV2_PORT_UNIT_BAR 0x01
  59. #define LV2_PORT_UNIT_BEAT 0x02
  60. #define LV2_PORT_UNIT_BPM 0x03
  61. #define LV2_PORT_UNIT_CENT 0x04
  62. #define LV2_PORT_UNIT_CM 0x05
  63. #define LV2_PORT_UNIT_COEF 0x06
  64. #define LV2_PORT_UNIT_DB 0x07
  65. #define LV2_PORT_UNIT_DEGREE 0x08
  66. #define LV2_PORT_UNIT_FRAME 0x09
  67. #define LV2_PORT_UNIT_HZ 0x0A
  68. #define LV2_PORT_UNIT_INCH 0x0B
  69. #define LV2_PORT_UNIT_KHZ 0x0C
  70. #define LV2_PORT_UNIT_KM 0x0D
  71. #define LV2_PORT_UNIT_M 0x0E
  72. #define LV2_PORT_UNIT_MHZ 0x0F
  73. #define LV2_PORT_UNIT_MIDINOTE 0x10
  74. #define LV2_PORT_UNIT_MILE 0x11
  75. #define LV2_PORT_UNIT_MIN 0x12
  76. #define LV2_PORT_UNIT_MM 0x13
  77. #define LV2_PORT_UNIT_MS 0x14
  78. #define LV2_PORT_UNIT_OCT 0x15
  79. #define LV2_PORT_UNIT_PC 0x16
  80. #define LV2_PORT_UNIT_S 0x17
  81. #define LV2_PORT_UNIT_SEMITONE 0x18
  82. #define LV2_IS_PORT_UNIT_BAR(x) ((x) == LV2_PORT_UNIT_BAR)
  83. #define LV2_IS_PORT_UNIT_BEAT(x) ((x) == LV2_PORT_UNIT_BEAT)
  84. #define LV2_IS_PORT_UNIT_BPM(x) ((x) == LV2_PORT_UNIT_BPM)
  85. #define LV2_IS_PORT_UNIT_CENT(x) ((x) == LV2_PORT_UNIT_CENT)
  86. #define LV2_IS_PORT_UNIT_CM(x) ((x) == LV2_PORT_UNIT_CM)
  87. #define LV2_IS_PORT_UNIT_COEF(x) ((x) == LV2_PORT_UNIT_COEF)
  88. #define LV2_IS_PORT_UNIT_DB(x) ((x) == LV2_PORT_UNIT_DB)
  89. #define LV2_IS_PORT_UNIT_DEGREE(x) ((x) == LV2_PORT_UNIT_DEGREE)
  90. #define LV2_IS_PORT_UNIT_FRAME(x) ((x) == LV2_PORT_UNIT_FRAME)
  91. #define LV2_IS_PORT_UNIT_HZ(x) ((x) == LV2_PORT_UNIT_HZ)
  92. #define LV2_IS_PORT_UNIT_INCH(x) ((x) == LV2_PORT_UNIT_INCH)
  93. #define LV2_IS_PORT_UNIT_KHZ(x) ((x) == LV2_PORT_UNIT_KHZ)
  94. #define LV2_IS_PORT_UNIT_KM(x) ((x) == LV2_PORT_UNIT_KM)
  95. #define LV2_IS_PORT_UNIT_M(x) ((x) == LV2_PORT_UNIT_M)
  96. #define LV2_IS_PORT_UNIT_MHZ(x) ((x) == LV2_PORT_UNIT_MHZ)
  97. #define LV2_IS_PORT_UNIT_MIDINOTE(x) ((x) == LV2_PORT_UNIT_MIDINOTE)
  98. #define LV2_IS_PORT_UNIT_MILE(x) ((x) == LV2_PORT_UNIT_MILE)
  99. #define LV2_IS_PORT_UNIT_MIN(x) ((x) == LV2_PORT_UNIT_MIN)
  100. #define LV2_IS_PORT_UNIT_MM(x) ((x) == LV2_PORT_UNIT_MM)
  101. #define LV2_IS_PORT_UNIT_MS(x) ((x) == LV2_PORT_UNIT_MS)
  102. #define LV2_IS_PORT_UNIT_OCT(x) ((x) == LV2_PORT_UNIT_OCT)
  103. #define LV2_IS_PORT_UNIT_PC(x) ((x) == LV2_PORT_UNIT_PC)
  104. #define LV2_IS_PORT_UNIT_S(x) ((x) == LV2_PORT_UNIT_S)
  105. #define LV2_IS_PORT_UNIT_SEMITONE(x) ((x) == LV2_PORT_UNIT_SEMITONE)
  106. // Port Types
  107. #define LV2_PORT_INPUT 0x001
  108. #define LV2_PORT_OUTPUT 0x002
  109. #define LV2_PORT_CONTROL 0x004
  110. #define LV2_PORT_AUDIO 0x008
  111. #define LV2_PORT_CV 0x010
  112. #define LV2_PORT_ATOM 0x020
  113. #define LV2_PORT_ATOM_SEQUENCE (0x040 | LV2_PORT_ATOM)
  114. #define LV2_PORT_ATOM_URID (0x080 | LV2_PORT_ATOM)
  115. #define LV2_PORT_EVENT 0x100
  116. #define LV2_PORT_MIDI_LL 0x200
  117. // Port Data Types
  118. #define LV2_PORT_DATA_MIDI_EVENT 0x1000
  119. #define LV2_PORT_DATA_OBJECT 0x2000
  120. #define LV2_PORT_DATA_PATCH_MESSAGE 0x4000
  121. #define LV2_PORT_DATA_TIME 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_ATOM_SEQUENCE(x) ((x) & LV2_PORT_ATOM_SEQUENCE)
  127. #define LV2_IS_PORT_CV(x) ((x) & LV2_PORT_CV)
  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_PATCH_MESSAGE(x) ((x) & LV2_PORT_DATA_PATCH_MESSAGE)
  132. // Port Properties
  133. #define LV2_PORT_OPTIONAL 0x0001
  134. #define LV2_PORT_ENUMERATION 0x0002
  135. #define LV2_PORT_INTEGER 0x0004
  136. #define LV2_PORT_SAMPLE_RATE 0x0008
  137. #define LV2_PORT_TOGGLED 0x0010
  138. #define LV2_PORT_CAUSES_ARTIFACTS 0x0020
  139. #define LV2_PORT_CONTINUOUS_CV 0x0040
  140. #define LV2_PORT_DISCRETE_CV 0x0080
  141. #define LV2_PORT_EXPENSIVE 0x0100
  142. #define LV2_PORT_STRICT_BOUNDS 0x0200
  143. #define LV2_PORT_LOGARITHMIC 0x0400
  144. #define LV2_PORT_NOT_AUTOMATIC 0x0800
  145. #define LV2_PORT_NOT_ON_GUI 0x1000
  146. #define LV2_PORT_TRIGGER 0x2000
  147. #define LV2_IS_PORT_OPTIONAL(x) ((x) & LV2_PORT_OPTIONAL)
  148. #define LV2_IS_PORT_ENUMERATION(x) ((x) & LV2_PORT_ENUMERATION)
  149. #define LV2_IS_PORT_INTEGER(x) ((x) & LV2_PORT_INTEGER)
  150. #define LV2_IS_PORT_SAMPLE_RATE(x) ((x) & LV2_PORT_SAMPLE_RATE)
  151. #define LV2_IS_PORT_TOGGLED(x) ((x) & LV2_PORT_TOGGLED)
  152. #define LV2_IS_PORT_CAUSES_ARTIFACTS(x) ((x) & LV2_PORT_CAUSES_ARTIFACTS)
  153. #define LV2_IS_PORT_CONTINUOUS_CV(x) ((x) & LV2_PORT_CONTINUOUS_CV)
  154. #define LV2_IS_PORT_DISCRETE_CV(x) ((x) & LV2_PORT_DISCRETE_CV)
  155. #define LV2_IS_PORT_EXPENSIVE(x) ((x) & LV2_PORT_EXPENSIVE)
  156. #define LV2_IS_PORT_STRICT_BOUNDS(x) ((x) & LV2_PORT_STRICT_BOUNDS)
  157. #define LV2_IS_PORT_LOGARITHMIC(x) ((x) & LV2_PORT_LOGARITHMIC)
  158. #define LV2_IS_PORT_NOT_AUTOMATIC(x) ((x) & LV2_PORT_NOT_AUTOMATIC)
  159. #define LV2_IS_PORT_NOT_ON_GUI(x) ((x) & LV2_PORT_NOT_ON_GUI)
  160. #define LV2_IS_PORT_TRIGGER(x) ((x) & LV2_PORT_TRIGGER)
  161. // Port Designation
  162. #define LV2_PORT_DESIGNATION_FREEWHEELING 0x1
  163. #define LV2_PORT_DESIGNATION_LATENCY 0x2
  164. #define LV2_PORT_DESIGNATION_SAMPLE_RATE 0x3
  165. #define LV2_PORT_DESIGNATION_TIME_BAR 0x4
  166. #define LV2_PORT_DESIGNATION_TIME_BAR_BEAT 0x5
  167. #define LV2_PORT_DESIGNATION_TIME_BEAT 0x6
  168. #define LV2_PORT_DESIGNATION_TIME_BEAT_UNIT 0x7
  169. #define LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR 0x8
  170. #define LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE 0x9
  171. #define LV2_PORT_DESIGNATION_TIME_FRAME 0xA
  172. #define LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND 0xB
  173. #define LV2_PORT_DESIGNATION_TIME_POSITION 0xC
  174. #define LV2_PORT_DESIGNATION_TIME_SPEED 0xD
  175. #define LV2_IS_PORT_DESIGNATION_FREEWHEELING(x) ((x) == LV2_PORT_DESIGNATION_FREEWHEELING)
  176. #define LV2_IS_PORT_DESIGNATION_LATENCY(x) ((x) == LV2_PORT_DESIGNATION_LATENCY)
  177. #define LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(x) ((x) == LV2_PORT_DESIGNATION_SAMPLE_RATE)
  178. #define LV2_IS_PORT_DESIGNATION_TIME_BAR(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR)
  179. #define LV2_IS_PORT_DESIGNATION_TIME_BAR_BEAT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR_BEAT)
  180. #define LV2_IS_PORT_DESIGNATION_TIME_BEAT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEAT)
  181. #define LV2_IS_PORT_DESIGNATION_TIME_BEAT_UNIT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEAT_UNIT)
  182. #define LV2_IS_PORT_DESIGNATION_TIME_BEATS_PER_BAR(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR)
  183. #define LV2_IS_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE)
  184. #define LV2_IS_PORT_DESIGNATION_TIME_FRAME(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAME)
  185. #define LV2_IS_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND)
  186. #define LV2_IS_PORT_DESIGNATION_TIME_POSITION(x) ((x) == LV2_PORT_DESIGNATION_TIME_POSITION)
  187. #define LV2_IS_PORT_DESIGNATION_TIME_SPEED(x) ((x) == LV2_PORT_DESIGNATION_TIME_SPEED)
  188. #define LV2_IS_PORT_DESIGNATION_TIME(x) ((x) >= LV2_PORT_DESIGNATION_TIME_BAR && (x) <= LV2_PORT_DESIGNATION_TIME_SPEED)
  189. // Feature Types
  190. #define LV2_FEATURE_OPTIONAL 0x1
  191. #define LV2_FEATURE_REQUIRED 0x2
  192. #define LV2_IS_FEATURE_OPTIONAL(x) ((x) == LV2_FEATURE_OPTIONAL)
  193. #define LV2_IS_FEATURE_REQUIRED(x) ((x) == LV2_FEATURE_REQUIRED)
  194. // UI Types
  195. #define LV2_UI_GTK2 0x1
  196. #define LV2_UI_GTK3 0x2
  197. #define LV2_UI_QT4 0x3
  198. #define LV2_UI_QT5 0x4
  199. #define LV2_UI_COCOA 0x5
  200. #define LV2_UI_WINDOWS 0x6
  201. #define LV2_UI_X11 0x7
  202. #define LV2_UI_EXTERNAL 0x8
  203. #define LV2_UI_OLD_EXTERNAL 0x9
  204. #define LV2_IS_UI_GTK2(x) ((x) == LV2_UI_GTK2)
  205. #define LV2_IS_UI_GTK3(x) ((x) == LV2_UI_GTK3)
  206. #define LV2_IS_UI_QT4(x) ((x) == LV2_UI_QT4)
  207. #define LV2_IS_UI_QT5(x) ((x) == LV2_UI_QT5)
  208. #define LV2_IS_UI_COCOA(x) ((x) == LV2_UI_COCOA)
  209. #define LV2_IS_UI_WINDOWS(x) ((x) == LV2_UI_WINDOWS)
  210. #define LV2_IS_UI_X11(x) ((x) == LV2_UI_X11)
  211. #define LV2_IS_UI_EXTERNAL(x) ((x) == LV2_UI_EXTERNAL)
  212. #define LV2_IS_UI_OLD_EXTERNAL(x) ((x) == LV2_UI_OLD_EXTERNAL)
  213. // Plugin Types
  214. #define LV2_PLUGIN_DELAY 0x000001
  215. #define LV2_PLUGIN_REVERB 0x000002
  216. #define LV2_PLUGIN_SIMULATOR 0x000004
  217. #define LV2_PLUGIN_DISTORTION 0x000008
  218. #define LV2_PLUGIN_WAVESHAPER 0x000010
  219. #define LV2_PLUGIN_DYNAMICS 0x000020
  220. #define LV2_PLUGIN_AMPLIFIER 0x000040
  221. #define LV2_PLUGIN_COMPRESSOR 0x000080
  222. #define LV2_PLUGIN_ENVELOPE 0x000100
  223. #define LV2_PLUGIN_EXPANDER 0x000200
  224. #define LV2_PLUGIN_GATE 0x000400
  225. #define LV2_PLUGIN_LIMITER 0x000800
  226. #define LV2_PLUGIN_EQ 0x001000
  227. #define LV2_PLUGIN_MULTI_EQ 0x002000
  228. #define LV2_PLUGIN_PARA_EQ 0x004000
  229. #define LV2_PLUGIN_FILTER 0x008000
  230. #define LV2_PLUGIN_ALLPASS 0x010000
  231. #define LV2_PLUGIN_BANDPASS 0x020000
  232. #define LV2_PLUGIN_COMB 0x040000
  233. #define LV2_PLUGIN_HIGHPASS 0x080000
  234. #define LV2_PLUGIN_LOWPASS 0x100000
  235. #define LV2_PLUGIN_GENERATOR 0x000001
  236. #define LV2_PLUGIN_CONSTANT 0x000002
  237. #define LV2_PLUGIN_INSTRUMENT 0x000004
  238. #define LV2_PLUGIN_OSCILLATOR 0x000008
  239. #define LV2_PLUGIN_MODULATOR 0x000010
  240. #define LV2_PLUGIN_CHORUS 0x000020
  241. #define LV2_PLUGIN_FLANGER 0x000040
  242. #define LV2_PLUGIN_PHASER 0x000080
  243. #define LV2_PLUGIN_SPATIAL 0x000100
  244. #define LV2_PLUGIN_SPECTRAL 0x000200
  245. #define LV2_PLUGIN_PITCH 0x000400
  246. #define LV2_PLUGIN_UTILITY 0x000800
  247. #define LV2_PLUGIN_ANALYSER 0x001000
  248. #define LV2_PLUGIN_CONVERTER 0x002000
  249. #define LV2_PLUGIN_FUNCTION 0x008000
  250. #define LV2_PLUGIN_MIXER 0x010000
  251. #define LV2_GROUP_DELAY (LV2_PLUGIN_DELAY|LV2_PLUGIN_REVERB)
  252. #define LV2_GROUP_DISTORTION (LV2_PLUGIN_DISTORTION|LV2_PLUGIN_WAVESHAPER)
  253. #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)
  254. #define LV2_GROUP_EQ (LV2_PLUGIN_EQ|LV2_PLUGIN_MULTI_EQ|LV2_PLUGIN_PARA_EQ)
  255. #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)
  256. #define LV2_GROUP_GENERATOR (LV2_PLUGIN_GENERATOR|LV2_PLUGIN_CONSTANT|LV2_PLUGIN_INSTRUMENT|LV2_PLUGIN_OSCILLATOR)
  257. #define LV2_GROUP_MODULATOR (LV2_PLUGIN_MODULATOR|LV2_PLUGIN_CHORUS|LV2_PLUGIN_FLANGER|LV2_PLUGIN_PHASER)
  258. #define LV2_GROUP_REVERB (LV2_PLUGIN_REVERB)
  259. #define LV2_GROUP_SIMULATOR (LV2_PLUGIN_SIMULATOR|LV2_PLUGIN_REVERB)
  260. #define LV2_GROUP_SPATIAL (LV2_PLUGIN_SPATIAL)
  261. #define LV2_GROUP_SPECTRAL (LV2_PLUGIN_SPECTRAL|LV2_PLUGIN_PITCH)
  262. #define LV2_GROUP_UTILITY (LV2_PLUGIN_UTILITY|LV2_PLUGIN_ANALYSER|LV2_PLUGIN_CONVERTER|LV2_PLUGIN_FUNCTION|LV2_PLUGIN_MIXER)
  263. #define LV2_IS_DELAY(x, y) (((x) & LV2_GROUP_DELAY) || ((y) & LV2_GROUP_DELAY))
  264. #define LV2_IS_DISTORTION(x, y) (((x) & LV2_GROUP_DISTORTION) || ((y) & LV2_GROUP_DISTORTION))
  265. #define LV2_IS_DYNAMICS(x, y) (((x) & LV2_GROUP_DYNAMICS) || ((y) & LV2_GROUP_DYNAMICS))
  266. #define LV2_IS_EQ(x, y) (((x) & LV2_GROUP_EQ) || ((y) & LV2_GROUP_EQ))
  267. #define LV2_IS_FILTER(x, y) (((x) & LV2_GROUP_FILTER) || ((y) & LV2_GROUP_FILTER))
  268. #define LV2_IS_GENERATOR(x, y) (((x) & LV2_GROUP_GENERATOR) || ((y) & LV2_GROUP_GENERATOR))
  269. #define LV2_IS_MODULATOR(x, y) (((x) & LV2_GROUP_MODULATOR) || ((y) & LV2_GROUP_MODULATOR))
  270. #define LV2_IS_REVERB(x, y) (((x) & LV2_GROUP_REVERB) || ((y) & LV2_GROUP_REVERB))
  271. #define LV2_IS_SIMULATOR(x, y) (((x) & LV2_GROUP_SIMULATOR) || ((y) & LV2_GROUP_SIMULATOR))
  272. #define LV2_IS_SPATIAL(x, y) (((x) & LV2_GROUP_SPATIAL) || ((y) & LV2_GROUP_SPATIAL))
  273. #define LV2_IS_SPECTRAL(x, y) (((x) & LV2_GROUP_SPECTRAL) || ((y) & LV2_GROUP_SPECTRAL))
  274. #define LV2_IS_UTILITY(x, y) (((x) & LV2_GROUP_UTILITY) || ((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()
  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()
  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()
  303. : Hints(0x0),
  304. Name(nullptr),
  305. Render(nullptr),
  306. Symbol(nullptr),
  307. Unit(0) {}
  308. ~LV2_RDF_PortUnit()
  309. {
  310. if (Name)
  311. ::free((void*)Name);
  312. if (Render)
  313. ::free((void*)Render);
  314. if (Symbol)
  315. ::free((void*)Symbol);
  316. }
  317. };
  318. // Port Scale Point
  319. struct LV2_RDF_PortScalePoint {
  320. const char* Label;
  321. float Value;
  322. LV2_RDF_PortScalePoint()
  323. : Label(nullptr),
  324. Value(0.0f) {}
  325. ~LV2_RDF_PortScalePoint()
  326. {
  327. if (Label)
  328. ::free((void*)Label);
  329. }
  330. };
  331. // Port
  332. struct LV2_RDF_Port {
  333. LV2_Property Types;
  334. LV2_Property Properties;
  335. LV2_Property Designation;
  336. const char* Name;
  337. const char* Symbol;
  338. LV2_RDF_PortMidiMap MidiMap;
  339. LV2_RDF_PortPoints Points;
  340. LV2_RDF_PortUnit Unit;
  341. uint32_t ScalePointCount;
  342. LV2_RDF_PortScalePoint* ScalePoints;
  343. LV2_RDF_Port()
  344. : Types(0x0),
  345. Properties(0x0),
  346. Designation(0),
  347. Name(nullptr),
  348. Symbol(nullptr),
  349. ScalePointCount(0),
  350. ScalePoints(nullptr) {}
  351. ~LV2_RDF_Port()
  352. {
  353. if (Name)
  354. ::free((void*)Name);
  355. if (Symbol)
  356. ::free((void*)Symbol);
  357. if (ScalePoints)
  358. delete[] ScalePoints;
  359. }
  360. };
  361. // Preset
  362. struct LV2_RDF_Preset {
  363. LV2_URI URI;
  364. const char* Label;
  365. LV2_RDF_Preset()
  366. : URI(nullptr),
  367. Label(nullptr) {}
  368. ~LV2_RDF_Preset()
  369. {
  370. if (URI)
  371. ::free((void*)URI);
  372. if (Label)
  373. ::free((void*)Label);
  374. }
  375. };
  376. // Feature
  377. struct LV2_RDF_Feature {
  378. LV2_Property Type;
  379. LV2_URI URI;
  380. LV2_RDF_Feature()
  381. : Type(0),
  382. URI(nullptr) {}
  383. ~LV2_RDF_Feature()
  384. {
  385. if (URI)
  386. ::free((void*)URI);
  387. }
  388. };
  389. // UI
  390. struct LV2_RDF_UI {
  391. LV2_Type Type;
  392. LV2_URI URI;
  393. const char* Binary;
  394. const char* Bundle;
  395. uint32_t FeatureCount;
  396. LV2_RDF_Feature* Features;
  397. uint32_t ExtensionCount;
  398. LV2_URI* Extensions;
  399. LV2_RDF_UI()
  400. : URI(nullptr),
  401. Binary(nullptr),
  402. Bundle(nullptr),
  403. FeatureCount(0),
  404. Features(nullptr),
  405. ExtensionCount(0),
  406. Extensions(nullptr) {}
  407. ~LV2_RDF_UI()
  408. {
  409. if (URI)
  410. ::free((void*)URI);
  411. if (Binary)
  412. ::free((void*)Binary);
  413. if (Bundle)
  414. ::free((void*)Bundle);
  415. if (Features)
  416. delete[] Features;
  417. if (Extensions)
  418. delete[] Extensions;
  419. }
  420. };
  421. // Plugin
  422. struct LV2_RDF_Descriptor {
  423. LV2_Property Type[2];
  424. LV2_URI URI;
  425. const char* Name;
  426. const char* Author;
  427. const char* License;
  428. const char* Binary;
  429. const char* Bundle;
  430. unsigned long UniqueID;
  431. uint32_t PortCount;
  432. LV2_RDF_Port* Ports;
  433. uint32_t PresetCount;
  434. LV2_RDF_Preset* Presets;
  435. uint32_t FeatureCount;
  436. LV2_RDF_Feature* Features;
  437. uint32_t ExtensionCount;
  438. LV2_URI* Extensions;
  439. uint32_t UICount;
  440. LV2_RDF_UI* UIs;
  441. LV2_RDF_Descriptor()
  442. : Type{0x0},
  443. URI(nullptr),
  444. Name(nullptr),
  445. Author(nullptr),
  446. License(nullptr),
  447. Binary(nullptr),
  448. Bundle(nullptr),
  449. UniqueID(0),
  450. PortCount(0),
  451. Ports(nullptr),
  452. PresetCount(0),
  453. Presets(nullptr),
  454. FeatureCount(0),
  455. Features(nullptr),
  456. ExtensionCount(0),
  457. Extensions(nullptr),
  458. UICount(0),
  459. UIs(nullptr) {}
  460. ~LV2_RDF_Descriptor()
  461. {
  462. if (URI)
  463. ::free((void*)URI);
  464. if (Name)
  465. ::free((void*)Name);
  466. if (Author)
  467. ::free((void*)Author);
  468. if (License)
  469. ::free((void*)License);
  470. if (Binary)
  471. ::free((void*)Binary);
  472. if (Bundle)
  473. ::free((void*)Bundle);
  474. if (Ports)
  475. delete[] Ports;
  476. if (Presets)
  477. delete[] Presets;
  478. if (Features)
  479. delete[] Features;
  480. if (Extensions)
  481. delete[] Extensions;
  482. if (UIs)
  483. delete[] UIs;
  484. }
  485. };
  486. #endif // LV2_RDF_INCLUDED