Last active
January 4, 2019 23:58
-
-
Save ventosus/ad122810f5b34cfcaf8d to your computer and use it in GitHub Desktop.
LV2 discovery by plugin class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <lilv/lilv.h> | |
int | |
main(int argc, char **argv) | |
{ | |
LilvWorld *world = lilv_world_new(); | |
if(world) | |
{ | |
lilv_world_load_all(world); | |
const LilvPlugins *plugins = lilv_world_get_all_plugins(world); | |
if(plugins) | |
{ | |
LILV_FOREACH(plugins, itr, plugins) | |
{ | |
const LilvPlugin *plugin = lilv_plugins_get(plugins, itr); | |
if(plugin) | |
{ | |
const LilvPluginClass *class = lilv_plugin_get_class(plugin); | |
const LilvNode *uri = lilv_plugin_get_uri(plugin); | |
LilvNode *name = lilv_plugin_get_name(plugin); | |
if(class && uri && name) | |
{ | |
const LilvNode *label = lilv_plugin_class_get_label(class); | |
printf("%s,%s,%s\n", | |
lilv_node_as_string(label), | |
lilv_node_as_string(name), | |
lilv_node_as_uri(uri)); | |
lilv_node_free(name); | |
} | |
} | |
} | |
} | |
lilv_world_free(world); | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: list | |
lv2_class: lv2_class.c | |
gcc -std=gnu99 -O3 -o $@ $< $(shell pkg-config --cflags --libs lilv-0) | |
list: lv2_class | |
./$< \ | |
| sort \ | |
| sed 's/,/\n/g' \ | |
| zenity \ | |
--list --hide-column=3 --print-column=ALL \ | |
--title='LV2 Plugins' \ | |
--column=Type --column=Name --column=URI |
Your compiler defaults to C90 mode, lilv needs at least C99.
use
gcc -std=gnu99 -O3...
or
gcc -std=gnu11 -O3 ...
That did it :)
naming a variable class ? doesn't compile for me with clang because of that,
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks a lot!
I must be missing some libraries, I get this error but I installed everything lilv-related..?