Collection of tools useful for audio production
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.

568 lines
20KB

  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 0x01
  108. #define LV2_PORT_OUTPUT 0x02
  109. #define LV2_PORT_CONTROL 0x04
  110. #define LV2_PORT_AUDIO 0x08
  111. #define LV2_PORT_CV 0x10
  112. #define LV2_PORT_ATOM 0x20
  113. #define LV2_PORT_ATOM_SEQUENCE (0x40 | LV2_PORT_ATOM)
  114. #define LV2_PORT_EVENT 0x80
  115. #define LV2_PORT_MIDI_LL 0x100
  116. // Port Data Types
  117. #define LV2_PORT_DATA_MIDI_EVENT 0x1000
  118. #define LV2_PORT_DATA_PATCH_MESSAGE 0x2000
  119. #define LV2_IS_PORT_INPUT(x) ((x) & LV2_PORT_INPUT)
  120. #define LV2_IS_PORT_OUTPUT(x) ((x) & LV2_PORT_OUTPUT)
  121. #define LV2_IS_PORT_CONTROL(x) ((x) & LV2_PORT_CONTROL)
  122. #define LV2_IS_PORT_AUDIO(x) ((x) & LV2_PORT_AUDIO)
  123. #define LV2_IS_PORT_ATOM_SEQUENCE(x) ((x) & LV2_PORT_ATOM_SEQUENCE)
  124. #define LV2_IS_PORT_CV(x) ((x) & LV2_PORT_CV)
  125. #define LV2_IS_PORT_EVENT(x) ((x) & LV2_PORT_EVENT)
  126. #define LV2_IS_PORT_MIDI_LL(x) ((x) & LV2_PORT_MIDI_LL)
  127. #define LV2_PORT_SUPPORTS_MIDI_EVENT ((x) & LV2_PORT_DATA_MIDI_EVENT)
  128. #define LV2_PORT_SUPPORTS_PATCH_MESSAGE ((x) & LV2_PORT_DATA_PATCH_MESSAGE)
  129. // Port Properties
  130. #define LV2_PORT_OPTIONAL 0x0001
  131. #define LV2_PORT_ENUMERATION 0x0002
  132. #define LV2_PORT_INTEGER 0x0004
  133. #define LV2_PORT_SAMPLE_RATE 0x0008
  134. #define LV2_PORT_TOGGLED 0x0010
  135. #define LV2_PORT_CAUSES_ARTIFACTS 0x0020
  136. #define LV2_PORT_CONTINUOUS_CV 0x0040
  137. #define LV2_PORT_DISCRETE_CV 0x0080
  138. #define LV2_PORT_EXPENSIVE 0x0100
  139. #define LV2_PORT_STRICT_BOUNDS 0x0200
  140. #define LV2_PORT_LOGARITHMIC 0x0400
  141. #define LV2_PORT_NOT_AUTOMATIC 0x0800
  142. #define LV2_PORT_NOT_ON_GUI 0x1000
  143. #define LV2_PORT_TRIGGER 0x2000
  144. #define LV2_IS_PORT_OPTIONAL(x) ((x) & LV2_PORT_OPTIONAL)
  145. #define LV2_IS_PORT_ENUMERATION(x) ((x) & LV2_PORT_ENUMERATION)
  146. #define LV2_IS_PORT_INTEGER(x) ((x) & LV2_PORT_INTEGER)
  147. #define LV2_IS_PORT_SAMPLE_RATE(x) ((x) & LV2_PORT_SAMPLE_RATE)
  148. #define LV2_IS_PORT_TOGGLED(x) ((x) & LV2_PORT_TOGGLED)
  149. #define LV2_IS_PORT_CAUSES_ARTIFACTS(x) ((x) & LV2_PORT_CAUSES_ARTIFACTS)
  150. #define LV2_IS_PORT_CONTINUOUS_CV(x) ((x) & LV2_PORT_CONTINUOUS_CV)
  151. #define LV2_IS_PORT_DISCRETE_CV(x) ((x) & LV2_PORT_DISCRETE_CV)
  152. #define LV2_IS_PORT_EXPENSIVE(x) ((x) & LV2_PORT_EXPENSIVE)
  153. #define LV2_IS_PORT_STRICT_BOUNDS(x) ((x) & LV2_PORT_STRICT_BOUNDS)
  154. #define LV2_IS_PORT_LOGARITHMIC(x) ((x) & LV2_PORT_LOGARITHMIC)
  155. #define LV2_IS_PORT_NOT_AUTOMATIC(x) ((x) & LV2_PORT_NOT_AUTOMATIC)
  156. #define LV2_IS_PORT_NOT_ON_GUI(x) ((x) & LV2_PORT_NOT_ON_GUI)
  157. #define LV2_IS_PORT_TRIGGER(x) ((x) & LV2_PORT_TRIGGER)
  158. // Port Designation
  159. #define LV2_PORT_DESIGNATION_FREEWHEELING 0x1
  160. #define LV2_PORT_DESIGNATION_LATENCY 0x2
  161. #define LV2_PORT_DESIGNATION_SAMPLE_RATE 0x3
  162. #define LV2_PORT_DESIGNATION_TIME_BAR 0x4
  163. #define LV2_PORT_DESIGNATION_TIME_BAR_BEAT 0x5
  164. #define LV2_PORT_DESIGNATION_TIME_BEAT 0x6
  165. #define LV2_PORT_DESIGNATION_TIME_BEAT_UNIT 0x7
  166. #define LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR 0x8
  167. #define LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE 0x9
  168. #define LV2_PORT_DESIGNATION_TIME_FRAME 0xA
  169. #define LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND 0xB
  170. #define LV2_PORT_DESIGNATION_TIME_POSITION 0xC
  171. #define LV2_PORT_DESIGNATION_TIME_SPEED 0xD
  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_POSITION(x) ((x) == LV2_PORT_DESIGNATION_TIME_POSITION)
  184. #define LV2_IS_PORT_DESIGNATION_TIME_SPEED(x) ((x) == LV2_PORT_DESIGNATION_TIME_SPEED)
  185. #define LV2_IS_PORT_DESIGNATION_TIME(x) ((x) >= LV2_PORT_DESIGNATION_TIME_BAR && (x) <= LV2_PORT_DESIGNATION_TIME_SPEED)
  186. // Feature Types
  187. #define LV2_FEATURE_OPTIONAL 0x1
  188. #define LV2_FEATURE_REQUIRED 0x2
  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 0x1
  193. #define LV2_UI_GTK3 0x2
  194. #define LV2_UI_QT4 0x3
  195. #define LV2_UI_QT5 0x4
  196. #define LV2_UI_COCOA 0x5
  197. #define LV2_UI_WINDOWS 0x6
  198. #define LV2_UI_X11 0x7
  199. #define LV2_UI_EXTERNAL 0x8
  200. #define LV2_UI_OLD_EXTERNAL 0x9
  201. #define LV2_IS_UI_GTK2(x) ((x) == LV2_UI_GTK2)
  202. #define LV2_IS_UI_GTK3(x) ((x) == LV2_UI_GTK3)
  203. #define LV2_IS_UI_QT4(x) ((x) == LV2_UI_QT4)
  204. #define LV2_IS_UI_QT5(x) ((x) == LV2_UI_QT5)
  205. #define LV2_IS_UI_COCOA(x) ((x) == LV2_UI_COCOA)
  206. #define LV2_IS_UI_WINDOWS(x) ((x) == LV2_UI_WINDOWS)
  207. #define LV2_IS_UI_X11(x) ((x) == LV2_UI_X11)
  208. #define LV2_IS_UI_EXTERNAL(x) ((x) == LV2_UI_EXTERNAL)
  209. #define LV2_IS_UI_OLD_EXTERNAL(x) ((x) == LV2_UI_OLD_EXTERNAL)
  210. // Plugin Types
  211. #define LV2_PLUGIN_DELAY 0x000001
  212. #define LV2_PLUGIN_REVERB 0x000002
  213. #define LV2_PLUGIN_SIMULATOR 0x000004
  214. #define LV2_PLUGIN_DISTORTION 0x000008
  215. #define LV2_PLUGIN_WAVESHAPER 0x000010
  216. #define LV2_PLUGIN_DYNAMICS 0x000020
  217. #define LV2_PLUGIN_AMPLIFIER 0x000040
  218. #define LV2_PLUGIN_COMPRESSOR 0x000080
  219. #define LV2_PLUGIN_ENVELOPE 0x000100
  220. #define LV2_PLUGIN_EXPANDER 0x000200
  221. #define LV2_PLUGIN_GATE 0x000400
  222. #define LV2_PLUGIN_LIMITER 0x000800
  223. #define LV2_PLUGIN_EQ 0x001000
  224. #define LV2_PLUGIN_MULTI_EQ 0x002000
  225. #define LV2_PLUGIN_PARA_EQ 0x004000
  226. #define LV2_PLUGIN_FILTER 0x008000
  227. #define LV2_PLUGIN_ALLPASS 0x010000
  228. #define LV2_PLUGIN_BANDPASS 0x020000
  229. #define LV2_PLUGIN_COMB 0x040000
  230. #define LV2_PLUGIN_HIGHPASS 0x080000
  231. #define LV2_PLUGIN_LOWPASS 0x100000
  232. #define LV2_PLUGIN_GENERATOR 0x000001
  233. #define LV2_PLUGIN_CONSTANT 0x000002
  234. #define LV2_PLUGIN_INSTRUMENT 0x000004
  235. #define LV2_PLUGIN_OSCILLATOR 0x000008
  236. #define LV2_PLUGIN_MODULATOR 0x000010
  237. #define LV2_PLUGIN_CHORUS 0x000020
  238. #define LV2_PLUGIN_FLANGER 0x000040
  239. #define LV2_PLUGIN_PHASER 0x000080
  240. #define LV2_PLUGIN_SPATIAL 0x000100
  241. #define LV2_PLUGIN_SPECTRAL 0x000200
  242. #define LV2_PLUGIN_PITCH 0x000400
  243. #define LV2_PLUGIN_UTILITY 0x000800
  244. #define LV2_PLUGIN_ANALYSER 0x001000
  245. #define LV2_PLUGIN_CONVERTER 0x002000
  246. #define LV2_PLUGIN_FUNCTION 0x008000
  247. #define LV2_PLUGIN_MIXER 0x010000
  248. #define LV2_GROUP_DELAY (LV2_PLUGIN_DELAY|LV2_PLUGIN_REVERB)
  249. #define LV2_GROUP_DISTORTION (LV2_PLUGIN_DISTORTION|LV2_PLUGIN_WAVESHAPER)
  250. #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)
  251. #define LV2_GROUP_EQ (LV2_PLUGIN_EQ|LV2_PLUGIN_MULTI_EQ|LV2_PLUGIN_PARA_EQ)
  252. #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)
  253. #define LV2_GROUP_GENERATOR (LV2_PLUGIN_GENERATOR|LV2_PLUGIN_CONSTANT|LV2_PLUGIN_INSTRUMENT|LV2_PLUGIN_OSCILLATOR)
  254. #define LV2_GROUP_MODULATOR (LV2_PLUGIN_MODULATOR|LV2_PLUGIN_CHORUS|LV2_PLUGIN_FLANGER|LV2_PLUGIN_PHASER)
  255. #define LV2_GROUP_REVERB (LV2_PLUGIN_REVERB)
  256. #define LV2_GROUP_SIMULATOR (LV2_PLUGIN_SIMULATOR|LV2_PLUGIN_REVERB)
  257. #define LV2_GROUP_SPATIAL (LV2_PLUGIN_SPATIAL)
  258. #define LV2_GROUP_SPECTRAL (LV2_PLUGIN_SPECTRAL|LV2_PLUGIN_PITCH)
  259. #define LV2_GROUP_UTILITY (LV2_PLUGIN_UTILITY|LV2_PLUGIN_ANALYSER|LV2_PLUGIN_CONVERTER|LV2_PLUGIN_FUNCTION|LV2_PLUGIN_MIXER)
  260. #define LV2_IS_DELAY(x, y) (((x) & LV2_GROUP_DELAY) || ((y) & LV2_GROUP_DELAY))
  261. #define LV2_IS_DISTORTION(x, y) (((x) & LV2_GROUP_DISTORTION) || ((y) & LV2_GROUP_DISTORTION))
  262. #define LV2_IS_DYNAMICS(x, y) (((x) & LV2_GROUP_DYNAMICS) || ((y) & LV2_GROUP_DYNAMICS))
  263. #define LV2_IS_EQ(x, y) (((x) & LV2_GROUP_EQ) || ((y) & LV2_GROUP_EQ))
  264. #define LV2_IS_FILTER(x, y) (((x) & LV2_GROUP_FILTER) || ((y) & LV2_GROUP_FILTER))
  265. #define LV2_IS_GENERATOR(x, y) (((x) & LV2_GROUP_GENERATOR) || ((y) & LV2_GROUP_GENERATOR))
  266. #define LV2_IS_MODULATOR(x, y) (((x) & LV2_GROUP_MODULATOR) || ((y) & LV2_GROUP_MODULATOR))
  267. #define LV2_IS_REVERB(x, y) (((x) & LV2_GROUP_REVERB) || ((y) & LV2_GROUP_REVERB))
  268. #define LV2_IS_SIMULATOR(x, y) (((x) & LV2_GROUP_SIMULATOR) || ((y) & LV2_GROUP_SIMULATOR))
  269. #define LV2_IS_SPATIAL(x, y) (((x) & LV2_GROUP_SPATIAL) || ((y) & LV2_GROUP_SPATIAL))
  270. #define LV2_IS_SPECTRAL(x, y) (((x) & LV2_GROUP_SPECTRAL) || ((y) & LV2_GROUP_SPECTRAL))
  271. #define LV2_IS_UTILITY(x, y) (((x) & LV2_GROUP_UTILITY) || ((y) & LV2_GROUP_UTILITY))
  272. // Port Midi Map
  273. struct LV2_RDF_PortMidiMap {
  274. LV2_Property Type;
  275. uint32_t Number;
  276. LV2_RDF_PortMidiMap()
  277. : Type(0),
  278. Number(0) {}
  279. };
  280. // Port Points
  281. struct LV2_RDF_PortPoints {
  282. LV2_Property Hints;
  283. float Default;
  284. float Minimum;
  285. float Maximum;
  286. LV2_RDF_PortPoints()
  287. : Hints(0x0),
  288. Default(0.0f),
  289. Minimum(0.0f),
  290. Maximum(1.0f) {}
  291. };
  292. // Port Unit
  293. struct LV2_RDF_PortUnit {
  294. LV2_Property Hints;
  295. const char* Name;
  296. const char* Render;
  297. const char* Symbol;
  298. LV2_Property Unit;
  299. LV2_RDF_PortUnit()
  300. : Hints(0x0),
  301. Name(nullptr),
  302. Render(nullptr),
  303. Symbol(nullptr),
  304. Unit(0) {}
  305. ~LV2_RDF_PortUnit()
  306. {
  307. if (Name)
  308. ::free((void*)Name);
  309. if (Render)
  310. ::free((void*)Render);
  311. if (Symbol)
  312. ::free((void*)Symbol);
  313. }
  314. };
  315. // Port Scale Point
  316. struct LV2_RDF_PortScalePoint {
  317. const char* Label;
  318. float Value;
  319. LV2_RDF_PortScalePoint()
  320. : Label(nullptr),
  321. Value(0.0f) {}
  322. ~LV2_RDF_PortScalePoint()
  323. {
  324. if (Label)
  325. ::free((void*)Label);
  326. }
  327. };
  328. // Port
  329. struct LV2_RDF_Port {
  330. LV2_Property Types;
  331. LV2_Property Properties;
  332. LV2_Property Designation;
  333. const char* Name;
  334. const char* Symbol;
  335. LV2_RDF_PortMidiMap MidiMap;
  336. LV2_RDF_PortPoints Points;
  337. LV2_RDF_PortUnit Unit;
  338. uint32_t ScalePointCount;
  339. LV2_RDF_PortScalePoint* ScalePoints;
  340. LV2_RDF_Port()
  341. : Types(0x0),
  342. Properties(0x0),
  343. Designation(0),
  344. Name(nullptr),
  345. Symbol(nullptr),
  346. ScalePointCount(0),
  347. ScalePoints(nullptr) {}
  348. ~LV2_RDF_Port()
  349. {
  350. if (Name)
  351. ::free((void*)Name);
  352. if (Symbol)
  353. ::free((void*)Symbol);
  354. if (ScalePoints)
  355. delete[] ScalePoints;
  356. }
  357. };
  358. // Preset
  359. struct LV2_RDF_Preset {
  360. LV2_URI URI;
  361. const char* Label;
  362. LV2_RDF_Preset()
  363. : URI(nullptr),
  364. Label(nullptr) {}
  365. ~LV2_RDF_Preset()
  366. {
  367. if (URI)
  368. ::free((void*)URI);
  369. if (Label)
  370. ::free((void*)Label);
  371. }
  372. };
  373. // Feature
  374. struct LV2_RDF_Feature {
  375. LV2_Property Type;
  376. LV2_URI URI;
  377. LV2_RDF_Feature()
  378. : Type(0),
  379. URI(nullptr) {}
  380. ~LV2_RDF_Feature()
  381. {
  382. if (URI)
  383. ::free((void*)URI);
  384. }
  385. };
  386. // UI
  387. struct LV2_RDF_UI {
  388. LV2_Type Type;
  389. LV2_URI URI;
  390. const char* Binary;
  391. const char* Bundle;
  392. uint32_t FeatureCount;
  393. LV2_RDF_Feature* Features;
  394. uint32_t ExtensionCount;
  395. LV2_URI* Extensions;
  396. LV2_RDF_UI()
  397. : URI(nullptr),
  398. Binary(nullptr),
  399. Bundle(nullptr),
  400. FeatureCount(0),
  401. Features(nullptr),
  402. ExtensionCount(0),
  403. Extensions(nullptr) {}
  404. ~LV2_RDF_UI()
  405. {
  406. if (URI)
  407. ::free((void*)URI);
  408. if (Binary)
  409. ::free((void*)Binary);
  410. if (Bundle)
  411. ::free((void*)Bundle);
  412. if (Features)
  413. delete[] Features;
  414. if (Extensions)
  415. delete[] Extensions;
  416. }
  417. };
  418. // Plugin
  419. struct LV2_RDF_Descriptor {
  420. LV2_Property Type[2];
  421. LV2_URI URI;
  422. const char* Name;
  423. const char* Author;
  424. const char* License;
  425. const char* Binary;
  426. const char* Bundle;
  427. unsigned long UniqueID;
  428. uint32_t PortCount;
  429. LV2_RDF_Port* Ports;
  430. uint32_t PresetCount;
  431. LV2_RDF_Preset* Presets;
  432. uint32_t FeatureCount;
  433. LV2_RDF_Feature* Features;
  434. uint32_t ExtensionCount;
  435. LV2_URI* Extensions;
  436. uint32_t UICount;
  437. LV2_RDF_UI* UIs;
  438. LV2_RDF_Descriptor()
  439. : Type{0x0, 0x0},
  440. URI(nullptr),
  441. Name(nullptr),
  442. Author(nullptr),
  443. License(nullptr),
  444. Binary(nullptr),
  445. Bundle(nullptr),
  446. UniqueID(0),
  447. PortCount(0),
  448. Ports(nullptr),
  449. PresetCount(0),
  450. Presets(nullptr),
  451. FeatureCount(0),
  452. Features(nullptr),
  453. ExtensionCount(0),
  454. Extensions(nullptr),
  455. UICount(0),
  456. UIs(nullptr) {}
  457. ~LV2_RDF_Descriptor()
  458. {
  459. if (URI)
  460. ::free((void*)URI);
  461. if (Name)
  462. ::free((void*)Name);
  463. if (Author)
  464. ::free((void*)Author);
  465. if (License)
  466. ::free((void*)License);
  467. if (Binary)
  468. ::free((void*)Binary);
  469. if (Bundle)
  470. ::free((void*)Bundle);
  471. if (Ports)
  472. delete[] Ports;
  473. if (Presets)
  474. delete[] Presets;
  475. if (Features)
  476. delete[] Features;
  477. if (Extensions)
  478. delete[] Extensions;
  479. if (UIs)
  480. delete[] UIs;
  481. }
  482. };
  483. #endif // LV2_RDF_INCLUDED