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.

lilv_custom-changes.patch 23KB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. diff --git a/lilv/lilv.h b/lilv/lilv.h
  2. index 37dd849..760f7b5 100644
  3. --- a/lilv/lilv.h
  4. +++ b/lilv/lilv.h
  5. @@ -26,8 +26,9 @@
  6. #include <stdint.h>
  7. #include <stdio.h>
  8. -#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
  9. -#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
  10. +#include "lv2/lv2.h"
  11. +#include "lv2/state.h"
  12. +#include "lv2/urid.h"
  13. #ifdef LILV_SHARED
  14. # ifdef _WIN32
  15. @@ -564,7 +565,7 @@ lilv_world_free(LilvWorld* world);
  16. with special plugin bundles which are installed to a known location).
  17. */
  18. LILV_API void
  19. -lilv_world_load_all(LilvWorld* world);
  20. +lilv_world_load_all(LilvWorld* world, const char* lv2_path);
  21. /**
  22. Load a specific bundle.
  23. @@ -1221,9 +1222,9 @@ lilv_port_get_scale_points(const LilvPlugin* plugin,
  24. @return A new LilvState which must be freed with lilv_state_free(), or NULL.
  25. */
  26. LILV_API LilvState*
  27. -lilv_state_new_from_world(LilvWorld* world,
  28. - LV2_URID_Map* map,
  29. - const LilvNode* subject);
  30. +lilv_state_new_from_world(LilvWorld* world,
  31. + const LV2_URID_Map* map,
  32. + const LilvNode* subject);
  33. /**
  34. Load a state snapshot from a file.
  35. @@ -1241,18 +1242,18 @@ lilv_state_new_from_world(LilvWorld* world,
  36. new memory consumed once this function returns.
  37. */
  38. LILV_API LilvState*
  39. -lilv_state_new_from_file(LilvWorld* world,
  40. - LV2_URID_Map* map,
  41. - const LilvNode* subject,
  42. - const char* path);
  43. +lilv_state_new_from_file(LilvWorld* world,
  44. + const LV2_URID_Map* map,
  45. + const LilvNode* subject,
  46. + const char* path);
  47. /**
  48. Load a state snapshot from a string made by lilv_state_to_string().
  49. */
  50. LILV_API LilvState*
  51. -lilv_state_new_from_string(LilvWorld* world,
  52. - LV2_URID_Map* map,
  53. - const char* str);
  54. +lilv_state_new_from_string(LilvWorld* world,
  55. + const LV2_URID_Map* map,
  56. + const char* str);
  57. /**
  58. Function to get a port value.
  59. @@ -1469,7 +1470,8 @@ lilv_state_emit_port_values(const LilvState* state,
  60. */
  61. LILV_API void
  62. lilv_state_restore(const LilvState* state,
  63. - LilvInstance* instance,
  64. + const LV2_State_Interface* iface,
  65. + LV2_Handle handle,
  66. LilvSetPortValueFunc set_value,
  67. void* user_data,
  68. uint32_t flags,
  69. @@ -1830,6 +1832,42 @@ LILV_API const LilvNode*
  70. lilv_ui_get_binary_uri(const LilvUI* ui);
  71. /**
  72. + Custom calls
  73. +*/
  74. +LILV_API LilvNode*
  75. +lilv_plugin_get_modgui_resources_directory(const LilvPlugin* plugin);
  76. +
  77. +LILV_API LilvNode*
  78. +lilv_plugin_get_modgui_stylesheet(const LilvPlugin* plugin);
  79. +
  80. +LILV_API LilvNode*
  81. +lilv_plugin_get_modgui_icon_template(const LilvPlugin* plugin);
  82. +
  83. +LILV_API LilvNode*
  84. +lilv_plugin_get_modgui_settings_template(const LilvPlugin* plugin);
  85. +
  86. +LILV_API LilvNode*
  87. +lilv_plugin_get_modgui_template_data(const LilvPlugin* plugin);
  88. +
  89. +LILV_API LilvNode*
  90. +lilv_plugin_get_modgui_screenshot(const LilvPlugin* plugin);
  91. +
  92. +LILV_API LilvNode*
  93. +lilv_plugin_get_modgui_thumbnail(const LilvPlugin* plugin);
  94. +
  95. +LILV_API const LilvNodes*
  96. +lilv_ui_get_supported_features(const LilvUI* ui);
  97. +
  98. +LILV_API const LilvNodes*
  99. +lilv_ui_get_required_features(const LilvUI* ui);
  100. +
  101. +LILV_API const LilvNodes*
  102. +lilv_ui_get_optional_features(const LilvUI* ui);
  103. +
  104. +LILV_API const LilvNodes*
  105. +lilv_ui_get_extension_data(const LilvUI* ui);
  106. +
  107. +/**
  108. @}
  109. @}
  110. */
  111. diff --git a/lilv/lilvmm.hpp b/lilv/lilvmm.hpp
  112. index b9b3a69..1f67e81 100644
  113. --- a/lilv/lilvmm.hpp
  114. +++ b/lilv/lilvmm.hpp
  115. @@ -17,6 +17,8 @@
  116. #ifndef LILV_LILVMM_HPP
  117. #define LILV_LILVMM_HPP
  118. +#include "CarlaDefines.h"
  119. +
  120. #include "lilv/lilv.h"
  121. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
  122. @@ -27,14 +29,12 @@
  123. namespace Lilv {
  124. -static inline const char*
  125. -uri_to_path(const char* uri) {
  126. - return lilv_uri_to_path(uri);
  127. -}
  128. -
  129. #define LILV_WRAP0(RT, prefix, name) \
  130. inline RT name() { return lilv_ ## prefix ## _ ## name (me); }
  131. +#define LILV_WRAP0_CONST(RT, prefix, name) \
  132. + inline RT name() const { return lilv_ ## prefix ## _ ## name (me); }
  133. +
  134. #define LILV_WRAP0_VOID(prefix, name) \
  135. inline void name() { lilv_ ## prefix ## _ ## name(me); }
  136. @@ -65,6 +65,7 @@ uri_to_path(const char* uri) {
  137. #endif
  138. struct Node {
  139. + inline Node(LilvNode* node) : me(node) {}
  140. inline Node(const LilvNode* node) : me(lilv_node_duplicate(node)) {}
  141. inline Node(const Node& copy) : me(lilv_node_duplicate(copy.me)) {}
  142. @@ -78,20 +79,26 @@ struct Node {
  143. LILV_WRAP_CONVERSION(LilvNode);
  144. - LILV_WRAP0(char*, node, get_turtle_token);
  145. - LILV_WRAP0(bool, node, is_uri);
  146. - LILV_WRAP0(const char*, node, as_uri);
  147. - LILV_WRAP0(bool, node, is_blank);
  148. - LILV_WRAP0(const char*, node, as_blank);
  149. - LILV_WRAP0(bool, node, is_literal);
  150. - LILV_WRAP0(bool, node, is_string);
  151. - LILV_WRAP0(const char*, node, as_string);
  152. - LILV_WRAP0(bool, node, is_float);
  153. - LILV_WRAP0(float, node, as_float);
  154. - LILV_WRAP0(bool, node, is_int);
  155. - LILV_WRAP0(int, node, as_int);
  156. - LILV_WRAP0(bool, node, is_bool);
  157. - LILV_WRAP0(bool, node, as_bool);
  158. + LILV_WRAP0_CONST(char*, node, get_turtle_token);
  159. + LILV_WRAP0_CONST(bool, node, is_uri);
  160. + LILV_WRAP0_CONST(const char*, node, as_uri);
  161. + LILV_WRAP0_CONST(bool, node, is_blank);
  162. + LILV_WRAP0_CONST(const char*, node, as_blank);
  163. + LILV_WRAP0_CONST(bool, node, is_literal);
  164. + LILV_WRAP0_CONST(bool, node, is_string);
  165. + LILV_WRAP0_CONST(const char*, node, as_string);
  166. + LILV_WRAP0_CONST(bool, node, is_float);
  167. + LILV_WRAP0_CONST(float, node, as_float);
  168. + LILV_WRAP0_CONST(bool, node, is_int);
  169. + LILV_WRAP0_CONST(int, node, as_int);
  170. + LILV_WRAP0_CONST(bool, node, is_bool);
  171. + LILV_WRAP0_CONST(bool, node, as_bool);
  172. +
  173. + Node& operator=(const Node& copy) {
  174. + lilv_node_free(me);
  175. + me = lilv_node_duplicate(copy.me);
  176. + return *this;
  177. + }
  178. LilvNode* me;
  179. };
  180. @@ -126,7 +133,7 @@ struct PluginClass {
  181. LILV_WRAP0(LilvIter*, prefix, begin); \
  182. LILV_WRAP1(LilvIter*, prefix, next, LilvIter*, i); \
  183. LILV_WRAP1(bool, prefix, is_end, LilvIter*, i); \
  184. - const Lilv ## CT* me; \
  185. + const Lilv ## CT* me
  186. struct PluginClasses {
  187. LILV_WRAP_COLL(PluginClasses, PluginClass, plugin_classes);
  188. @@ -141,22 +148,24 @@ struct ScalePoints {
  189. struct Nodes {
  190. LILV_WRAP_COLL(Nodes, Node, nodes);
  191. LILV_WRAP1(bool, nodes, contains, const Node, node);
  192. - LILV_WRAP0(Node, nodes, get_first);
  193. +
  194. + inline Node get_first() const {
  195. + return Node((const LilvNode*)lilv_nodes_get_first(me));
  196. + }
  197. };
  198. struct UI {
  199. inline UI(const LilvUI* c_obj) : me(c_obj) {}
  200. LILV_WRAP_CONVERSION(const LilvUI);
  201. - LILV_WRAP0(const LilvNode*, ui, get_uri);
  202. - LILV_WRAP0(const LilvNode*, ui, get_bundle_uri);
  203. - LILV_WRAP0(const LilvNode*, ui, get_binary_uri);
  204. - LILV_WRAP0(const LilvNodes*, ui, get_classes);
  205. - /*LILV_WRAP3(bool, ui, is_supported,
  206. - LilvUISupportedFunc, supported_func,
  207. - const LilvNode*, container_type,
  208. - const LilvNode**, ui_type);*/
  209. - LILV_WRAP1(bool, ui, is_a, const LilvNode*, class_uri);
  210. + LILV_WRAP0(Node, ui, get_uri);
  211. + LILV_WRAP1(bool, ui, is_a, LilvNode*, ui_class);
  212. + LILV_WRAP0(Node, ui, get_bundle_uri);
  213. + LILV_WRAP0(Node, ui, get_binary_uri);
  214. + LILV_WRAP0(Nodes, ui, get_supported_features);
  215. + LILV_WRAP0(Nodes, ui, get_required_features);
  216. + LILV_WRAP0(Nodes, ui, get_optional_features);
  217. + LILV_WRAP0(Nodes, ui, get_extension_data);
  218. const LilvUI* me;
  219. };
  220. @@ -220,6 +229,13 @@ struct Plugin {
  221. LILV_WRAP0(Nodes, plugin, get_extension_data);
  222. LILV_WRAP0(UIs, plugin, get_uis);
  223. LILV_WRAP1(Nodes, plugin, get_related, Node, type);
  224. + LILV_WRAP0(Node, plugin, get_modgui_resources_directory);
  225. + LILV_WRAP0(Node, plugin, get_modgui_stylesheet);
  226. + LILV_WRAP0(Node, plugin, get_modgui_icon_template);
  227. + LILV_WRAP0(Node, plugin, get_modgui_settings_template);
  228. + LILV_WRAP0(Node, plugin, get_modgui_template_data);
  229. + LILV_WRAP0(Node, plugin, get_modgui_screenshot);
  230. + LILV_WRAP0(Node, plugin, get_modgui_thumbnail);
  231. inline Port get_port_by_index(unsigned index) {
  232. return Port(me, lilv_plugin_get_port_by_index(me, index));
  233. @@ -259,15 +275,13 @@ struct Instance {
  234. inline Instance(LilvInstance* instance) : me(instance) {}
  235. LILV_DEPRECATED
  236. - inline Instance(Plugin plugin, double sample_rate) {
  237. - me = lilv_plugin_instantiate(plugin, sample_rate, NULL);
  238. - }
  239. + inline Instance(Plugin plugin, double sample_rate)
  240. + : me(lilv_plugin_instantiate(plugin, sample_rate, NULL)) {}
  241. LILV_DEPRECATED inline Instance(Plugin plugin,
  242. double sample_rate,
  243. - LV2_Feature* const* features) {
  244. - me = lilv_plugin_instantiate(plugin, sample_rate, features);
  245. - }
  246. + LV2_Feature* const* features)
  247. + : me(lilv_plugin_instantiate(plugin, sample_rate, features)) {}
  248. static inline Instance* create(Plugin plugin,
  249. double sample_rate,
  250. @@ -304,22 +318,25 @@ struct Instance {
  251. };
  252. struct World {
  253. - inline World() : me(lilv_world_new()) {}
  254. - inline ~World() { lilv_world_free(me); }
  255. + inline World() : me(lilv_world_new()) {}
  256. + inline virtual ~World() { lilv_world_free(me); }
  257. - inline LilvNode* new_uri(const char* uri) {
  258. + inline LilvNode* new_uri(const char* uri) const {
  259. return lilv_new_uri(me, uri);
  260. }
  261. - inline LilvNode* new_string(const char* str) {
  262. + inline LilvNode* new_file_uri(const char* host, const char* path) const {
  263. + return lilv_new_file_uri(me, host, path);
  264. + }
  265. + inline LilvNode* new_string(const char* str) const {
  266. return lilv_new_string(me, str);
  267. }
  268. - inline LilvNode* new_int(int val) {
  269. + inline LilvNode* new_int(int val) const {
  270. return lilv_new_int(me, val);
  271. }
  272. - inline LilvNode* new_float(float val) {
  273. + inline LilvNode* new_float(float val) const {
  274. return lilv_new_float(me, val);
  275. }
  276. - inline LilvNode* new_bool(bool val) {
  277. + inline LilvNode* new_bool(bool val) const {
  278. return lilv_new_bool(me, val);
  279. }
  280. inline Nodes find_nodes(const LilvNode* subject,
  281. @@ -329,7 +346,7 @@ struct World {
  282. }
  283. LILV_WRAP2_VOID(world, set_option, const char*, uri, LilvNode*, value);
  284. - LILV_WRAP0_VOID(world, load_all);
  285. + LILV_WRAP1_VOID(world, load_all, const char*, lv2_path);
  286. LILV_WRAP1_VOID(world, load_bundle, LilvNode*, bundle_uri);
  287. LILV_WRAP0(const LilvPluginClass*, world, get_plugin_class);
  288. LILV_WRAP0(const LilvPluginClasses*, world, get_plugin_classes);
  289. @@ -337,6 +354,8 @@ struct World {
  290. LILV_WRAP1(int, world, load_resource, const LilvNode*, resource);
  291. LilvWorld* me;
  292. +
  293. + CARLA_DECLARE_NON_COPY_STRUCT(World)
  294. };
  295. } /* namespace Lilv */
  296. diff --git a/src/lilv_internal.h b/src/lilv_internal.h
  297. index af8e31a..7b6e84d 100644
  298. --- a/src/lilv_internal.h
  299. +++ b/src/lilv_internal.h
  300. @@ -58,7 +58,7 @@ static inline const char* dlerror(void) { return "Unknown error"; }
  301. #include "lilv/lilv.h"
  302. #ifdef LILV_DYN_MANIFEST
  303. -# include "lv2/lv2plug.in/ns/ext/dynmanifest/dynmanifest.h"
  304. +# include "lv2/dynmanifest.h"
  305. #endif
  306. /*
  307. diff --git a/src/plugin.c b/src/plugin.c
  308. index 5e10d7c..108ee2b 100644
  309. --- a/src/plugin.c
  310. +++ b/src/plugin.c
  311. @@ -27,10 +27,11 @@
  312. #include "lilv_config.h"
  313. #include "lilv_internal.h"
  314. -#include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
  315. +#include "lv2/ui.h"
  316. #define NS_DOAP (const uint8_t*)"http://usefulinc.com/ns/doap#"
  317. #define NS_FOAF (const uint8_t*)"http://xmlns.com/foaf/0.1/"
  318. +#define NS_MOD (const uint8_t*)"http://moddevices.com/ns/modgui#"
  319. static void
  320. lilv_plugin_init(LilvPlugin* plugin, LilvNode* bundle_uri)
  321. @@ -930,6 +931,131 @@ lilv_plugin_get_author_homepage(const LilvPlugin* plugin)
  322. return lilv_plugin_get_author_property(plugin, NS_FOAF "homepage");
  323. }
  324. +static const SordNode*
  325. +lilv_plugin_get_modgui(const LilvPlugin* p)
  326. +{
  327. + lilv_plugin_load_if_necessary(p);
  328. +
  329. + SordNode* mod_gui = sord_new_uri(
  330. + p->world->world, NS_MOD "gui");
  331. +
  332. + SordIter* gui = lilv_world_query_internal(
  333. + p->world,
  334. + p->plugin_uri->node,
  335. + mod_gui,
  336. + NULL);
  337. +
  338. + sord_node_free(p->world->world, mod_gui);
  339. +
  340. + if (sord_iter_end(gui)) {
  341. + sord_iter_free(gui);
  342. + return NULL;
  343. + }
  344. +
  345. + const SordNode* Gui = sord_iter_get_node(gui, SORD_OBJECT);
  346. +
  347. + sord_iter_free(gui);
  348. + return Gui;
  349. +}
  350. +
  351. +LILV_API LilvNode*
  352. +lilv_plugin_get_modgui_resources_directory(const LilvPlugin* plugin)
  353. +{
  354. + const SordNode* modgui = lilv_plugin_get_modgui(plugin);
  355. + if (modgui) {
  356. + SordWorld* sworld = plugin->world->world;
  357. + SordNode* modgui_res = sord_new_uri(sworld, NS_MOD "resourcesDirectory");
  358. + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_res);
  359. + sord_node_free(sworld, modgui_res);
  360. + return ret;
  361. + }
  362. + return NULL;
  363. +}
  364. +
  365. +LILV_API LilvNode*
  366. +lilv_plugin_get_modgui_stylesheet(const LilvPlugin* plugin)
  367. +{
  368. + const SordNode* modgui = lilv_plugin_get_modgui(plugin);
  369. + if (modgui) {
  370. + SordWorld* sworld = plugin->world->world;
  371. + SordNode* modgui_style = sord_new_uri(sworld, NS_MOD "stylesheet");
  372. + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_style);
  373. + sord_node_free(sworld, modgui_style);
  374. + return ret;
  375. + }
  376. + return NULL;
  377. +}
  378. +
  379. +LILV_API LilvNode*
  380. +lilv_plugin_get_modgui_icon_template(const LilvPlugin* plugin)
  381. +{
  382. + const SordNode* modgui = lilv_plugin_get_modgui(plugin);
  383. + if (modgui) {
  384. + SordWorld* sworld = plugin->world->world;
  385. + SordNode* modgui_tmpl = sord_new_uri(sworld, NS_MOD "iconTemplate");
  386. + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_tmpl);
  387. + sord_node_free(sworld, modgui_tmpl);
  388. + return ret;
  389. + }
  390. + return NULL;
  391. +}
  392. +
  393. +LILV_API LilvNode*
  394. +lilv_plugin_get_modgui_settings_template(const LilvPlugin* plugin)
  395. +{
  396. + const SordNode* modgui = lilv_plugin_get_modgui(plugin);
  397. + if (modgui) {
  398. + SordWorld* sworld = plugin->world->world;
  399. + SordNode* modgui_tmpl = sord_new_uri(sworld, NS_MOD "settingsTemplate");
  400. + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_tmpl);
  401. + sord_node_free(sworld, modgui_tmpl);
  402. + return ret;
  403. + }
  404. + return NULL;
  405. +}
  406. +
  407. +LILV_API LilvNode*
  408. +lilv_plugin_get_modgui_template_data(const LilvPlugin* plugin)
  409. +{
  410. + const SordNode* modgui = lilv_plugin_get_modgui(plugin);
  411. + if (modgui) {
  412. + SordWorld* sworld = plugin->world->world;
  413. + SordNode* modgui_tmpl = sord_new_uri(sworld, NS_MOD "templateData");
  414. + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_tmpl);
  415. + sord_node_free(sworld, modgui_tmpl);
  416. + return ret;
  417. + }
  418. + return NULL;
  419. +}
  420. +
  421. +LILV_API LilvNode*
  422. +lilv_plugin_get_modgui_screenshot(const LilvPlugin* plugin)
  423. +{
  424. + const SordNode* modgui = lilv_plugin_get_modgui(plugin);
  425. + if (modgui) {
  426. + SordWorld* sworld = plugin->world->world;
  427. + SordNode* modgui_scr = sord_new_uri(sworld, NS_MOD "screenshot");
  428. + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_scr);
  429. + sord_node_free(sworld, modgui_scr);
  430. + return ret;
  431. + }
  432. + return NULL;
  433. +}
  434. +
  435. +LILV_API LilvNode*
  436. +lilv_plugin_get_modgui_thumbnail(const LilvPlugin* plugin)
  437. +{
  438. + const SordNode* modgui = lilv_plugin_get_modgui(plugin);
  439. + if (modgui) {
  440. + SordWorld* sworld = plugin->world->world;
  441. + SordNode* modgui_thumb = sord_new_uri(sworld, NS_MOD "thumbnail");
  442. + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_thumb);
  443. + sord_node_free(sworld, modgui_thumb);
  444. + return ret;
  445. + }
  446. + return NULL;
  447. +}
  448. +
  449. LILV_API bool
  450. lilv_plugin_is_replaced(const LilvPlugin* plugin)
  451. {
  452. diff --git a/src/port.c b/src/port.c
  453. index 6bf8fc7..0a50891 100644
  454. --- a/src/port.c
  455. +++ b/src/port.c
  456. @@ -20,8 +20,8 @@
  457. #include <stdlib.h>
  458. #include <string.h>
  459. -#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
  460. -#include "lv2/lv2plug.in/ns/ext/event/event.h"
  461. +#include "lv2/atom.h"
  462. +#include "lv2/event.h"
  463. #include "lilv_internal.h"
  464. diff --git a/src/state.c b/src/state.c
  465. index 4781405..c0173b1 100644
  466. --- a/src/state.c
  467. +++ b/src/state.c
  468. @@ -18,10 +18,10 @@
  469. #include <stdio.h>
  470. #include <string.h>
  471. -#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
  472. -#include "lv2/lv2plug.in/ns/ext/atom/forge.h"
  473. -#include "lv2/lv2plug.in/ns/ext/presets/presets.h"
  474. -#include "lv2/lv2plug.in/ns/ext/state/state.h"
  475. +#include "lv2/atom.h"
  476. +#include "lv2/atom-forge.h"
  477. +#include "lv2/presets.h"
  478. +#include "lv2/state.h"
  479. #include "lilv_config.h"
  480. #include "lilv_internal.h"
  481. @@ -431,40 +431,18 @@ lilv_state_emit_port_values(const LilvState* state,
  482. LILV_API void
  483. lilv_state_restore(const LilvState* state,
  484. - LilvInstance* instance,
  485. + const LV2_State_Interface* iface,
  486. + LV2_Handle handle,
  487. LilvSetPortValueFunc set_value,
  488. void* user_data,
  489. uint32_t flags,
  490. const LV2_Feature *const * features)
  491. {
  492. - if (!state) {
  493. - LILV_ERROR("lilv_state_restore() called on NULL state\n");
  494. - return;
  495. + if (iface && iface->restore) {
  496. + iface->restore(handle, retrieve_callback,
  497. + (LV2_State_Handle)state, flags, features);
  498. }
  499. - LV2_State_Map_Path map_path = {
  500. - (LilvState*)state, abstract_path, absolute_path };
  501. - LV2_Feature map_feature = { LV2_STATE__mapPath, &map_path };
  502. -
  503. - if (instance) {
  504. - const LV2_Descriptor* desc = instance->lv2_descriptor;
  505. - if (desc->extension_data) {
  506. - const LV2_State_Interface* iface = (const LV2_State_Interface*)
  507. - desc->extension_data(LV2_STATE__interface);
  508. -
  509. - if (iface && iface->restore) {
  510. - const LV2_Feature** sfeatures = add_features(
  511. - features, &map_feature, NULL);
  512. -
  513. - iface->restore(instance->lv2_handle, retrieve_callback,
  514. - (LV2_State_Handle)state, flags, sfeatures);
  515. -
  516. - free(sfeatures);
  517. - }
  518. - }
  519. - }
  520. -
  521. -
  522. if (set_value) {
  523. lilv_state_emit_port_values(state, set_value, user_data);
  524. }
  525. @@ -616,9 +594,9 @@ new_state_from_model(LilvWorld* world,
  526. }
  527. LILV_API LilvState*
  528. -lilv_state_new_from_world(LilvWorld* world,
  529. - LV2_URID_Map* map,
  530. - const LilvNode* node)
  531. +lilv_state_new_from_world(LilvWorld* world,
  532. + const LV2_URID_Map* map,
  533. + const LilvNode* node)
  534. {
  535. if (!lilv_node_is_uri(node) && !lilv_node_is_blank(node)) {
  536. LILV_ERRORF("Subject `%s' is not a URI or blank node.\n",
  537. @@ -630,10 +608,10 @@ lilv_state_new_from_world(LilvWorld* world,
  538. }
  539. LILV_API LilvState*
  540. -lilv_state_new_from_file(LilvWorld* world,
  541. - LV2_URID_Map* map,
  542. - const LilvNode* subject,
  543. - const char* path)
  544. +lilv_state_new_from_file(LilvWorld* world,
  545. + const LV2_URID_Map* map,
  546. + const LilvNode* subject,
  547. + const char* path)
  548. {
  549. if (subject && !lilv_node_is_uri(subject)
  550. && !lilv_node_is_blank(subject)) {
  551. @@ -683,9 +661,9 @@ set_prefixes(SerdEnv* env)
  552. }
  553. LILV_API LilvState*
  554. -lilv_state_new_from_string(LilvWorld* world,
  555. - LV2_URID_Map* map,
  556. - const char* str)
  557. +lilv_state_new_from_string(LilvWorld* world,
  558. + const LV2_URID_Map* map,
  559. + const char* str)
  560. {
  561. if (!str) {
  562. return NULL;
  563. diff --git a/src/ui.c b/src/ui.c
  564. index 0f4f2f6..a3e17da 100644
  565. --- a/src/ui.c
  566. +++ b/src/ui.c
  567. @@ -109,3 +109,54 @@ lilv_ui_get_binary_uri(const LilvUI* ui)
  568. {
  569. return ui->binary_uri;
  570. }
  571. +
  572. +static LilvNodes*
  573. +lilv_ui_get_value_internal(const LilvUI* ui, const SordNode* predicate)
  574. +{
  575. + assert(ui);
  576. + return lilv_world_find_nodes_internal(ui->world, ui->uri->node, predicate, NULL);
  577. +}
  578. +
  579. +LILV_API const LilvNodes*
  580. +lilv_ui_get_supported_features(const LilvUI* ui)
  581. +{
  582. + assert(ui);
  583. + LilvNodes* optional = lilv_ui_get_optional_features(ui);
  584. + LilvNodes* required = lilv_ui_get_required_features(ui);
  585. + LilvNodes* result = lilv_nodes_new();
  586. +
  587. + LILV_FOREACH(nodes, i, optional)
  588. + zix_tree_insert((ZixTree*)result, lilv_node_duplicate(lilv_nodes_get(optional, i)), NULL);
  589. +
  590. + LILV_FOREACH(nodes, i, required)
  591. + zix_tree_insert((ZixTree*)result, lilv_node_duplicate(lilv_nodes_get(required, i)), NULL);
  592. +
  593. + lilv_nodes_free(optional);
  594. + lilv_nodes_free(required);
  595. +
  596. + return result;
  597. +}
  598. +
  599. +LILV_API const LilvNodes*
  600. +lilv_ui_get_required_features(const LilvUI* ui)
  601. +{
  602. + assert(ui);
  603. + assert(ui->world);
  604. + return lilv_ui_get_value_internal(ui, ui->world->uris.lv2_requiredFeature);
  605. +}
  606. +
  607. +LILV_API const LilvNodes*
  608. +lilv_ui_get_optional_features(const LilvUI* ui)
  609. +{
  610. + assert(ui);
  611. + assert(ui->world);
  612. + return lilv_ui_get_value_internal(ui, ui->world->uris.lv2_optionalFeature);
  613. +}
  614. +
  615. +LILV_API const LilvNodes*
  616. +lilv_ui_get_extension_data(const LilvUI* ui)
  617. +{
  618. + assert(ui);
  619. + assert(ui->world);
  620. + return lilv_ui_get_value_internal(ui, ui->world->uris.lv2_extensionData);
  621. +}
  622. diff --git a/src/util.c b/src/util.c
  623. index 0c1fd5e..239aa78 100644
  624. --- a/src/util.c
  625. +++ b/src/util.c
  626. @@ -453,10 +453,7 @@ lilv_symlink(const char* oldpath, const char* newpath)
  627. int ret = 0;
  628. if (strcmp(oldpath, newpath)) {
  629. #ifdef _WIN32
  630. - ret = !CreateSymbolicLink(newpath, oldpath, 0);
  631. - if (ret) {
  632. - ret = !CreateHardLink(newpath, oldpath, 0);
  633. - }
  634. + ret = 1;
  635. #else
  636. ret = symlink(oldpath, newpath);
  637. #endif
  638. diff --git a/src/world.c b/src/world.c
  639. index 622e0a5..04403ca 100644
  640. --- a/src/world.c
  641. +++ b/src/world.c
  642. @@ -19,7 +19,7 @@
  643. #include <stdlib.h>
  644. #include <string.h>
  645. -#include "lv2/lv2plug.in/ns/ext/presets/presets.h"
  646. +#include "lv2/presets.h"
  647. #include "lilv_internal.h"
  648. @@ -1009,12 +1009,8 @@ lilv_world_load_plugin_classes(LilvWorld* world)
  649. }
  650. LILV_API void
  651. -lilv_world_load_all(LilvWorld* world)
  652. +lilv_world_load_all(LilvWorld* world, const char* lv2_path)
  653. {
  654. - const char* lv2_path = getenv("LV2_PATH");
  655. - if (!lv2_path)
  656. - lv2_path = LILV_DEFAULT_LV2_PATH;
  657. -
  658. // Discover bundles and read all manifest files into model
  659. lilv_world_load_path(world, lv2_path);