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 57KB

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