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.

CarlaLv2Utils.hpp 59KB

11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386
  1. /*
  2. * Carla LV2 utils
  3. * Copyright (C) 2011-2014 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 CARLA_LV2_UTILS_HPP_INCLUDED
  18. #define CARLA_LV2_UTILS_HPP_INCLUDED
  19. #include "CarlaUtils.hpp"
  20. #include "lv2/lv2.h"
  21. #include "lv2/atom.h"
  22. #include "lv2/atom-forge.h"
  23. #include "lv2/atom-helpers.h"
  24. #include "lv2/atom-util.h"
  25. #include "lv2/buf-size.h"
  26. #include "lv2/data-access.h"
  27. // dynmanifest
  28. #include "lv2/event.h"
  29. #include "lv2/event-helpers.h"
  30. #include "lv2/instance-access.h"
  31. #include "lv2/log.h"
  32. // logger
  33. #include "lv2/midi.h"
  34. // morph
  35. #include "lv2/options.h"
  36. #include "lv2/parameters.h"
  37. #include "lv2/patch.h"
  38. #include "lv2/port-groups.h"
  39. #include "lv2/port-props.h"
  40. #include "lv2/presets.h"
  41. #include "lv2/resize-port.h"
  42. #include "lv2/state.h"
  43. #include "lv2/time.h"
  44. #include "lv2/ui.h"
  45. #include "lv2/units.h"
  46. #include "lv2/uri-map.h"
  47. #include "lv2/urid.h"
  48. #include "lv2/worker.h"
  49. #include "lv2/lv2-miditype.h"
  50. #include "lv2/lv2-midifunctions.h"
  51. #include "lv2/lv2_external_ui.h"
  52. #include "lv2/lv2_programs.h"
  53. #include "lv2/lv2_rtmempool.h"
  54. #include "lv2_rdf.hpp"
  55. #include "lilv/lilvmm.hpp"
  56. #include "sratom/sratom.h"
  57. #include <QtCore/QStringList>
  58. // -----------------------------------------------------------------------
  59. // Define namespaces and missing prefixes
  60. #define NS_dct "http://purl.org/dc/terms/"
  61. #define NS_doap "http://usefulinc.com/ns/doap#"
  62. #define NS_rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  63. #define NS_rdfs "http://www.w3.org/2000/01/rdf-schema#"
  64. #define NS_llmm "http://ll-plugins.nongnu.org/lv2/ext/midimap#"
  65. #define LV2_MIDI_Map__CC "http://ll-plugins.nongnu.org/lv2/namespace#CC"
  66. #define LV2_MIDI_Map__NRPN "http://ll-plugins.nongnu.org/lv2/namespace#NRPN"
  67. #define LV2_MIDI_LL__MidiPort "http://ll-plugins.nongnu.org/lv2/ext/MidiPort"
  68. #define LV2_UI__Qt5UI LV2_UI_PREFIX "Qt5UI"
  69. #define LV2_UI__makeResident LV2_UI_PREFIX "makeResident"
  70. // -----------------------------------------------------------------------
  71. // Custom Atom types
  72. struct LV2_Atom_MidiEvent {
  73. LV2_Atom_Event event;
  74. uint8_t data[4];
  75. };
  76. // -----------------------------------------------------------------------
  77. // Our LV2 World class
  78. class Lv2WorldClass : public Lilv::World
  79. {
  80. public:
  81. // Base Types
  82. Lilv::Node port;
  83. Lilv::Node symbol;
  84. Lilv::Node designation;
  85. Lilv::Node freeWheeling;
  86. Lilv::Node reportsLatency;
  87. // Plugin Types
  88. Lilv::Node class_allpass;
  89. Lilv::Node class_amplifier;
  90. Lilv::Node class_analyzer;
  91. Lilv::Node class_bandpass;
  92. Lilv::Node class_chorus;
  93. Lilv::Node class_comb;
  94. Lilv::Node class_compressor;
  95. Lilv::Node class_constant;
  96. Lilv::Node class_converter;
  97. Lilv::Node class_delay;
  98. Lilv::Node class_distortion;
  99. Lilv::Node class_dynamics;
  100. Lilv::Node class_eq;
  101. Lilv::Node class_envelope;
  102. Lilv::Node class_expander;
  103. Lilv::Node class_filter;
  104. Lilv::Node class_flanger;
  105. Lilv::Node class_function;
  106. Lilv::Node class_gate;
  107. Lilv::Node class_generator;
  108. Lilv::Node class_highpass;
  109. Lilv::Node class_instrument;
  110. Lilv::Node class_limiter;
  111. Lilv::Node class_lowpass;
  112. Lilv::Node class_mixer;
  113. Lilv::Node class_modulator;
  114. Lilv::Node class_multiEQ;
  115. Lilv::Node class_oscillator;
  116. Lilv::Node class_paraEQ;
  117. Lilv::Node class_phaser;
  118. Lilv::Node class_pitch;
  119. Lilv::Node class_reverb;
  120. Lilv::Node class_simulator;
  121. Lilv::Node class_spatial;
  122. Lilv::Node class_spectral;
  123. Lilv::Node class_utility;
  124. Lilv::Node class_waveshaper;
  125. // Port Types
  126. Lilv::Node port_input;
  127. Lilv::Node port_output;
  128. Lilv::Node port_control;
  129. Lilv::Node port_audio;
  130. Lilv::Node port_cv;
  131. Lilv::Node port_atom;
  132. Lilv::Node port_event;
  133. Lilv::Node port_midi;
  134. // Port Properties
  135. Lilv::Node pprop_optional;
  136. Lilv::Node pprop_enumeration;
  137. Lilv::Node pprop_integer;
  138. Lilv::Node pprop_sampleRate;
  139. Lilv::Node pprop_toggled;
  140. Lilv::Node pprop_artifacts;
  141. Lilv::Node pprop_continuousCV;
  142. Lilv::Node pprop_discreteCV;
  143. Lilv::Node pprop_expensive;
  144. Lilv::Node pprop_strictBounds;
  145. Lilv::Node pprop_logarithmic;
  146. Lilv::Node pprop_notAutomatic;
  147. Lilv::Node pprop_notOnGUI;
  148. Lilv::Node pprop_trigger;
  149. // Unit Hints
  150. Lilv::Node unit_name;
  151. Lilv::Node unit_render;
  152. Lilv::Node unit_symbol;
  153. Lilv::Node unit_unit;
  154. // UI Types
  155. Lilv::Node ui_gtk2;
  156. Lilv::Node ui_gtk3;
  157. Lilv::Node ui_qt4;
  158. Lilv::Node ui_qt5;
  159. Lilv::Node ui_cocoa;
  160. Lilv::Node ui_windows;
  161. Lilv::Node ui_x11;
  162. Lilv::Node ui_external;
  163. Lilv::Node ui_externalOld;
  164. Lilv::Node ui_externalOld2;
  165. // Misc
  166. Lilv::Node atom_bufferType;
  167. Lilv::Node atom_sequence;
  168. Lilv::Node atom_supports;
  169. Lilv::Node preset_preset;
  170. Lilv::Node state_state;
  171. Lilv::Node value_default;
  172. Lilv::Node value_minimum;
  173. Lilv::Node value_maximum;
  174. Lilv::Node rz_asLargeAs;
  175. Lilv::Node rz_minSize;
  176. // Port Data Types
  177. Lilv::Node midi_event;
  178. Lilv::Node patch_message;
  179. Lilv::Node time_position;
  180. // MIDI CC
  181. Lilv::Node mm_defaultControl;
  182. Lilv::Node mm_controlType;
  183. Lilv::Node mm_controlNumber;
  184. // Other
  185. Lilv::Node dct_replaces;
  186. Lilv::Node doap_license;
  187. Lilv::Node rdf_type;
  188. Lilv::Node rdfs_label;
  189. // -------------------------------------------------------------------
  190. Lv2WorldClass()
  191. : Lilv::World(),
  192. port (new_uri(LV2_CORE__port)),
  193. symbol (new_uri(LV2_CORE__symbol)),
  194. designation (new_uri(LV2_CORE__designation)),
  195. freeWheeling (new_uri(LV2_CORE__freeWheeling)),
  196. reportsLatency (new_uri(LV2_CORE__reportsLatency)),
  197. class_allpass (new_uri(LV2_CORE__AllpassPlugin)),
  198. class_amplifier (new_uri(LV2_CORE__AmplifierPlugin)),
  199. class_analyzer (new_uri(LV2_CORE__AnalyserPlugin)),
  200. class_bandpass (new_uri(LV2_CORE__BandpassPlugin)),
  201. class_chorus (new_uri(LV2_CORE__ChorusPlugin)),
  202. class_comb (new_uri(LV2_CORE__CombPlugin)),
  203. class_compressor (new_uri(LV2_CORE__CompressorPlugin)),
  204. class_constant (new_uri(LV2_CORE__ConstantPlugin)),
  205. class_converter (new_uri(LV2_CORE__ConverterPlugin)),
  206. class_delay (new_uri(LV2_CORE__DelayPlugin)),
  207. class_distortion (new_uri(LV2_CORE__DistortionPlugin)),
  208. class_dynamics (new_uri(LV2_CORE__DynamicsPlugin)),
  209. class_eq (new_uri(LV2_CORE__EQPlugin)),
  210. class_envelope (new_uri(LV2_CORE__EnvelopePlugin)),
  211. class_expander (new_uri(LV2_CORE__ExpanderPlugin)),
  212. class_filter (new_uri(LV2_CORE__FilterPlugin)),
  213. class_flanger (new_uri(LV2_CORE__FlangerPlugin)),
  214. class_function (new_uri(LV2_CORE__FunctionPlugin)),
  215. class_gate (new_uri(LV2_CORE__GatePlugin)),
  216. class_generator (new_uri(LV2_CORE__GeneratorPlugin)),
  217. class_highpass (new_uri(LV2_CORE__HighpassPlugin)),
  218. class_instrument (new_uri(LV2_CORE__InstrumentPlugin)),
  219. class_limiter (new_uri(LV2_CORE__LimiterPlugin)),
  220. class_lowpass (new_uri(LV2_CORE__LowpassPlugin)),
  221. class_mixer (new_uri(LV2_CORE__MixerPlugin)),
  222. class_modulator (new_uri(LV2_CORE__ModulatorPlugin)),
  223. class_multiEQ (new_uri(LV2_CORE__MultiEQPlugin)),
  224. class_oscillator (new_uri(LV2_CORE__OscillatorPlugin)),
  225. class_paraEQ (new_uri(LV2_CORE__ParaEQPlugin)),
  226. class_phaser (new_uri(LV2_CORE__PhaserPlugin)),
  227. class_pitch (new_uri(LV2_CORE__PitchPlugin)),
  228. class_reverb (new_uri(LV2_CORE__ReverbPlugin)),
  229. class_simulator (new_uri(LV2_CORE__SimulatorPlugin)),
  230. class_spatial (new_uri(LV2_CORE__SpatialPlugin)),
  231. class_spectral (new_uri(LV2_CORE__SpectralPlugin)),
  232. class_utility (new_uri(LV2_CORE__UtilityPlugin)),
  233. class_waveshaper (new_uri(LV2_CORE__WaveshaperPlugin)),
  234. port_input (new_uri(LV2_CORE__InputPort)),
  235. port_output (new_uri(LV2_CORE__OutputPort)),
  236. port_control (new_uri(LV2_CORE__ControlPort)),
  237. port_audio (new_uri(LV2_CORE__AudioPort)),
  238. port_cv (new_uri(LV2_CORE__CVPort)),
  239. port_atom (new_uri(LV2_ATOM__AtomPort)),
  240. port_event (new_uri(LV2_EVENT__EventPort)),
  241. port_midi (new_uri(LV2_MIDI_LL__MidiPort)),
  242. pprop_optional (new_uri(LV2_CORE__connectionOptional)),
  243. pprop_enumeration (new_uri(LV2_CORE__enumeration)),
  244. pprop_integer (new_uri(LV2_CORE__integer)),
  245. pprop_sampleRate (new_uri(LV2_CORE__sampleRate)),
  246. pprop_toggled (new_uri(LV2_CORE__toggled)),
  247. pprop_artifacts (new_uri(LV2_PORT_PROPS__causesArtifacts)),
  248. pprop_continuousCV (new_uri(LV2_PORT_PROPS__continuousCV)),
  249. pprop_discreteCV (new_uri(LV2_PORT_PROPS__discreteCV)),
  250. pprop_expensive (new_uri(LV2_PORT_PROPS__expensive)),
  251. pprop_strictBounds (new_uri(LV2_PORT_PROPS__hasStrictBounds)),
  252. pprop_logarithmic (new_uri(LV2_PORT_PROPS__logarithmic)),
  253. pprop_notAutomatic (new_uri(LV2_PORT_PROPS__notAutomatic)),
  254. pprop_notOnGUI (new_uri(LV2_PORT_PROPS__notOnGUI)),
  255. pprop_trigger (new_uri(LV2_PORT_PROPS__trigger)),
  256. unit_name (new_uri(LV2_UNITS__name)),
  257. unit_render (new_uri(LV2_UNITS__render)),
  258. unit_symbol (new_uri(LV2_UNITS__symbol)),
  259. unit_unit (new_uri(LV2_UNITS__unit)),
  260. ui_gtk2 (new_uri(LV2_UI__GtkUI)),
  261. ui_gtk3 (new_uri(LV2_UI__Gtk3UI)),
  262. ui_qt4 (new_uri(LV2_UI__Qt4UI)),
  263. ui_qt5 (new_uri(LV2_UI__Qt5UI)),
  264. ui_cocoa (new_uri(LV2_UI__CocoaUI)),
  265. ui_windows (new_uri(LV2_UI__WindowsUI)),
  266. ui_x11 (new_uri(LV2_UI__X11UI)),
  267. ui_external (new_uri(LV2_EXTERNAL_UI__Widget)),
  268. ui_externalOld (new_uri(LV2_EXTERNAL_UI_DEPRECATED_URI)),
  269. ui_externalOld2 (new_uri("http://nedko.arnaudov.name/lv2/external_ui/")),
  270. atom_bufferType (new_uri(LV2_ATOM__bufferType)),
  271. atom_sequence (new_uri(LV2_ATOM__Sequence)),
  272. atom_supports (new_uri(LV2_ATOM__supports)),
  273. preset_preset (new_uri(LV2_PRESETS__Preset)),
  274. state_state (new_uri(LV2_STATE__state)),
  275. value_default (new_uri(LV2_CORE__default)),
  276. value_minimum (new_uri(LV2_CORE__minimum)),
  277. value_maximum (new_uri(LV2_CORE__maximum)),
  278. rz_asLargeAs (new_uri(LV2_RESIZE_PORT__asLargeAs)),
  279. rz_minSize (new_uri(LV2_RESIZE_PORT__minimumSize)),
  280. midi_event (new_uri(LV2_MIDI__MidiEvent)),
  281. patch_message (new_uri(LV2_PATCH__Message)),
  282. time_position (new_uri(LV2_TIME__Position)),
  283. mm_defaultControl (new_uri(NS_llmm "defaultMidiController")),
  284. mm_controlType (new_uri(NS_llmm "controllerType")),
  285. mm_controlNumber (new_uri(NS_llmm "controllerNumber")),
  286. dct_replaces (new_uri(NS_dct "replaces")),
  287. doap_license (new_uri(NS_doap "license")),
  288. rdf_type (new_uri(NS_rdf "type")),
  289. rdfs_label (new_uri(NS_rdfs "label")) {}
  290. static Lv2WorldClass& getInstance()
  291. {
  292. static Lv2WorldClass lv2World;
  293. return lv2World;
  294. }
  295. const LilvPlugin* getPlugin(const LV2_URI uri) const
  296. {
  297. CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', nullptr);
  298. const LilvPlugins* const cPlugins(lilv_world_get_all_plugins(this->me));
  299. if (cPlugins == nullptr)
  300. {
  301. carla_stderr("Lv2WorldClass::getPlugin(\"%s\") - Failed to get plugins from world", uri);
  302. return nullptr;
  303. }
  304. LilvNode* const uriNode(Lilv::World::new_uri(uri));
  305. if (uriNode == nullptr)
  306. {
  307. carla_stderr("Lv2WorldClass::getPlugin(\"%s\") - Failed to get node from uri", uri);
  308. return nullptr;
  309. }
  310. const LilvPlugin* const cPlugin(lilv_plugins_get_by_uri(cPlugins, uriNode));
  311. lilv_node_free(uriNode);
  312. if (cPlugin == nullptr)
  313. {
  314. carla_stderr("Lv2WorldClass::getPlugin(\"%s\") - Failed to get plugin", uri);
  315. return nullptr;
  316. }
  317. return cPlugin;
  318. }
  319. const LilvState* getState(const LV2_URI uri, const LV2_URID_Map* const uridMap) const
  320. {
  321. CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', nullptr);
  322. CARLA_SAFE_ASSERT_RETURN(uridMap != nullptr, nullptr);
  323. LilvNode* const uriNode(Lilv::World::new_uri(uri));
  324. if (uriNode == nullptr)
  325. {
  326. carla_stderr("Lv2WorldClass::getState(\"%s\", %p) - Failed to get node from uri", uri, uridMap);
  327. return nullptr;
  328. }
  329. const LilvState* const cState(lilv_state_new_from_world(this->me, uridMap, uriNode));
  330. lilv_node_free(uriNode);
  331. if (cState == nullptr)
  332. {
  333. carla_stderr("Lv2WorldClass::getState(\"%s\", %p) - Failed to get state", uri, uridMap);
  334. return nullptr;
  335. }
  336. return cState;
  337. }
  338. CARLA_PREVENT_HEAP_ALLOCATION
  339. };
  340. // -----------------------------------------------------------------------
  341. // Create new RDF object (using lilv)
  342. static inline
  343. const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool /*fillPresets*/)
  344. {
  345. CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', nullptr);
  346. Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());
  347. const LilvPlugin* const cPlugin(lv2World.getPlugin(uri));
  348. if (cPlugin == nullptr)
  349. {
  350. // Error already printed in getPlugin()
  351. return nullptr;
  352. }
  353. Lilv::Plugin lilvPlugin(cPlugin);
  354. LV2_RDF_Descriptor* const rdfDescriptor(new LV2_RDF_Descriptor());
  355. // -------------------------------------------------------------------
  356. // Set Plugin Type
  357. {
  358. Lilv::Nodes typeNodes(lilvPlugin.get_value(lv2World.rdf_type));
  359. if (typeNodes.size() > 0)
  360. {
  361. if (typeNodes.contains(lv2World.class_allpass))
  362. rdfDescriptor->Type[0] |= LV2_PLUGIN_ALLPASS;
  363. if (typeNodes.contains(lv2World.class_amplifier))
  364. rdfDescriptor->Type[0] |= LV2_PLUGIN_AMPLIFIER;
  365. if (typeNodes.contains(lv2World.class_analyzer))
  366. rdfDescriptor->Type[1] |= LV2_PLUGIN_ANALYSER;
  367. if (typeNodes.contains(lv2World.class_bandpass))
  368. rdfDescriptor->Type[0] |= LV2_PLUGIN_BANDPASS;
  369. if (typeNodes.contains(lv2World.class_chorus))
  370. rdfDescriptor->Type[1] |= LV2_PLUGIN_CHORUS;
  371. if (typeNodes.contains(lv2World.class_comb))
  372. rdfDescriptor->Type[1] |= LV2_PLUGIN_COMB;
  373. if (typeNodes.contains(lv2World.class_compressor))
  374. rdfDescriptor->Type[0] |= LV2_PLUGIN_COMPRESSOR;
  375. if (typeNodes.contains(lv2World.class_constant))
  376. rdfDescriptor->Type[1] |= LV2_PLUGIN_CONSTANT;
  377. if (typeNodes.contains(lv2World.class_converter))
  378. rdfDescriptor->Type[1] |= LV2_PLUGIN_CONVERTER;
  379. if (typeNodes.contains(lv2World.class_delay))
  380. rdfDescriptor->Type[0] |= LV2_PLUGIN_DELAY;
  381. if (typeNodes.contains(lv2World.class_distortion))
  382. rdfDescriptor->Type[0] |= LV2_PLUGIN_DISTORTION;
  383. if (typeNodes.contains(lv2World.class_dynamics))
  384. rdfDescriptor->Type[0] |= LV2_PLUGIN_DYNAMICS;
  385. if (typeNodes.contains(lv2World.class_eq))
  386. rdfDescriptor->Type[0] |= LV2_PLUGIN_EQ;
  387. if (typeNodes.contains(lv2World.class_envelope))
  388. rdfDescriptor->Type[0] |= LV2_PLUGIN_ENVELOPE;
  389. if (typeNodes.contains(lv2World.class_expander))
  390. rdfDescriptor->Type[0] |= LV2_PLUGIN_EXPANDER;
  391. if (typeNodes.contains(lv2World.class_filter))
  392. rdfDescriptor->Type[0] |= LV2_PLUGIN_FILTER;
  393. if (typeNodes.contains(lv2World.class_flanger))
  394. rdfDescriptor->Type[1] |= LV2_PLUGIN_FLANGER;
  395. if (typeNodes.contains(lv2World.class_function))
  396. rdfDescriptor->Type[1] |= LV2_PLUGIN_FUNCTION;
  397. if (typeNodes.contains(lv2World.class_gate))
  398. rdfDescriptor->Type[0] |= LV2_PLUGIN_GATE;
  399. if (typeNodes.contains(lv2World.class_generator))
  400. rdfDescriptor->Type[1] |= LV2_PLUGIN_GENERATOR;
  401. if (typeNodes.contains(lv2World.class_highpass))
  402. rdfDescriptor->Type[0] |= LV2_PLUGIN_HIGHPASS;
  403. if (typeNodes.contains(lv2World.class_instrument))
  404. rdfDescriptor->Type[1] |= LV2_PLUGIN_INSTRUMENT;
  405. if (typeNodes.contains(lv2World.class_limiter))
  406. rdfDescriptor->Type[0] |= LV2_PLUGIN_LIMITER;
  407. if (typeNodes.contains(lv2World.class_lowpass))
  408. rdfDescriptor->Type[0] |= LV2_PLUGIN_LOWPASS;
  409. if (typeNodes.contains(lv2World.class_mixer))
  410. rdfDescriptor->Type[1] |= LV2_PLUGIN_MIXER;
  411. if (typeNodes.contains(lv2World.class_modulator))
  412. rdfDescriptor->Type[1] |= LV2_PLUGIN_MODULATOR;
  413. if (typeNodes.contains(lv2World.class_multiEQ))
  414. rdfDescriptor->Type[0] |= LV2_PLUGIN_MULTI_EQ;
  415. if (typeNodes.contains(lv2World.class_oscillator))
  416. rdfDescriptor->Type[1] |= LV2_PLUGIN_OSCILLATOR;
  417. if (typeNodes.contains(lv2World.class_paraEQ))
  418. rdfDescriptor->Type[0] |= LV2_PLUGIN_PARA_EQ;
  419. if (typeNodes.contains(lv2World.class_phaser))
  420. rdfDescriptor->Type[1] |= LV2_PLUGIN_PHASER;
  421. if (typeNodes.contains(lv2World.class_pitch))
  422. rdfDescriptor->Type[1] |= LV2_PLUGIN_PITCH;
  423. if (typeNodes.contains(lv2World.class_reverb))
  424. rdfDescriptor->Type[0] |= LV2_PLUGIN_REVERB;
  425. if (typeNodes.contains(lv2World.class_simulator))
  426. rdfDescriptor->Type[0] |= LV2_PLUGIN_SIMULATOR;
  427. if (typeNodes.contains(lv2World.class_spatial))
  428. rdfDescriptor->Type[1] |= LV2_PLUGIN_SPATIAL;
  429. if (typeNodes.contains(lv2World.class_spectral))
  430. rdfDescriptor->Type[1] |= LV2_PLUGIN_SPECTRAL;
  431. if (typeNodes.contains(lv2World.class_utility))
  432. rdfDescriptor->Type[1] |= LV2_PLUGIN_UTILITY;
  433. if (typeNodes.contains(lv2World.class_waveshaper))
  434. rdfDescriptor->Type[0] |= LV2_PLUGIN_WAVESHAPER;
  435. }
  436. }
  437. // -------------------------------------------------------------------
  438. // Set Plugin Information
  439. {
  440. rdfDescriptor->URI = carla_strdup(uri);
  441. if (const char* const name = lilvPlugin.get_name().as_string())
  442. rdfDescriptor->Name = carla_strdup(name);
  443. if (const char* const author = lilvPlugin.get_author_name().as_string())
  444. rdfDescriptor->Author = carla_strdup(author);
  445. if (const char* const binary = lilvPlugin.get_library_uri().as_string())
  446. rdfDescriptor->Binary = carla_strdup(lilv_uri_to_path(binary));
  447. if (const char* const bundle = lilvPlugin.get_bundle_uri().as_string())
  448. rdfDescriptor->Bundle = carla_strdup(lilv_uri_to_path(bundle));
  449. Lilv::Nodes licenseNodes(lilvPlugin.get_value(lv2World.doap_license));
  450. if (licenseNodes.size() > 0)
  451. {
  452. if (const char* const license = licenseNodes.get_first().as_string())
  453. rdfDescriptor->License = carla_strdup(license);
  454. }
  455. }
  456. // -------------------------------------------------------------------
  457. // Set Plugin UniqueID
  458. {
  459. Lilv::Nodes replaceNodes(lilvPlugin.get_value(lv2World.dct_replaces));
  460. if (replaceNodes.size() > 0)
  461. {
  462. Lilv::Node replaceNode(replaceNodes.get_first());
  463. if (replaceNode.is_uri())
  464. {
  465. const QString replaceURI(replaceNode.as_uri());
  466. if (replaceURI.startsWith("urn:"))
  467. {
  468. const QString replaceId(replaceURI.split(":").last());
  469. bool ok;
  470. const ulong uniqueId(replaceId.toULong(&ok));
  471. if (ok && uniqueId != 0)
  472. rdfDescriptor->UniqueID = uniqueId;
  473. }
  474. }
  475. }
  476. }
  477. // -------------------------------------------------------------------
  478. // Set Plugin Ports
  479. if (lilvPlugin.get_num_ports() > 0)
  480. {
  481. rdfDescriptor->PortCount = lilvPlugin.get_num_ports();
  482. rdfDescriptor->Ports = new LV2_RDF_Port[rdfDescriptor->PortCount];
  483. for (uint32_t i = 0; i < rdfDescriptor->PortCount; ++i)
  484. {
  485. Lilv::Port lilvPort(lilvPlugin.get_port_by_index(i));
  486. LV2_RDF_Port* const rdfPort(&rdfDescriptor->Ports[i]);
  487. // -----------------------------------------------------------
  488. // Set Port Information
  489. {
  490. if (const char* const name = Lilv::Node(lilvPort.get_name()).as_string())
  491. rdfPort->Name = carla_strdup(name);
  492. if (const char* const symbol = Lilv::Node(lilvPort.get_symbol()).as_string())
  493. rdfPort->Symbol = carla_strdup(symbol);
  494. }
  495. // -----------------------------------------------------------
  496. // Set Port Mode and Type
  497. {
  498. // Input or Output
  499. if (lilvPort.is_a(lv2World.port_input))
  500. rdfPort->Types |= LV2_PORT_INPUT;
  501. else if (lilvPort.is_a(lv2World.port_output))
  502. rdfPort->Types |= LV2_PORT_OUTPUT;
  503. else
  504. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is not input or output", uri, rdfPort->Name);
  505. // Data Type
  506. if (lilvPort.is_a(lv2World.port_control))
  507. {
  508. rdfPort->Types |= LV2_PORT_CONTROL;
  509. }
  510. else if (lilvPort.is_a(lv2World.port_audio))
  511. {
  512. rdfPort->Types |= LV2_PORT_AUDIO;
  513. }
  514. else if (lilvPort.is_a(lv2World.port_cv))
  515. {
  516. rdfPort->Types |= LV2_PORT_CV;
  517. }
  518. else if (lilvPort.is_a(lv2World.port_atom))
  519. {
  520. rdfPort->Types |= LV2_PORT_ATOM;
  521. Lilv::Nodes bufferTypeNodes(lilvPort.get_value(lv2World.atom_bufferType));
  522. for (LilvIter* it = lilv_nodes_begin(bufferTypeNodes.me); ! lilv_nodes_is_end(bufferTypeNodes.me, it); it = lilv_nodes_next(bufferTypeNodes.me, it))
  523. {
  524. const Lilv::Node node(lilv_nodes_get(bufferTypeNodes.me, it));
  525. CARLA_SAFE_ASSERT_CONTINUE(node.is_uri());
  526. if (node.equals(lv2World.atom_sequence))
  527. rdfPort->Types |= LV2_PORT_ATOM_SEQUENCE;
  528. else
  529. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses an unknown atom buffer type '%s'", uri, rdfPort->Name, node.as_uri());
  530. }
  531. Lilv::Nodes supportNodes(lilvPort.get_value(lv2World.atom_supports));
  532. for (LilvIter* it = lilv_nodes_begin(supportNodes.me); ! lilv_nodes_is_end(supportNodes.me, it); it = lilv_nodes_next(supportNodes.me, it))
  533. {
  534. const Lilv::Node node(lilv_nodes_get(supportNodes.me, it));
  535. CARLA_SAFE_ASSERT_CONTINUE(node.is_uri());
  536. if (node.equals(lv2World.midi_event))
  537. rdfPort->Types |= LV2_PORT_DATA_MIDI_EVENT;
  538. else if (node.equals(lv2World.patch_message))
  539. rdfPort->Types |= LV2_PORT_DATA_PATCH_MESSAGE;
  540. else if (node.equals(lv2World.time_position))
  541. rdfPort->Types |= LV2_PORT_DATA_TIME_POSITION;
  542. // something new we don't support yet?
  543. else if (std::strstr(node.as_uri(), "lv2plug.in/") != nullptr)
  544. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of atom type but has unsupported data '%s'", uri, rdfPort->Name, node.as_uri());
  545. }
  546. }
  547. else if (lilvPort.is_a(lv2World.port_event))
  548. {
  549. rdfPort->Types |= LV2_PORT_EVENT;
  550. bool supported = false;
  551. if (lilvPort.supports_event(lv2World.midi_event))
  552. {
  553. rdfPort->Types |= LV2_PORT_DATA_MIDI_EVENT;
  554. supported = true;
  555. }
  556. if (lilvPort.supports_event(lv2World.patch_message))
  557. {
  558. rdfPort->Types |= LV2_PORT_DATA_PATCH_MESSAGE;
  559. supported = true;
  560. }
  561. if (lilvPort.supports_event(lv2World.time_position))
  562. {
  563. rdfPort->Types |= LV2_PORT_DATA_TIME_POSITION;
  564. supported = true;
  565. }
  566. if (! supported)
  567. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of event type but has unsupported data", uri, rdfPort->Name);
  568. }
  569. else if (lilvPort.is_a(lv2World.port_midi))
  570. {
  571. rdfPort->Types |= LV2_PORT_MIDI_LL;
  572. rdfPort->Types |= LV2_PORT_DATA_MIDI_EVENT;
  573. }
  574. else
  575. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of unkown data type", uri, rdfPort->Name);
  576. }
  577. // -----------------------------------------------------------
  578. // Set Port Properties
  579. {
  580. if (lilvPort.has_property(lv2World.pprop_optional))
  581. rdfPort->Properties |= LV2_PORT_OPTIONAL;
  582. if (lilvPort.has_property(lv2World.pprop_enumeration))
  583. rdfPort->Properties |= LV2_PORT_ENUMERATION;
  584. if (lilvPort.has_property(lv2World.pprop_integer))
  585. rdfPort->Properties |= LV2_PORT_INTEGER;
  586. if (lilvPort.has_property(lv2World.pprop_sampleRate))
  587. rdfPort->Properties |= LV2_PORT_SAMPLE_RATE;
  588. if (lilvPort.has_property(lv2World.pprop_toggled))
  589. rdfPort->Properties |= LV2_PORT_TOGGLED;
  590. if (lilvPort.has_property(lv2World.pprop_artifacts))
  591. rdfPort->Properties |= LV2_PORT_CAUSES_ARTIFACTS;
  592. if (lilvPort.has_property(lv2World.pprop_continuousCV))
  593. rdfPort->Properties |= LV2_PORT_CONTINUOUS_CV;
  594. if (lilvPort.has_property(lv2World.pprop_discreteCV))
  595. rdfPort->Properties |= LV2_PORT_DISCRETE_CV;
  596. if (lilvPort.has_property(lv2World.pprop_expensive))
  597. rdfPort->Properties |= LV2_PORT_EXPENSIVE;
  598. if (lilvPort.has_property(lv2World.pprop_strictBounds))
  599. rdfPort->Properties |= LV2_PORT_STRICT_BOUNDS;
  600. if (lilvPort.has_property(lv2World.pprop_logarithmic))
  601. rdfPort->Properties |= LV2_PORT_LOGARITHMIC;
  602. if (lilvPort.has_property(lv2World.pprop_notAutomatic))
  603. rdfPort->Properties |= LV2_PORT_NOT_AUTOMATIC;
  604. if (lilvPort.has_property(lv2World.pprop_notOnGUI))
  605. rdfPort->Properties |= LV2_PORT_NOT_ON_GUI;
  606. if (lilvPort.has_property(lv2World.pprop_trigger))
  607. rdfPort->Properties |= LV2_PORT_TRIGGER;
  608. if (lilvPort.has_property(lv2World.reportsLatency))
  609. rdfPort->Designation = LV2_PORT_DESIGNATION_LATENCY;
  610. // no port properties set, check if using old/invalid ones
  611. if (rdfPort->Properties == 0x0)
  612. {
  613. static const Lilv::Node oldPropArtifacts(lv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#causesArtifacts"));
  614. static const Lilv::Node oldPropContinuousCV(lv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#continuousCV"));
  615. static const Lilv::Node oldPropDiscreteCV(lv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#discreteCV"));
  616. static const Lilv::Node oldPropExpensive(lv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#expensive"));
  617. static const Lilv::Node oldPropStrictBounds(lv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#hasStrictBounds"));
  618. static const Lilv::Node oldPropLogarithmic(lv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#logarithmic"));
  619. static const Lilv::Node oldPropNotAutomatic(lv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#notAutomatic"));
  620. static const Lilv::Node oldPropNotOnGUI(lv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#notOnGUI"));
  621. static const Lilv::Node oldPropTrigger(lv2World.new_uri("http://lv2plug.in/ns/dev/extportinfo#trigger"));
  622. if (lilvPort.has_property(oldPropArtifacts))
  623. {
  624. rdfPort->Properties |= LV2_PORT_CAUSES_ARTIFACTS;
  625. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/invalid LV2 property for 'causesArtifacts'", uri, rdfPort->Name);
  626. }
  627. if (lilvPort.has_property(oldPropContinuousCV))
  628. {
  629. rdfPort->Properties |= LV2_PORT_CONTINUOUS_CV;
  630. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/invalid LV2 property for 'continuousCV'", uri, rdfPort->Name);
  631. }
  632. if (lilvPort.has_property(oldPropDiscreteCV))
  633. {
  634. rdfPort->Properties |= LV2_PORT_DISCRETE_CV;
  635. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/invalid LV2 property for 'discreteCV'", uri, rdfPort->Name);
  636. }
  637. if (lilvPort.has_property(oldPropExpensive))
  638. {
  639. rdfPort->Properties |= LV2_PORT_EXPENSIVE;
  640. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/invalid LV2 property for 'expensive'", uri, rdfPort->Name);
  641. }
  642. if (lilvPort.has_property(oldPropStrictBounds))
  643. {
  644. rdfPort->Properties |= LV2_PORT_STRICT_BOUNDS;
  645. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/invalid LV2 property for 'hasStrictBounds'", uri, rdfPort->Name);
  646. }
  647. if (lilvPort.has_property(oldPropLogarithmic))
  648. {
  649. rdfPort->Properties |= LV2_PORT_LOGARITHMIC;
  650. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/invalid LV2 property for 'logarithmic'", uri, rdfPort->Name);
  651. }
  652. if (lilvPort.has_property(oldPropNotAutomatic))
  653. {
  654. rdfPort->Properties |= LV2_PORT_NOT_AUTOMATIC;
  655. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/invalid LV2 property for 'notAutomatic'", uri, rdfPort->Name);
  656. }
  657. if (lilvPort.has_property(oldPropNotOnGUI))
  658. {
  659. rdfPort->Properties |= LV2_PORT_NOT_ON_GUI;
  660. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/invalid LV2 property for 'notOnGUI'", uri, rdfPort->Name);
  661. }
  662. if (lilvPort.has_property(oldPropTrigger))
  663. {
  664. rdfPort->Properties |= LV2_PORT_TRIGGER;
  665. carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses old/invalid LV2 property for 'trigger'", uri, rdfPort->Name);
  666. }
  667. }
  668. }
  669. // -----------------------------------------------------------
  670. // Set Port Designation
  671. {
  672. Lilv::Nodes designationNodes(lilvPort.get_value(lv2World.designation));
  673. if (designationNodes.size() > 0)
  674. {
  675. if (const char* const designation = designationNodes.get_first().as_string())
  676. {
  677. if (std::strcmp(designation, LV2_CORE__control) == 0)
  678. rdfPort->Designation = LV2_PORT_DESIGNATION_CONTROL;
  679. else if (std::strcmp(designation, LV2_CORE__freeWheeling) == 0)
  680. rdfPort->Designation = LV2_PORT_DESIGNATION_FREEWHEELING;
  681. else if (std::strcmp(designation, LV2_CORE__latency) == 0)
  682. rdfPort->Designation = LV2_PORT_DESIGNATION_LATENCY;
  683. else if (std::strcmp(designation, LV2_PARAMETERS__sampleRate) == 0)
  684. rdfPort->Designation = LV2_PORT_DESIGNATION_SAMPLE_RATE;
  685. else if (std::strcmp(designation, LV2_TIME__bar) == 0)
  686. rdfPort->Designation = LV2_PORT_DESIGNATION_TIME_BAR;
  687. else if (std::strcmp(designation, LV2_TIME__barBeat) == 0)
  688. rdfPort->Designation = LV2_PORT_DESIGNATION_TIME_BAR_BEAT;
  689. else if (std::strcmp(designation, LV2_TIME__beat) == 0)
  690. rdfPort->Designation = LV2_PORT_DESIGNATION_TIME_BEAT;
  691. else if (std::strcmp(designation, LV2_TIME__beatUnit) == 0)
  692. rdfPort->Designation = LV2_PORT_DESIGNATION_TIME_BEAT_UNIT;
  693. else if (std::strcmp(designation, LV2_TIME__beatsPerBar) == 0)
  694. rdfPort->Designation = LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR;
  695. else if (std::strcmp(designation, LV2_TIME__beatsPerMinute) == 0)
  696. rdfPort->Designation = LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE;
  697. else if (std::strcmp(designation, LV2_TIME__frame) == 0)
  698. rdfPort->Designation = LV2_PORT_DESIGNATION_TIME_FRAME;
  699. else if (std::strcmp(designation, LV2_TIME__framesPerSecond) == 0)
  700. rdfPort->Designation = LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND;
  701. else if (std::strcmp(designation, LV2_TIME__speed) == 0)
  702. rdfPort->Designation = LV2_PORT_DESIGNATION_TIME_SPEED;
  703. else if (std::strncmp(designation, LV2_PARAMETERS_PREFIX, std::strlen(LV2_PARAMETERS_PREFIX)) == 0)
  704. pass();
  705. else if (std::strncmp(designation, LV2_PORT_GROUPS_PREFIX, std::strlen(LV2_PORT_GROUPS_PREFIX)) == 0)
  706. pass();
  707. else
  708. carla_stderr("lv2_rdf_new(\"%s\") - got unknown port designation '%s'", uri, designation);
  709. }
  710. }
  711. }
  712. // -----------------------------------------------------------
  713. // Set Port MIDI Map
  714. {
  715. Lilv::Nodes midiMapNodes(lilvPort.get_value(lv2World.mm_defaultControl));
  716. if (midiMapNodes.size() > 0)
  717. {
  718. Lilv::Node midiMapNode(midiMapNodes.get_first());
  719. if (midiMapNode.is_blank())
  720. {
  721. Lilv::Nodes midiMapTypeNodes(lv2World.find_nodes(midiMapNode, lv2World.mm_controlType, nullptr));
  722. Lilv::Nodes midiMapNumberNodes(lv2World.find_nodes(midiMapNode, lv2World.mm_controlNumber, nullptr));
  723. if (midiMapTypeNodes.size() == 1 && midiMapNumberNodes.size() == 1)
  724. {
  725. if (const char* const midiMapType = midiMapTypeNodes.get_first().as_string())
  726. {
  727. if (std::strcmp(midiMapType, LV2_MIDI_Map__CC) == 0)
  728. rdfPort->MidiMap.Type = LV2_PORT_MIDI_MAP_CC;
  729. else if (std::strcmp(midiMapType, LV2_MIDI_Map__NRPN) == 0)
  730. rdfPort->MidiMap.Type = LV2_PORT_MIDI_MAP_NRPN;
  731. else
  732. carla_stderr("lv2_rdf_new(\"%s\") - got unknown port Midi-Map type '%s'", uri, midiMapType);
  733. rdfPort->MidiMap.Number = static_cast<uint32_t>(midiMapNumberNodes.get_first().as_int());
  734. }
  735. }
  736. }
  737. }
  738. // TODO - also check using new official MIDI API too
  739. }
  740. // -----------------------------------------------------------
  741. // Set Port Points
  742. {
  743. Lilv::Nodes valueNodes(lilvPort.get_value(lv2World.value_default));
  744. if (valueNodes.size() > 0)
  745. {
  746. rdfPort->Points.Hints |= LV2_PORT_POINT_DEFAULT;
  747. rdfPort->Points.Default = valueNodes.get_first().as_float();
  748. }
  749. valueNodes = lilvPort.get_value(lv2World.value_minimum);
  750. if (valueNodes.size() > 0)
  751. {
  752. rdfPort->Points.Hints |= LV2_PORT_POINT_MINIMUM;
  753. rdfPort->Points.Minimum = valueNodes.get_first().as_float();
  754. }
  755. valueNodes = lilvPort.get_value(lv2World.value_maximum);
  756. if (valueNodes.size() > 0)
  757. {
  758. rdfPort->Points.Hints |= LV2_PORT_POINT_MAXIMUM;
  759. rdfPort->Points.Maximum = valueNodes.get_first().as_float();
  760. }
  761. }
  762. // -----------------------------------------------------------
  763. // Set Port Unit
  764. {
  765. Lilv::Nodes unitUnitNodes(lilvPort.get_value(lv2World.unit_unit));
  766. if (unitUnitNodes.size() > 0)
  767. {
  768. if (const char* const unitUnit = unitUnitNodes.get_first().as_uri())
  769. {
  770. rdfPort->Unit.Hints |= LV2_PORT_UNIT_UNIT;
  771. if (std::strcmp(unitUnit, LV2_UNITS__bar) == 0)
  772. rdfPort->Unit.Unit = LV2_PORT_UNIT_BAR;
  773. else if (std::strcmp(unitUnit, LV2_UNITS__beat) == 0)
  774. rdfPort->Unit.Unit = LV2_PORT_UNIT_BEAT;
  775. else if (std::strcmp(unitUnit, LV2_UNITS__bpm) == 0)
  776. rdfPort->Unit.Unit = LV2_PORT_UNIT_BPM;
  777. else if (std::strcmp(unitUnit, LV2_UNITS__cent) == 0)
  778. rdfPort->Unit.Unit = LV2_PORT_UNIT_CENT;
  779. else if (std::strcmp(unitUnit, LV2_UNITS__cm) == 0)
  780. rdfPort->Unit.Unit = LV2_PORT_UNIT_CM;
  781. else if (std::strcmp(unitUnit, LV2_UNITS__coef) == 0)
  782. rdfPort->Unit.Unit = LV2_PORT_UNIT_COEF;
  783. else if (std::strcmp(unitUnit, LV2_UNITS__db) == 0)
  784. rdfPort->Unit.Unit = LV2_PORT_UNIT_DB;
  785. else if (std::strcmp(unitUnit, LV2_UNITS__degree) == 0)
  786. rdfPort->Unit.Unit = LV2_PORT_UNIT_DEGREE;
  787. else if (std::strcmp(unitUnit, LV2_UNITS__frame) == 0)
  788. rdfPort->Unit.Unit = LV2_PORT_UNIT_FRAME;
  789. else if (std::strcmp(unitUnit, LV2_UNITS__hz) == 0)
  790. rdfPort->Unit.Unit = LV2_PORT_UNIT_HZ;
  791. else if (std::strcmp(unitUnit, LV2_UNITS__inch) == 0)
  792. rdfPort->Unit.Unit = LV2_PORT_UNIT_INCH;
  793. else if (std::strcmp(unitUnit, LV2_UNITS__khz) == 0)
  794. rdfPort->Unit.Unit = LV2_PORT_UNIT_KHZ;
  795. else if (std::strcmp(unitUnit, LV2_UNITS__km) == 0)
  796. rdfPort->Unit.Unit = LV2_PORT_UNIT_KM;
  797. else if (std::strcmp(unitUnit, LV2_UNITS__m) == 0)
  798. rdfPort->Unit.Unit = LV2_PORT_UNIT_M;
  799. else if (std::strcmp(unitUnit, LV2_UNITS__mhz) == 0)
  800. rdfPort->Unit.Unit = LV2_PORT_UNIT_MHZ;
  801. else if (std::strcmp(unitUnit, LV2_UNITS__midiNote) == 0)
  802. rdfPort->Unit.Unit = LV2_PORT_UNIT_MIDINOTE;
  803. else if (std::strcmp(unitUnit, LV2_UNITS__mile) == 0)
  804. rdfPort->Unit.Unit = LV2_PORT_UNIT_MILE;
  805. else if (std::strcmp(unitUnit, LV2_UNITS__min) == 0)
  806. rdfPort->Unit.Unit = LV2_PORT_UNIT_MIN;
  807. else if (std::strcmp(unitUnit, LV2_UNITS__mm) == 0)
  808. rdfPort->Unit.Unit = LV2_PORT_UNIT_MM;
  809. else if (std::strcmp(unitUnit, LV2_UNITS__ms) == 0)
  810. rdfPort->Unit.Unit = LV2_PORT_UNIT_MS;
  811. else if (std::strcmp(unitUnit, LV2_UNITS__oct) == 0)
  812. rdfPort->Unit.Unit = LV2_PORT_UNIT_OCT;
  813. else if (std::strcmp(unitUnit, LV2_UNITS__pc) == 0)
  814. rdfPort->Unit.Unit = LV2_PORT_UNIT_PC;
  815. else if (std::strcmp(unitUnit, LV2_UNITS__s) == 0)
  816. rdfPort->Unit.Unit = LV2_PORT_UNIT_S;
  817. else if (std::strcmp(unitUnit, LV2_UNITS__semitone12TET) == 0)
  818. rdfPort->Unit.Unit = LV2_PORT_UNIT_SEMITONE;
  819. else
  820. carla_stderr("lv2_rdf_new(\"%s\") - got unknown unit unit '%s'", uri, unitUnit);
  821. }
  822. }
  823. Lilv::Nodes unitNameNodes(lilvPort.get_value(lv2World.unit_name));
  824. if (unitNameNodes.size() > 0)
  825. {
  826. if (const char* const unitName = unitNameNodes.get_first().as_string())
  827. {
  828. rdfPort->Unit.Hints |= LV2_PORT_UNIT_NAME;
  829. rdfPort->Unit.Name = carla_strdup(unitName);
  830. }
  831. }
  832. Lilv::Nodes unitRenderNodes(lilvPort.get_value(lv2World.unit_render));
  833. if (unitRenderNodes.size() > 0)
  834. {
  835. if (const char* const unitRender = unitRenderNodes.get_first().as_string())
  836. {
  837. rdfPort->Unit.Hints |= LV2_PORT_UNIT_RENDER;
  838. rdfPort->Unit.Render = carla_strdup(unitRender);
  839. }
  840. }
  841. Lilv::Nodes unitSymbolNodes(lilvPort.get_value(lv2World.unit_symbol));
  842. if (unitSymbolNodes.size() > 0)
  843. {
  844. if (const char* const unitSymbol = unitSymbolNodes.get_first().as_string())
  845. {
  846. rdfPort->Unit.Hints |= LV2_PORT_UNIT_SYMBOL;
  847. rdfPort->Unit.Symbol = carla_strdup(unitSymbol);
  848. }
  849. }
  850. }
  851. // -----------------------------------------------------------
  852. // Set Port Minimum Size
  853. {
  854. Lilv::Nodes minimumSizeNodes(lilvPort.get_value(lv2World.rz_minSize));
  855. if (minimumSizeNodes.size() > 0)
  856. {
  857. const int minimumSize(minimumSizeNodes.get_first().as_int());
  858. if (minimumSize > 0)
  859. rdfPort->MinimumSize = static_cast<uint32_t>(minimumSize);
  860. else
  861. carla_safe_assert_int("minimumSize > 0", __FILE__, __LINE__, minimumSize);
  862. }
  863. }
  864. // -----------------------------------------------------------
  865. // Set Port Scale Points
  866. Lilv::ScalePoints lilvScalePoints(lilvPort.get_scale_points());
  867. if (lilvScalePoints.size() > 0)
  868. {
  869. rdfPort->ScalePointCount = lilvScalePoints.size();
  870. rdfPort->ScalePoints = new LV2_RDF_PortScalePoint[rdfPort->ScalePointCount];
  871. uint32_t h = 0;
  872. LILV_FOREACH(scale_points, it, lilvScalePoints)
  873. {
  874. CARLA_SAFE_ASSERT_BREAK(h < rdfPort->ScalePointCount);
  875. Lilv::ScalePoint lilvScalePoint(lilvScalePoints.get(it));
  876. LV2_RDF_PortScalePoint* const rdfScalePoint(&rdfPort->ScalePoints[h++]);
  877. if (const char* const label = Lilv::Node(lilvScalePoint.get_label()).as_string())
  878. rdfScalePoint->Label = carla_strdup(label);
  879. rdfScalePoint->Value = Lilv::Node(lilvScalePoint.get_value()).as_float();
  880. }
  881. }
  882. }
  883. }
  884. #if 0
  885. // -------------------------------------------------------------------
  886. // Set Plugin Presets
  887. if (fillPresets)
  888. {
  889. Lilv::Nodes presetNodes(lilvPlugin.get_related(lv2World.preset_preset));
  890. if (presetNodes.size() > 0)
  891. {
  892. // create a list of preset URIs (for checking appliesTo, sorting and unique-ness)
  893. QStringList presetListURIs;
  894. LILV_FOREACH(nodes, it, presetNodes)
  895. {
  896. Lilv::Node presetNode(presetNodes.get(it));
  897. // FIXME - check appliesTo?
  898. QString presetURI(presetNode.as_uri());
  899. if (! (presetURI.trimmed().isEmpty() || presetListURIs.contains(presetURI)))
  900. presetListURIs.append(presetURI);
  901. }
  902. presetListURIs.sort();
  903. // create presets with unique URIs
  904. rdfDescriptor->PresetCount = static_cast<uint32_t>(presetListURIs.count());
  905. rdfDescriptor->Presets = new LV2_RDF_Preset[rdfDescriptor->PresetCount];
  906. // set preset data
  907. LILV_FOREACH(nodes, it, presetNodes)
  908. {
  909. Lilv::Node presetNode(presetNodes.get(it));
  910. if (lv2World.load_resource(presetNode) == -1)
  911. continue;
  912. if (const char* const presetURI = presetNode.as_uri())
  913. {
  914. const int index(presetListURIs.indexOf(QString(presetURI)));
  915. CARLA_SAFE_ASSERT_CONTINUE(index >= 0);
  916. LV2_RDF_Preset* const rdfPreset(&rdfDescriptor->Presets[index]);
  917. // ---------------------------------------------------
  918. // Set Preset Information
  919. {
  920. rdfPreset->URI = carla_strdup(presetURI);
  921. Lilv::Nodes presetLabelNodes(lv2World.find_nodes(presetNode, lv2World.rdfs_label, nullptr));
  922. if (presetLabelNodes.size() > 0)
  923. {
  924. if (const char* const label = presetLabelNodes.get_first().as_string())
  925. rdfPreset->Label = carla_strdup(label);
  926. }
  927. }
  928. }
  929. }
  930. }
  931. }
  932. #endif
  933. // -------------------------------------------------------------------
  934. // Set Plugin Features
  935. {
  936. Lilv::Nodes lilvFeatureNodes(lilvPlugin.get_supported_features());
  937. if (lilvFeatureNodes.size() > 0)
  938. {
  939. Lilv::Nodes lilvFeatureNodesR(lilvPlugin.get_required_features());
  940. rdfDescriptor->FeatureCount = lilvFeatureNodes.size();
  941. rdfDescriptor->Features = new LV2_RDF_Feature[rdfDescriptor->FeatureCount];
  942. uint32_t h = 0;
  943. LILV_FOREACH(nodes, it, lilvFeatureNodes)
  944. {
  945. CARLA_SAFE_ASSERT_BREAK(h < rdfDescriptor->FeatureCount);
  946. Lilv::Node lilvFeatureNode(lilvFeatureNodes.get(it));
  947. LV2_RDF_Feature* const rdfFeature(&rdfDescriptor->Features[h++]);
  948. rdfFeature->Type = lilvFeatureNodesR.contains(lilvFeatureNode) ? LV2_FEATURE_REQUIRED : LV2_FEATURE_OPTIONAL;
  949. if (const char* const featureURI = lilvFeatureNode.as_uri())
  950. rdfFeature->URI = carla_strdup(featureURI);
  951. else
  952. rdfFeature->URI = nullptr;
  953. }
  954. }
  955. }
  956. // -------------------------------------------------------------------
  957. // Set Plugin Extensions
  958. {
  959. Lilv::Nodes lilvExtensionDataNodes(lilvPlugin.get_extension_data());
  960. if (lilvExtensionDataNodes.size() > 0)
  961. {
  962. rdfDescriptor->ExtensionCount = lilvExtensionDataNodes.size();
  963. rdfDescriptor->Extensions = new LV2_URI[rdfDescriptor->ExtensionCount];
  964. uint32_t h = 0;
  965. LILV_FOREACH(nodes, it, lilvExtensionDataNodes)
  966. {
  967. CARLA_SAFE_ASSERT_BREAK(h < rdfDescriptor->ExtensionCount);
  968. Lilv::Node lilvExtensionDataNode(lilvExtensionDataNodes.get(it));
  969. LV2_URI* const rdfExtension(&rdfDescriptor->Extensions[h++]);
  970. if (lilvExtensionDataNode.is_uri())
  971. {
  972. if (const char* const extURI = lilvExtensionDataNode.as_uri())
  973. {
  974. *rdfExtension = carla_strdup(extURI);
  975. continue;
  976. }
  977. }
  978. *rdfExtension = nullptr;
  979. }
  980. }
  981. }
  982. // -------------------------------------------------------------------
  983. // Set Plugin UIs
  984. {
  985. Lilv::UIs lilvUIs(lilvPlugin.get_uis());
  986. if (lilvUIs.size() > 0)
  987. {
  988. rdfDescriptor->UICount = lilvUIs.size();
  989. rdfDescriptor->UIs = new LV2_RDF_UI[rdfDescriptor->UICount];
  990. uint32_t h = 0;
  991. LILV_FOREACH(uis, it, lilvUIs)
  992. {
  993. CARLA_SAFE_ASSERT_BREAK(h < rdfDescriptor->UICount);
  994. Lilv::UI lilvUI(lilvUIs.get(it));
  995. LV2_RDF_UI* const rdfUI(&rdfDescriptor->UIs[h++]);
  996. // -------------------------------------------------------
  997. // Set UI Type
  998. if (lilvUI.is_a(lv2World.ui_gtk2))
  999. rdfUI->Type = LV2_UI_GTK2;
  1000. else if (lilvUI.is_a(lv2World.ui_gtk3))
  1001. rdfUI->Type = LV2_UI_GTK3;
  1002. else if (lilvUI.is_a(lv2World.ui_qt4))
  1003. rdfUI->Type = LV2_UI_QT4;
  1004. else if (lilvUI.is_a(lv2World.ui_qt5))
  1005. rdfUI->Type = LV2_UI_QT5;
  1006. else if (lilvUI.is_a(lv2World.ui_cocoa))
  1007. rdfUI->Type = LV2_UI_COCOA;
  1008. else if (lilvUI.is_a(lv2World.ui_windows))
  1009. rdfUI->Type = LV2_UI_WINDOWS;
  1010. else if (lilvUI.is_a(lv2World.ui_x11))
  1011. rdfUI->Type = LV2_UI_X11;
  1012. else if (lilvUI.is_a(lv2World.ui_external))
  1013. rdfUI->Type = LV2_UI_EXTERNAL;
  1014. else if (lilvUI.is_a(lv2World.ui_externalOld))
  1015. rdfUI->Type = LV2_UI_OLD_EXTERNAL;
  1016. else if (lilvUI.is_a(lv2World.ui_externalOld2))
  1017. pass();
  1018. else
  1019. carla_stderr("lv2_rdf_new(\"%s\") - UI '%s' is of unknown type", uri, lilvUI.get_uri().as_uri());
  1020. // -------------------------------------------------------
  1021. // Set UI Information
  1022. {
  1023. if (const char* const uiURI = lilvUI.get_uri().as_uri())
  1024. rdfUI->URI = carla_strdup(uiURI);
  1025. if (const char* const uiBinary = lilvUI.get_binary_uri().as_string())
  1026. rdfUI->Binary = carla_strdup(lilv_uri_to_path(uiBinary));
  1027. if (const char* const uiBundle = lilvUI.get_bundle_uri().as_string())
  1028. rdfUI->Bundle = carla_strdup(lilv_uri_to_path(uiBundle));
  1029. }
  1030. // -------------------------------------------------------
  1031. // Set UI Features
  1032. {
  1033. Lilv::Nodes lilvFeatureNodes(lilvUI.get_supported_features());
  1034. if (lilvFeatureNodes.size() > 0)
  1035. {
  1036. Lilv::Nodes lilvFeatureNodesR(lilvUI.get_required_features());
  1037. rdfUI->FeatureCount = lilvFeatureNodes.size();
  1038. rdfUI->Features = new LV2_RDF_Feature[rdfUI->FeatureCount];
  1039. uint32_t h2 = 0;
  1040. LILV_FOREACH(nodes, it2, lilvFeatureNodes)
  1041. {
  1042. CARLA_SAFE_ASSERT_BREAK(h2 < rdfUI->FeatureCount);
  1043. Lilv::Node lilvFeatureNode(lilvFeatureNodes.get(it2));
  1044. LV2_RDF_Feature* const rdfFeature(&rdfUI->Features[h2++]);
  1045. rdfFeature->Type = lilvFeatureNodesR.contains(lilvFeatureNode) ? LV2_FEATURE_REQUIRED : LV2_FEATURE_OPTIONAL;
  1046. if (const char* const featureURI = lilvFeatureNode.as_uri())
  1047. rdfFeature->URI = carla_strdup(featureURI);
  1048. else
  1049. rdfFeature->URI = nullptr;
  1050. }
  1051. }
  1052. }
  1053. // -------------------------------------------------------
  1054. // Set UI Extensions
  1055. {
  1056. Lilv::Nodes lilvExtensionDataNodes(lilvUI.get_extension_data());
  1057. if (lilvExtensionDataNodes.size() > 0)
  1058. {
  1059. rdfUI->ExtensionCount = lilvExtensionDataNodes.size();
  1060. rdfUI->Extensions = new LV2_URI[rdfUI->ExtensionCount];
  1061. uint32_t h2 = 0;
  1062. LILV_FOREACH(nodes, it2, lilvExtensionDataNodes)
  1063. {
  1064. CARLA_SAFE_ASSERT_BREAK(h2 < rdfUI->ExtensionCount);
  1065. Lilv::Node lilvExtensionDataNode(lilvExtensionDataNodes.get(it));
  1066. LV2_URI* const rdfExtension(&rdfUI->Extensions[h2++]);
  1067. if (lilvExtensionDataNode.is_uri())
  1068. {
  1069. if (const char* const extURI = lilvExtensionDataNode.as_uri())
  1070. {
  1071. *rdfExtension = carla_strdup(extURI);
  1072. continue;
  1073. }
  1074. }
  1075. *rdfExtension = nullptr;
  1076. }
  1077. }
  1078. }
  1079. }
  1080. }
  1081. }
  1082. return rdfDescriptor;
  1083. }
  1084. // -----------------------------------------------------------------------
  1085. // Check if we support a plugin port
  1086. static inline
  1087. bool is_lv2_port_supported(const LV2_Property types)
  1088. {
  1089. if (LV2_IS_PORT_CONTROL(types))
  1090. return true;
  1091. if (LV2_IS_PORT_AUDIO(types))
  1092. return true;
  1093. if (LV2_IS_PORT_CV(types))
  1094. return true;
  1095. if (LV2_IS_PORT_ATOM_SEQUENCE(types))
  1096. return true;
  1097. if (LV2_IS_PORT_EVENT(types))
  1098. return true;
  1099. if (LV2_IS_PORT_MIDI_LL(types))
  1100. return true;
  1101. return false;
  1102. }
  1103. // -----------------------------------------------------------------------
  1104. // Check if we support a plugin feature
  1105. static inline
  1106. bool is_lv2_feature_supported(const LV2_URI uri)
  1107. {
  1108. CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', false);
  1109. if (std::strcmp(uri, LV2_BUF_SIZE__boundedBlockLength) == 0)
  1110. return true;
  1111. if (std::strcmp(uri, LV2_BUF_SIZE__fixedBlockLength) == 0)
  1112. return true;
  1113. if (std::strcmp(uri, LV2_BUF_SIZE__powerOf2BlockLength) == 0)
  1114. return true;
  1115. if (std::strcmp(uri, LV2_CORE__hardRTCapable) == 0)
  1116. return true;
  1117. if (std::strcmp(uri, LV2_CORE__inPlaceBroken) == 0)
  1118. return true;
  1119. if (std::strcmp(uri, LV2_CORE__isLive) == 0)
  1120. return true;
  1121. if (std::strcmp(uri, LV2_EVENT_URI) == 0)
  1122. return true;
  1123. if (std::strcmp(uri, LV2_LOG__log) == 0)
  1124. return true;
  1125. if (std::strcmp(uri, LV2_OPTIONS__options) == 0)
  1126. return true;
  1127. if (std::strcmp(uri, LV2_PROGRAMS__Host) == 0)
  1128. return true;
  1129. if (std::strcmp(uri, LV2_RESIZE_PORT__resize) == 0)
  1130. return true;
  1131. if (std::strcmp(uri, LV2_RTSAFE_MEMORY_POOL__Pool) == 0)
  1132. return true;
  1133. if (std::strcmp(uri, LV2_RTSAFE_MEMORY_POOL_DEPRECATED_URI) == 0)
  1134. return true;
  1135. if (std::strcmp(uri, LV2_STATE__makePath) == 0)
  1136. return true;
  1137. if (std::strcmp(uri, LV2_STATE__mapPath) == 0)
  1138. return true;
  1139. if (std::strcmp(uri, LV2_PORT_PROPS__supportsStrictBounds) == 0)
  1140. return true;
  1141. if (std::strcmp(uri, LV2_URI_MAP_URI) == 0)
  1142. return true;
  1143. if (std::strcmp(uri, LV2_URID__map) == 0)
  1144. return true;
  1145. if (std::strcmp(uri, LV2_URID__unmap) == 0)
  1146. return true;
  1147. if (std::strcmp(uri, LV2_WORKER__schedule) == 0)
  1148. return true;
  1149. return false;
  1150. }
  1151. // -----------------------------------------------------------------------
  1152. // Check if we support a plugin or UI feature
  1153. static inline
  1154. bool is_lv2_ui_feature_supported(const LV2_URI uri)
  1155. {
  1156. CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', false);
  1157. if (is_lv2_feature_supported(uri))
  1158. return true;
  1159. #ifndef BRIDGE_LV2
  1160. if (std::strcmp(uri, LV2_DATA_ACCESS_URI) == 0)
  1161. return true;
  1162. if (std::strcmp(uri, LV2_INSTANCE_ACCESS_URI) == 0)
  1163. return true;
  1164. #endif
  1165. if (std::strcmp(uri, LV2_UI__fixedSize) == 0)
  1166. return true;
  1167. if (std::strcmp(uri, LV2_UI__idleInterface) == 0)
  1168. return true;
  1169. if (std::strcmp(uri, LV2_UI__makeResident) == 0)
  1170. return true;
  1171. if (std::strcmp(uri, LV2_UI__noUserResize) == 0)
  1172. return true;
  1173. if (std::strcmp(uri, LV2_UI__parent) == 0)
  1174. return true;
  1175. if (std::strcmp(uri, LV2_UI__portMap) == 0)
  1176. return true;
  1177. if (std::strcmp(uri, LV2_UI__portSubscribe) == 0)
  1178. return true;
  1179. if (std::strcmp(uri, LV2_UI__resize) == 0)
  1180. return true;
  1181. if (std::strcmp(uri, LV2_UI__touch) == 0)
  1182. return true;
  1183. if (std::strcmp(uri, LV2_EXTERNAL_UI__Widget) == 0)
  1184. return true;
  1185. if (std::strcmp(uri, LV2_EXTERNAL_UI_DEPRECATED_URI) == 0)
  1186. return true;
  1187. return false;
  1188. }
  1189. // -----------------------------------------------------------------------
  1190. #endif // CARLA_LV2_UTILS_HPP_INCLUDED