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.

624 lines
21KB

  1. /*
  2. * Custom types to store LV2 information
  3. * Copyright (C) 2011-2012 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. // TODO - presets
  20. #include <cstdint>
  21. #include <cstdlib>
  22. // Base Types
  23. typedef const char* LV2_URI;
  24. typedef uint32_t LV2_Property;
  25. typedef unsigned long long LV2_PluginType;
  26. struct LV2_Type {
  27. LV2_Property Value; //...
  28. LV2_URI URI;
  29. LV2_Type()
  30. : Value(0),
  31. URI(nullptr) {}
  32. ~LV2_Type()
  33. {
  34. if (URI)
  35. ::free((void*)URI);
  36. }
  37. };
  38. // Port Midi Map Types
  39. #define LV2_PORT_MIDI_MAP_CC 0x1
  40. #define LV2_PORT_MIDI_MAP_NRPN 0x2
  41. #define LV2_IS_PORT_MIDI_MAP_CC(x) ((x) == LV2_PORT_MIDI_MAP_CC)
  42. #define LV2_IS_PORT_MIDI_MAP_NRPN(x) ((x) == LV2_PORT_MIDI_MAP_NRPN)
  43. // Port Point Hints
  44. #define LV2_PORT_POINT_DEFAULT 0x1
  45. #define LV2_PORT_POINT_MINIMUM 0x2
  46. #define LV2_PORT_POINT_MAXIMUM 0x4
  47. #define LV2_HAVE_DEFAULT_PORT_POINT(x) ((x) & LV2_PORT_POINT_DEFAULT)
  48. #define LV2_HAVE_MINIMUM_PORT_POINT(x) ((x) & LV2_PORT_POINT_MINIMUM)
  49. #define LV2_HAVE_MAXIMUM_PORT_POINT(x) ((x) & LV2_PORT_POINT_MAXIMUM)
  50. // Port Unit Hints
  51. #define LV2_PORT_UNIT_NAME 0x1
  52. #define LV2_PORT_UNIT_RENDER 0x2
  53. #define LV2_PORT_UNIT_SYMBOL 0x4
  54. #define LV2_PORT_UNIT_UNIT 0x8
  55. #define LV2_HAVE_PORT_UNIT_NAME(x) ((x) & LV2_PORT_UNIT_NAME)
  56. #define LV2_HAVE_PORT_UNIT_RENDER(x) ((x) & LV2_PORT_UNIT_RENDER)
  57. #define LV2_HAVE_PORT_UNIT_SYMBOL(x) ((x) & LV2_PORT_UNIT_SYMBOL)
  58. #define LV2_HAVE_PORT_UNIT_UNIT(x) ((x) & LV2_PORT_UNIT_UNIT)
  59. // Port Unit Unit
  60. #define LV2_PORT_UNIT_BAR 0x01
  61. #define LV2_PORT_UNIT_BEAT 0x02
  62. #define LV2_PORT_UNIT_BPM 0x03
  63. #define LV2_PORT_UNIT_CENT 0x04
  64. #define LV2_PORT_UNIT_CM 0x05
  65. #define LV2_PORT_UNIT_COEF 0x06
  66. #define LV2_PORT_UNIT_DB 0x07
  67. #define LV2_PORT_UNIT_DEGREE 0x08
  68. #define LV2_PORT_UNIT_FRAME 0x09
  69. #define LV2_PORT_UNIT_HZ 0x0A
  70. #define LV2_PORT_UNIT_INCH 0x0B
  71. #define LV2_PORT_UNIT_KHZ 0x0C
  72. #define LV2_PORT_UNIT_KM 0x0D
  73. #define LV2_PORT_UNIT_M 0x0E
  74. #define LV2_PORT_UNIT_MHZ 0x0F
  75. #define LV2_PORT_UNIT_MIDINOTE 0x10
  76. #define LV2_PORT_UNIT_MILE 0x11
  77. #define LV2_PORT_UNIT_MIN 0x12
  78. #define LV2_PORT_UNIT_MM 0x13
  79. #define LV2_PORT_UNIT_MS 0x14
  80. #define LV2_PORT_UNIT_OCT 0x15
  81. #define LV2_PORT_UNIT_PC 0x16
  82. #define LV2_PORT_UNIT_S 0x17
  83. #define LV2_PORT_UNIT_SEMITONE 0x18
  84. #define LV2_IS_PORT_UNIT_BAR(x) ((x) == LV2_PORT_UNIT_BAR)
  85. #define LV2_IS_PORT_UNIT_BEAT(x) ((x) == LV2_PORT_UNIT_BEAT)
  86. #define LV2_IS_PORT_UNIT_BPM(x) ((x) == LV2_PORT_UNIT_BPM)
  87. #define LV2_IS_PORT_UNIT_CENT(x) ((x) == LV2_PORT_UNIT_CENT)
  88. #define LV2_IS_PORT_UNIT_CM(x) ((x) == LV2_PORT_UNIT_CM)
  89. #define LV2_IS_PORT_UNIT_COEF(x) ((x) == LV2_PORT_UNIT_COEF)
  90. #define LV2_IS_PORT_UNIT_DB(x) ((x) == LV2_PORT_UNIT_DB)
  91. #define LV2_IS_PORT_UNIT_DEGREE(x) ((x) == LV2_PORT_UNIT_DEGREE)
  92. #define LV2_IS_PORT_UNIT_FRAME(x) ((x) == LV2_PORT_UNIT_FRAME)
  93. #define LV2_IS_PORT_UNIT_HZ(x) ((x) == LV2_PORT_UNIT_HZ)
  94. #define LV2_IS_PORT_UNIT_INCH(x) ((x) == LV2_PORT_UNIT_INCH)
  95. #define LV2_IS_PORT_UNIT_KHZ(x) ((x) == LV2_PORT_UNIT_KHZ)
  96. #define LV2_IS_PORT_UNIT_KM(x) ((x) == LV2_PORT_UNIT_KM)
  97. #define LV2_IS_PORT_UNIT_M(x) ((x) == LV2_PORT_UNIT_M)
  98. #define LV2_IS_PORT_UNIT_MHZ(x) ((x) == LV2_PORT_UNIT_MHZ)
  99. #define LV2_IS_PORT_UNIT_MIDINOTE(x) ((x) == LV2_PORT_UNIT_MIDINOTE)
  100. #define LV2_IS_PORT_UNIT_MILE(x) ((x) == LV2_PORT_UNIT_MILE)
  101. #define LV2_IS_PORT_UNIT_MIN(x) ((x) == LV2_PORT_UNIT_MIN)
  102. #define LV2_IS_PORT_UNIT_MM(x) ((x) == LV2_PORT_UNIT_MM)
  103. #define LV2_IS_PORT_UNIT_MS(x) ((x) == LV2_PORT_UNIT_MS)
  104. #define LV2_IS_PORT_UNIT_OCT(x) ((x) == LV2_PORT_UNIT_OCT)
  105. #define LV2_IS_PORT_UNIT_PC(x) ((x) == LV2_PORT_UNIT_PC)
  106. #define LV2_IS_PORT_UNIT_S(x) ((x) == LV2_PORT_UNIT_S)
  107. #define LV2_IS_PORT_UNIT_SEMITONE(x) ((x) == LV2_PORT_UNIT_SEMITONE)
  108. // Port Types
  109. #define LV2_PORT_INPUT 0x01
  110. #define LV2_PORT_OUTPUT 0x02
  111. #define LV2_PORT_CONTROL 0x04
  112. #define LV2_PORT_AUDIO 0x08
  113. #define LV2_PORT_CV 0x10
  114. #define LV2_PORT_ATOM 0x20
  115. #define LV2_PORT_ATOM_SEQUENCE (0x40 | LV2_PORT_ATOM)
  116. #define LV2_PORT_EVENT 0x80
  117. #define LV2_PORT_MIDI_LL 0x100
  118. // Port Data Types
  119. #define LV2_PORT_DATA_MIDI_EVENT 0x1000
  120. #define LV2_PORT_DATA_PATCH_MESSAGE 0x2000
  121. #define LV2_IS_PORT_INPUT(x) ((x) & LV2_PORT_INPUT)
  122. #define LV2_IS_PORT_OUTPUT(x) ((x) & LV2_PORT_OUTPUT)
  123. #define LV2_IS_PORT_CONTROL(x) ((x) & LV2_PORT_CONTROL)
  124. #define LV2_IS_PORT_AUDIO(x) ((x) & LV2_PORT_AUDIO)
  125. #define LV2_IS_PORT_ATOM_SEQUENCE(x) ((x) & LV2_PORT_ATOM_SEQUENCE)
  126. #define LV2_IS_PORT_CV(x) ((x) & LV2_PORT_CV)
  127. #define LV2_IS_PORT_EVENT(x) ((x) & LV2_PORT_EVENT)
  128. #define LV2_IS_PORT_MIDI_LL(x) ((x) & LV2_PORT_MIDI_LL)
  129. #define LV2_PORT_SUPPORTS_MIDI_EVENT ((x) & LV2_PORT_DATA_MIDI_EVENT)
  130. #define LV2_PORT_SUPPORTS_PATCH_MESSAGE ((x) & LV2_PORT_DATA_PATCH_MESSAGE)
  131. // Port Properties
  132. #define LV2_PORT_OPTIONAL 0x0001
  133. #define LV2_PORT_ENUMERATION 0x0002
  134. #define LV2_PORT_INTEGER 0x0004
  135. #define LV2_PORT_SAMPLE_RATE 0x0008
  136. #define LV2_PORT_TOGGLED 0x0010
  137. #define LV2_PORT_CAUSES_ARTIFACTS 0x0020
  138. #define LV2_PORT_CONTINUOUS_CV 0x0040
  139. #define LV2_PORT_DISCRETE_CV 0x0080
  140. #define LV2_PORT_EXPENSIVE 0x0100
  141. #define LV2_PORT_STRICT_BOUNDS 0x0200
  142. #define LV2_PORT_LOGARITHMIC 0x0400
  143. #define LV2_PORT_NOT_AUTOMATIC 0x0800
  144. #define LV2_PORT_NOT_ON_GUI 0x1000
  145. #define LV2_PORT_TRIGGER 0x2000
  146. #define LV2_IS_PORT_OPTIONAL(x) ((x) & LV2_PORT_OPTIONAL)
  147. #define LV2_IS_PORT_ENUMERATION(x) ((x) & LV2_PORT_ENUMERATION)
  148. #define LV2_IS_PORT_INTEGER(x) ((x) & LV2_PORT_INTEGER)
  149. #define LV2_IS_PORT_SAMPLE_RATE(x) ((x) & LV2_PORT_SAMPLE_RATE)
  150. #define LV2_IS_PORT_TOGGLED(x) ((x) & LV2_PORT_TOGGLED)
  151. #define LV2_IS_PORT_CAUSES_ARTIFACTS(x) ((x) & LV2_PORT_CAUSES_ARTIFACTS)
  152. #define LV2_IS_PORT_CONTINUOUS_CV(x) ((x) & LV2_PORT_CONTINUOUS_CV)
  153. #define LV2_IS_PORT_DISCRETE_CV(x) ((x) & LV2_PORT_DISCRETE_CV)
  154. #define LV2_IS_PORT_EXPENSIVE(x) ((x) & LV2_PORT_EXPENSIVE)
  155. #define LV2_IS_PORT_STRICT_BOUNDS(x) ((x) & LV2_PORT_STRICT_BOUNDS)
  156. #define LV2_IS_PORT_LOGARITHMIC(x) ((x) & LV2_PORT_LOGARITHMIC)
  157. #define LV2_IS_PORT_NOT_AUTOMATIC(x) ((x) & LV2_PORT_NOT_AUTOMATIC)
  158. #define LV2_IS_PORT_NOT_ON_GUI(x) ((x) & LV2_PORT_NOT_ON_GUI)
  159. #define LV2_IS_PORT_TRIGGER(x) ((x) & LV2_PORT_TRIGGER)
  160. // Port Designation
  161. #define LV2_PORT_DESIGNATION_FREEWHEELING 0x1
  162. #define LV2_PORT_DESIGNATION_LATENCY 0x2
  163. #define LV2_PORT_DESIGNATION_SAMPLE_RATE 0x3
  164. #define LV2_PORT_DESIGNATION_TIME_BAR 0x4
  165. #define LV2_PORT_DESIGNATION_TIME_BAR_BEAT 0x5
  166. #define LV2_PORT_DESIGNATION_TIME_BEAT 0x6
  167. #define LV2_PORT_DESIGNATION_TIME_BEAT_UNIT 0x7
  168. #define LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR 0x8
  169. #define LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE 0x9
  170. #define LV2_PORT_DESIGNATION_TIME_FRAME 0xA
  171. #define LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND 0xB
  172. #define LV2_PORT_DESIGNATION_TIME_POSITION 0xC
  173. #define LV2_PORT_DESIGNATION_TIME_SPEED 0xD
  174. #define LV2_IS_PORT_DESIGNATION_FREEWHEELING(x) ((x) == LV2_PORT_DESIGNATION_FREEWHEELING)
  175. #define LV2_IS_PORT_DESIGNATION_LATENCY(x) ((x) == LV2_PORT_DESIGNATION_LATENCY)
  176. #define LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(x) ((x) == LV2_PORT_DESIGNATION_SAMPLE_RATE)
  177. #define LV2_IS_PORT_DESIGNATION_TIME_BAR(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR)
  178. #define LV2_IS_PORT_DESIGNATION_TIME_BAR_BEAT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR_BEAT)
  179. #define LV2_IS_PORT_DESIGNATION_TIME_BEAT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEAT)
  180. #define LV2_IS_PORT_DESIGNATION_TIME_BEAT_UNIT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEAT_UNIT)
  181. #define LV2_IS_PORT_DESIGNATION_TIME_BEATS_PER_BAR(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR)
  182. #define LV2_IS_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE)
  183. #define LV2_IS_PORT_DESIGNATION_TIME_FRAME(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAME)
  184. #define LV2_IS_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND)
  185. #define LV2_IS_PORT_DESIGNATION_TIME_POSITION(x) ((x) == LV2_PORT_DESIGNATION_TIME_POSITION)
  186. #define LV2_IS_PORT_DESIGNATION_TIME_SPEED(x) ((x) == LV2_PORT_DESIGNATION_TIME_SPEED)
  187. #define LV2_IS_PORT_DESIGNATION_TIME(x) ((x) >= LV2_PORT_DESIGNATION_TIME_BAR && (x) <= LV2_PORT_DESIGNATION_TIME_SPEED)
  188. // Preset State Types (TODO: Null is not a type, this is just a placeholder)
  189. #define LV2_PRESET_STATE_NULL 0x0
  190. #define LV2_IS_PRESET_STATE_NULL(x) ((x) == LV2_PRESET_STATE_NULL)
  191. // Feature Types
  192. #define LV2_FEATURE_OPTIONAL 0x1
  193. #define LV2_FEATURE_REQUIRED 0x2
  194. #define LV2_IS_FEATURE_OPTIONAL(x) ((x) == LV2_FEATURE_OPTIONAL)
  195. #define LV2_IS_FEATURE_REQUIRED(x) ((x) == LV2_FEATURE_REQUIRED)
  196. // UI Types
  197. #define LV2_UI_GTK2 0x1
  198. #define LV2_UI_GTK3 0x2
  199. #define LV2_UI_QT4 0x3
  200. #define LV2_UI_QT5 0x4
  201. #define LV2_UI_COCOA 0x5
  202. #define LV2_UI_WINDOWS 0x6
  203. #define LV2_UI_X11 0x7
  204. #define LV2_UI_EXTERNAL 0x8
  205. #define LV2_UI_OLD_EXTERNAL 0x9
  206. #define LV2_IS_UI_GTK2(x) ((x) == LV2_UI_GTK2)
  207. #define LV2_IS_UI_GTK3(x) ((x) == LV2_UI_GTK3)
  208. #define LV2_IS_UI_QT4(x) ((x) == LV2_UI_QT4)
  209. #define LV2_IS_UI_QT5(x) ((x) == LV2_UI_QT5)
  210. #define LV2_IS_UI_COCOA(x) ((x) == LV2_UI_COCOA)
  211. #define LV2_IS_UI_WINDOWS(x) ((x) == LV2_UI_WINDOWS)
  212. #define LV2_IS_UI_X11(x) ((x) == LV2_UI_X11)
  213. #define LV2_IS_UI_EXTERNAL(x) ((x) == LV2_UI_EXTERNAL)
  214. #define LV2_IS_UI_OLD_EXTERNAL(x) ((x) == LV2_UI_OLD_EXTERNAL)
  215. // Plugin Types
  216. #define LV2_PLUGIN_ALLPASS 0x000000001LL
  217. #define LV2_PLUGIN_AMPLIFIER 0x000000002LL
  218. #define LV2_PLUGIN_ANALYSER 0x000000004LL
  219. #define LV2_PLUGIN_BANDPASS 0x000000008LL
  220. #define LV2_PLUGIN_CHORUS 0x000000010LL
  221. #define LV2_PLUGIN_COMB 0x000000020LL
  222. #define LV2_PLUGIN_COMPRESSOR 0x000000040LL
  223. #define LV2_PLUGIN_CONSTANT 0x000000080LL
  224. #define LV2_PLUGIN_CONVERTER 0x000000100LL
  225. #define LV2_PLUGIN_DELAY 0x000000200LL
  226. #define LV2_PLUGIN_DISTORTION 0x000000400LL
  227. #define LV2_PLUGIN_DYNAMICS 0x000000800LL
  228. #define LV2_PLUGIN_EQ 0x000001000LL
  229. #define LV2_PLUGIN_EXPANDER 0x000002000LL
  230. #define LV2_PLUGIN_FILTER 0x000004000LL
  231. #define LV2_PLUGIN_FLANGER 0x000008000LL
  232. #define LV2_PLUGIN_FUNCTION 0x000010000LL
  233. #define LV2_PLUGIN_GATE 0x000020000LL
  234. #define LV2_PLUGIN_GENERATOR 0x000040000LL
  235. #define LV2_PLUGIN_HIGHPASS 0x000080000LL
  236. #define LV2_PLUGIN_INSTRUMENT 0x000100000LL
  237. #define LV2_PLUGIN_LIMITER 0x000200000LL
  238. #define LV2_PLUGIN_LOWPASS 0x000400000LL
  239. #define LV2_PLUGIN_MIXER 0x000800000LL
  240. #define LV2_PLUGIN_MODULATOR 0x001000000LL
  241. #define LV2_PLUGIN_MULTI_EQ 0x002000000LL
  242. #define LV2_PLUGIN_OSCILLATOR 0x004000000LL
  243. #define LV2_PLUGIN_PARA_EQ 0x008000000LL
  244. #define LV2_PLUGIN_PHASER 0x010000000LL
  245. #define LV2_PLUGIN_PITCH 0x020000000LL
  246. #define LV2_PLUGIN_REVERB 0x040000000LL
  247. #define LV2_PLUGIN_SIMULATOR 0x080000000LL
  248. #define LV2_PLUGIN_SPATIAL 0x100000000LL
  249. #define LV2_PLUGIN_SPECTRAL 0x200000000LL
  250. #define LV2_PLUGIN_UTILITY 0x400000000LL
  251. #define LV2_PLUGIN_WAVESHAPER 0x800000000LL
  252. #define LV2_GROUP_DELAY (LV2_PLUGIN_DELAY|LV2_PLUGIN_REVERB)
  253. #define LV2_GROUP_DISTORTION (LV2_PLUGIN_DISTORTION|LV2_PLUGIN_WAVESHAPER)
  254. #define LV2_GROUP_DYNAMICS (LV2_PLUGIN_DYNAMICS|LV2_PLUGIN_AMPLIFIER|LV2_PLUGIN_COMPRESSOR|LV2_PLUGIN_EXPANDER|LV2_PLUGIN_GATE|LV2_PLUGIN_LIMITER)
  255. #define LV2_GROUP_EQ (LV2_PLUGIN_EQ|LV2_PLUGIN_PARA_EQ|LV2_PLUGIN_MULTI_EQ)
  256. #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)
  257. #define LV2_GROUP_GENERATOR (LV2_PLUGIN_GENERATOR|LV2_PLUGIN_CONSTANT|LV2_PLUGIN_INSTRUMENT|LV2_PLUGIN_OSCILLATOR)
  258. #define LV2_GROUP_MODULATOR (LV2_PLUGIN_MODULATOR|LV2_PLUGIN_CHORUS|LV2_PLUGIN_FLANGER|LV2_PLUGIN_PHASER)
  259. #define LV2_GROUP_REVERB (LV2_PLUGIN_REVERB)
  260. #define LV2_GROUP_SIMULATOR (LV2_PLUGIN_SIMULATOR|LV2_PLUGIN_REVERB)
  261. #define LV2_GROUP_SPATIAL (LV2_PLUGIN_SPATIAL)
  262. #define LV2_GROUP_SPECTRAL (LV2_PLUGIN_SPECTRAL|LV2_PLUGIN_PITCH)
  263. #define LV2_GROUP_UTILITY (LV2_PLUGIN_UTILITY|LV2_PLUGIN_ANALYSER|LV2_PLUGIN_CONVERTER|LV2_PLUGIN_FUNCTION|LV2_PLUGIN_MIXER)
  264. #define LV2_IS_DELAY(x) ((x) & LV2_GROUP_DELAY)
  265. #define LV2_IS_DISTORTION(x) ((x) & LV2_GROUP_DISTORTION)
  266. #define LV2_IS_DYNAMICS(x) ((x) & LV2_GROUP_DYNAMICS)
  267. #define LV2_IS_EQ(x) ((x) & LV2_GROUP_EQ)
  268. #define LV2_IS_FILTER(x) ((x) & LV2_GROUP_FILTER)
  269. #define LV2_IS_GENERATOR(x) ((x) & LV2_GROUP_GENERATOR)
  270. #define LV2_IS_MODULATOR(x) ((x) & LV2_GROUP_MODULATOR)
  271. #define LV2_IS_REVERB(x) ((x) & LV2_GROUP_REVERB)
  272. #define LV2_IS_SIMULATOR(x) ((x) & LV2_GROUP_SIMULATOR)
  273. #define LV2_IS_SPATIAL(x) ((x) & LV2_GROUP_SPATIAL)
  274. #define LV2_IS_SPECTRAL(x) ((x) & LV2_GROUP_SPECTRAL)
  275. #define LV2_IS_UTILITY(x) ((x) & LV2_GROUP_UTILITY)
  276. // Port Midi Map
  277. struct LV2_RDF_PortMidiMap {
  278. LV2_Property Type;
  279. uint32_t Number;
  280. LV2_RDF_PortMidiMap()
  281. : Type(0),
  282. Number(0) {}
  283. };
  284. // Port Points
  285. struct LV2_RDF_PortPoints {
  286. LV2_Property Hints;
  287. float Default;
  288. float Minimum;
  289. float Maximum;
  290. LV2_RDF_PortPoints()
  291. : Hints(0x0),
  292. Default(0.0f),
  293. Minimum(0.0f),
  294. Maximum(1.0f) {}
  295. };
  296. // Port Unit
  297. struct LV2_RDF_PortUnit {
  298. LV2_Property Hints;
  299. const char* Name;
  300. const char* Render;
  301. const char* Symbol;
  302. LV2_Property Unit;
  303. LV2_RDF_PortUnit()
  304. : Hints(0x0),
  305. Name(nullptr),
  306. Render(nullptr),
  307. Symbol(nullptr),
  308. Unit(0) {}
  309. ~LV2_RDF_PortUnit()
  310. {
  311. if (Name)
  312. ::free((void*)Name);
  313. if (Render)
  314. ::free((void*)Render);
  315. if (Symbol)
  316. ::free((void*)Symbol);
  317. }
  318. };
  319. // Port Scale Point
  320. struct LV2_RDF_PortScalePoint {
  321. const char* Label;
  322. float Value;
  323. LV2_RDF_PortScalePoint()
  324. : Label(nullptr),
  325. Value(0.0f) {}
  326. ~LV2_RDF_PortScalePoint()
  327. {
  328. if (Label)
  329. ::free((void*)Label);
  330. }
  331. };
  332. // Port
  333. struct LV2_RDF_Port {
  334. LV2_Type Type;
  335. LV2_Property Properties;
  336. LV2_Property Designation;
  337. const char* Name;
  338. const char* Symbol;
  339. LV2_RDF_PortMidiMap MidiMap;
  340. LV2_RDF_PortPoints Points;
  341. LV2_RDF_PortUnit Unit;
  342. uint32_t ScalePointCount;
  343. LV2_RDF_PortScalePoint* ScalePoints;
  344. LV2_RDF_Port()
  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 Port
  362. struct LV2_RDF_PresetPort {
  363. const char* Symbol;
  364. float Value;
  365. LV2_RDF_PresetPort()
  366. : Symbol(nullptr),
  367. Value(0.0f) {}
  368. ~LV2_RDF_PresetPort()
  369. {
  370. if (Symbol)
  371. ::free((void*)Symbol);
  372. }
  373. };
  374. // Preset State
  375. struct LV2_RDF_PresetState {
  376. LV2_Property Type;
  377. const char* Key;
  378. union {
  379. // TODO
  380. } Value;
  381. LV2_RDF_PresetState()
  382. : Type(0),
  383. Key(nullptr) {}
  384. ~LV2_RDF_PresetState()
  385. {
  386. if (Key)
  387. ::free((void*)Key);
  388. }
  389. };
  390. // Preset
  391. struct LV2_RDF_Preset {
  392. LV2_URI URI;
  393. const char* Label;
  394. uint32_t PortCount;
  395. LV2_RDF_PresetPort* Ports;
  396. uint32_t StateCount;
  397. LV2_RDF_PresetState* States;
  398. LV2_RDF_Preset()
  399. : URI(nullptr),
  400. Label(nullptr),
  401. PortCount(0),
  402. Ports(nullptr),
  403. StateCount(0),
  404. States(nullptr) {}
  405. ~LV2_RDF_Preset()
  406. {
  407. if (URI)
  408. ::free((void*)URI);
  409. if (Label)
  410. ::free((void*)Label);
  411. if (Ports)
  412. delete[] Ports;
  413. if (States)
  414. delete[] States;
  415. }
  416. };
  417. // Feature
  418. struct LV2_RDF_Feature {
  419. LV2_Property Type;
  420. LV2_URI URI;
  421. LV2_RDF_Feature()
  422. : Type(0),
  423. URI(nullptr) {}
  424. ~LV2_RDF_Feature()
  425. {
  426. if (URI)
  427. ::free((void*)URI);
  428. }
  429. };
  430. // UI
  431. struct LV2_RDF_UI {
  432. LV2_Type Type;
  433. LV2_URI URI;
  434. const char* Binary;
  435. const char* Bundle;
  436. uint32_t FeatureCount;
  437. LV2_RDF_Feature* Features;
  438. uint32_t ExtensionCount;
  439. LV2_URI* Extensions;
  440. LV2_RDF_UI()
  441. : URI(nullptr),
  442. Binary(nullptr),
  443. Bundle(nullptr),
  444. FeatureCount(0),
  445. Features(nullptr),
  446. ExtensionCount(0),
  447. Extensions(nullptr) {}
  448. ~LV2_RDF_UI()
  449. {
  450. if (URI)
  451. ::free((void*)URI);
  452. if (Binary)
  453. ::free((void*)Binary);
  454. if (Bundle)
  455. ::free((void*)Bundle);
  456. if (Features)
  457. delete[] Features;
  458. if (Extensions)
  459. delete[] Extensions;
  460. }
  461. };
  462. // Plugin
  463. struct LV2_RDF_Descriptor {
  464. LV2_PluginType Type;
  465. LV2_URI URI;
  466. const char* Name;
  467. const char* Author;
  468. const char* License;
  469. const char* Binary;
  470. const char* Bundle;
  471. unsigned long UniqueID;
  472. uint32_t PortCount;
  473. LV2_RDF_Port* Ports;
  474. uint32_t PresetCount;
  475. LV2_RDF_Preset* Presets;
  476. uint32_t FeatureCount;
  477. LV2_RDF_Feature* Features;
  478. uint32_t ExtensionCount;
  479. LV2_URI* Extensions;
  480. uint32_t UICount;
  481. LV2_RDF_UI* UIs;
  482. LV2_RDF_Descriptor()
  483. : Type(0x0),
  484. URI(nullptr),
  485. Name(nullptr),
  486. Author(nullptr),
  487. License(nullptr),
  488. Binary(nullptr),
  489. Bundle(nullptr),
  490. UniqueID(0),
  491. PortCount(0),
  492. Ports(nullptr),
  493. PresetCount(0),
  494. Presets(nullptr),
  495. FeatureCount(0),
  496. Features(nullptr),
  497. ExtensionCount(0),
  498. Extensions(nullptr),
  499. UICount(0),
  500. UIs(nullptr) {}
  501. ~LV2_RDF_Descriptor()
  502. {
  503. if (URI)
  504. ::free((void*)URI);
  505. if (Name)
  506. ::free((void*)Name);
  507. if (Author)
  508. ::free((void*)Author);
  509. if (License)
  510. ::free((void*)License);
  511. if (Binary)
  512. ::free((void*)Binary);
  513. if (Bundle)
  514. ::free((void*)Bundle);
  515. if (Ports)
  516. delete[] Ports;
  517. if (Presets)
  518. delete[] Presets;
  519. if (Features)
  520. delete[] Features;
  521. if (Extensions)
  522. delete[] Extensions;
  523. if (UIs)
  524. delete[] UIs;
  525. }
  526. };
  527. #endif // LV2_RDF_INCLUDED