diff options
author | David Robillard <d@drobilla.net> | 2011-04-28 21:56:29 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-28 21:56:29 +0000 |
commit | 809f5ae5999901be62f9d0cc1eb8a2d0f4806780 (patch) | |
tree | 4a2c1a7b344ec0f0a75d6a64ed1177a61822af89 /utils | |
parent | 372ad8bcac948087bbc261933e38868f533c6708 (diff) | |
download | lilv-809f5ae5999901be62f9d0cc1eb8a2d0f4806780.tar.gz lilv-809f5ae5999901be62f9d0cc1eb8a2d0f4806780.tar.bz2 lilv-809f5ae5999901be62f9d0cc1eb8a2d0f4806780.zip |
Rename slv2 to lilv.
API breakage was proving too much of a hassle, and would be even further of a
mess after release and packaging. Best to make a clean break now, and fix
installation to support parallel installs and prevent this kind of problem in
the future.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3217 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'utils')
-rw-r--r-- | utils/lilv.bash_completion (renamed from utils/slv2.bash_completion) | 0 | ||||
-rw-r--r-- | utils/lilv_bench.c (renamed from utils/slv2_bench.c) | 22 | ||||
-rw-r--r-- | utils/lv2_inspect.c | 250 | ||||
-rw-r--r-- | utils/lv2_jack_host.c | 150 | ||||
-rw-r--r-- | utils/lv2_list.c | 28 |
5 files changed, 225 insertions, 225 deletions
diff --git a/utils/slv2.bash_completion b/utils/lilv.bash_completion index 921087a..921087a 100644 --- a/utils/slv2.bash_completion +++ b/utils/lilv.bash_completion diff --git a/utils/slv2_bench.c b/utils/lilv_bench.c index de1be4e..2920fb5 100644 --- a/utils/slv2_bench.c +++ b/utils/lilv_bench.c @@ -16,14 +16,14 @@ #include <stdio.h> -#include "slv2/slv2.h" +#include "lilv/lilv.h" -#include "slv2-config.h" +#include "lilv-config.h" void print_version() { - printf("slv2_bench (slv2) " SLV2_VERSION "\n"); + printf("lilv_bench (lilv) " LILV_VERSION "\n"); printf("Copyright 2011-2011 David Robillard <http://drobilla.net>\n"); printf("License: <http://www.opensource.org/licenses/isc-license>\n"); printf("This is free software: you are free to change and redistribute it.\n"); @@ -33,23 +33,23 @@ print_version() void print_usage() { - printf("Usage: slv2_bench\n"); + printf("Usage: lilv_bench\n"); printf("Load all discovered LV2 plugins.\n"); } int main(int argc, char** argv) { - SLV2World world = slv2_world_new(); - slv2_world_load_all(world); + LilvWorld world = lilv_world_new(); + lilv_world_load_all(world); - SLV2Plugins plugins = slv2_world_get_all_plugins(world); - SLV2_FOREACH(plugins, p, plugins) { - SLV2Plugin plugin = slv2_plugins_get(plugins, p); - slv2_plugin_get_class(plugin); + LilvPlugins plugins = lilv_world_get_all_plugins(world); + LILV_FOREACH(plugins, p, plugins) { + LilvPlugin plugin = lilv_plugins_get(plugins, p); + lilv_plugin_get_class(plugin); } - slv2_world_free(world); + lilv_world_free(world); return 0; } diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c index 5c7342d..20b5a3c 100644 --- a/utils/lv2_inspect.c +++ b/utils/lv2_inspect.c @@ -20,29 +20,29 @@ #include <stdlib.h> #include <string.h> -#include "slv2/slv2.h" +#include "lilv/lilv.h" -#include "slv2-config.h" +#include "lilv-config.h" -SLV2Value event_class = NULL; -SLV2Value control_class = NULL; -SLV2Value in_group_pred = NULL; -SLV2Value role_pred = NULL; -SLV2Value preset_pred = NULL; -SLV2Value title_pred = NULL; +LilvValue event_class = NULL; +LilvValue control_class = NULL; +LilvValue in_group_pred = NULL; +LilvValue role_pred = NULL; +LilvValue preset_pred = NULL; +LilvValue title_pred = NULL; void -print_group(SLV2Plugin p, SLV2Value group, SLV2Value type, SLV2Value symbol) +print_group(LilvPlugin p, LilvValue group, LilvValue type, LilvValue symbol) { - printf("\n\tGroup %s:\n", slv2_value_as_string(group)); - printf("\t\tType: %s\n", slv2_value_as_string(type)); - printf("\t\tSymbol: %s\n", slv2_value_as_string(symbol)); + printf("\n\tGroup %s:\n", lilv_value_as_string(group)); + printf("\t\tType: %s\n", lilv_value_as_string(type)); + printf("\t\tSymbol: %s\n", lilv_value_as_string(symbol)); } void -print_port(SLV2Plugin p, uint32_t index, float* mins, float* maxes, float* defaults) +print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defaults) { - SLV2Port port = slv2_plugin_get_port_by_index(p, index); + LilvPort port = lilv_plugin_get_port_by_index(p, index); printf("\n\tPort %d:\n", index); @@ -53,63 +53,63 @@ print_port(SLV2Plugin p, uint32_t index, float* mins, float* maxes, float* defau bool first = true; - SLV2Values classes = slv2_port_get_classes(p, port); + LilvValues classes = lilv_port_get_classes(p, port); printf("\t\tType: "); - SLV2_FOREACH(values, i, classes) { - SLV2Value value = slv2_values_get(classes, i); + LILV_FOREACH(values, i, classes) { + LilvValue value = lilv_values_get(classes, i); if (!first) { printf("\n\t\t "); } - printf("%s", slv2_value_as_uri(value)); + printf("%s", lilv_value_as_uri(value)); first = false; } - if (slv2_port_is_a(p, port, event_class)) { - SLV2Values supported = slv2_port_get_value_by_qname(p, port, + if (lilv_port_is_a(p, port, event_class)) { + LilvValues supported = lilv_port_get_value_by_qname(p, port, "lv2ev:supportsEvent"); - if (slv2_values_size(supported) > 0) { + if (lilv_values_size(supported) > 0) { printf("\n\t\tSupported events:\n"); - SLV2_FOREACH(values, i, supported) { - SLV2Value value = slv2_values_get(supported, i); - printf("\t\t\t%s\n", slv2_value_as_uri(value)); + LILV_FOREACH(values, i, supported) { + LilvValue value = lilv_values_get(supported, i); + printf("\t\t\t%s\n", lilv_value_as_uri(value)); } } - slv2_values_free(supported); + lilv_values_free(supported); } - SLV2ScalePoints points = slv2_port_get_scale_points(p, port); + LilvScalePoints points = lilv_port_get_scale_points(p, port); if (points) printf("\n\t\tScale Points:\n"); - SLV2_FOREACH(scale_points, i, points) { - SLV2ScalePoint p = slv2_scale_points_get(points, i); + LILV_FOREACH(scale_points, i, points) { + LilvScalePoint p = lilv_scale_points_get(points, i); printf("\t\t\t%s = \"%s\"\n", - slv2_value_as_string(slv2_scale_point_get_value(p)), - slv2_value_as_string(slv2_scale_point_get_label(p))); + lilv_value_as_string(lilv_scale_point_get_value(p)), + lilv_value_as_string(lilv_scale_point_get_label(p))); } - slv2_scale_points_free(points); + lilv_scale_points_free(points); - SLV2Value val = slv2_port_get_symbol(p, port); - printf("\n\t\tSymbol: %s\n", slv2_value_as_string(val)); + LilvValue val = lilv_port_get_symbol(p, port); + printf("\n\t\tSymbol: %s\n", lilv_value_as_string(val)); - val = slv2_port_get_name(p, port); - printf("\t\tName: %s\n", slv2_value_as_string(val)); - slv2_value_free(val); + val = lilv_port_get_name(p, port); + printf("\t\tName: %s\n", lilv_value_as_string(val)); + lilv_value_free(val); - SLV2Values groups = slv2_port_get_value(p, port, in_group_pred); - if (slv2_values_size(groups) > 0) + LilvValues groups = lilv_port_get_value(p, port, in_group_pred); + if (lilv_values_size(groups) > 0) printf("\t\tGroup: %s\n", - slv2_value_as_string( - slv2_values_get(groups, slv2_values_begin(groups)))); - slv2_values_free(groups); + lilv_value_as_string( + lilv_values_get(groups, lilv_values_begin(groups)))); + lilv_values_free(groups); - SLV2Values roles = slv2_port_get_value(p, port, role_pred); - if (slv2_values_size(roles) > 0) + LilvValues roles = lilv_port_get_value(p, port, role_pred); + if (lilv_values_size(roles) > 0) printf("\t\tRole: %s\n", - slv2_value_as_string( - slv2_values_get(roles, slv2_values_begin(roles)))); - slv2_values_free(roles); + lilv_value_as_string( + lilv_values_get(roles, lilv_values_begin(roles)))); + lilv_values_free(roles); - if (slv2_port_is_a(p, port, control_class)) { + if (lilv_port_is_a(p, port, control_class)) { if (!isnan(mins[index])) printf("\t\tMinimum: %f\n", mins[index]); if (!isnan(mins[index])) @@ -118,165 +118,165 @@ print_port(SLV2Plugin p, uint32_t index, float* mins, float* maxes, float* defau printf("\t\tDefault: %f\n", defaults[index]); } - SLV2Values properties = slv2_port_get_properties(p, port); - if (slv2_values_size(properties) > 0) + LilvValues properties = lilv_port_get_properties(p, port); + if (lilv_values_size(properties) > 0) printf("\t\tProperties: "); first = true; - SLV2_FOREACH(values, i, properties) { + LILV_FOREACH(values, i, properties) { if (!first) { printf("\t\t "); } - printf("%s\n", slv2_value_as_uri(slv2_values_get(properties, i))); + printf("%s\n", lilv_value_as_uri(lilv_values_get(properties, i))); first = false; } - if (slv2_values_size(properties) > 0) + if (lilv_values_size(properties) > 0) printf("\n"); - slv2_values_free(properties); + lilv_values_free(properties); } void -print_plugin(SLV2Plugin p) +print_plugin(LilvPlugin p) { - SLV2Value val = NULL; + LilvValue val = NULL; - printf("%s\n\n", slv2_value_as_uri(slv2_plugin_get_uri(p))); + printf("%s\n\n", lilv_value_as_uri(lilv_plugin_get_uri(p))); - val = slv2_plugin_get_name(p); + val = lilv_plugin_get_name(p); if (val) { - printf("\tName: %s\n", slv2_value_as_string(val)); - slv2_value_free(val); + printf("\tName: %s\n", lilv_value_as_string(val)); + lilv_value_free(val); } - SLV2Value class_label = slv2_plugin_class_get_label(slv2_plugin_get_class(p)); + LilvValue class_label = lilv_plugin_class_get_label(lilv_plugin_get_class(p)); if (class_label) { - printf("\tClass: %s\n", slv2_value_as_string(class_label)); + printf("\tClass: %s\n", lilv_value_as_string(class_label)); } - val = slv2_plugin_get_author_name(p); + val = lilv_plugin_get_author_name(p); if (val) { - printf("\tAuthor: %s\n", slv2_value_as_string(val)); - slv2_value_free(val); + printf("\tAuthor: %s\n", lilv_value_as_string(val)); + lilv_value_free(val); } - val = slv2_plugin_get_author_email(p); + val = lilv_plugin_get_author_email(p); if (val) { - printf("\tAuthor Email: %s\n", slv2_value_as_uri(val)); - slv2_value_free(val); + printf("\tAuthor Email: %s\n", lilv_value_as_uri(val)); + lilv_value_free(val); } - val = slv2_plugin_get_author_homepage(p); + val = lilv_plugin_get_author_homepage(p); if (val) { - printf("\tAuthor Homepage: %s\n", slv2_value_as_uri(val)); - slv2_value_free(val); + printf("\tAuthor Homepage: %s\n", lilv_value_as_uri(val)); + lilv_value_free(val); } - if (slv2_plugin_has_latency(p)) { - uint32_t latency_port = slv2_plugin_get_latency_port_index(p); + if (lilv_plugin_has_latency(p)) { + uint32_t latency_port = lilv_plugin_get_latency_port_index(p); printf("\tHas latency: yes, reported by port %d\n", latency_port); } else { printf("\tHas latency: no\n"); } printf("\tBundle: %s\n", - slv2_value_as_uri(slv2_plugin_get_bundle_uri(p))); + lilv_value_as_uri(lilv_plugin_get_bundle_uri(p))); - SLV2Value binary_uri = slv2_plugin_get_library_uri(p); + LilvValue binary_uri = lilv_plugin_get_library_uri(p); if (binary_uri) { printf("\tBinary: %s\n", - slv2_value_as_uri(slv2_plugin_get_library_uri(p))); + lilv_value_as_uri(lilv_plugin_get_library_uri(p))); } - SLV2UIs uis = slv2_plugin_get_uis(p); - if (slv2_values_size(uis) > 0) { + LilvUIs uis = lilv_plugin_get_uis(p); + if (lilv_values_size(uis) > 0) { printf("\tUI: "); - SLV2_FOREACH(uis, i, uis) { - SLV2UI ui = slv2_uis_get(uis, i); - printf("%s\n", slv2_value_as_uri(slv2_ui_get_uri(ui))); + LILV_FOREACH(uis, i, uis) { + LilvUI ui = lilv_uis_get(uis, i); + printf("%s\n", lilv_value_as_uri(lilv_ui_get_uri(ui))); - const char* binary = slv2_value_as_uri(slv2_ui_get_binary_uri(ui)); + const char* binary = lilv_value_as_uri(lilv_ui_get_binary_uri(ui)); - SLV2Values types = slv2_ui_get_classes(ui); - SLV2_FOREACH(values, i, types) { + LilvValues types = lilv_ui_get_classes(ui); + LILV_FOREACH(values, i, types) { printf("\t Class: %s\n", - slv2_value_as_uri(slv2_values_get(types, i))); + lilv_value_as_uri(lilv_values_get(types, i))); } if (binary) printf("\t Binary: %s\n", binary); printf("\t Bundle: %s\n", - slv2_value_as_uri(slv2_ui_get_bundle_uri(ui))); + lilv_value_as_uri(lilv_ui_get_bundle_uri(ui))); } } - slv2_uis_free(uis); + lilv_uis_free(uis); printf("\tData URIs: "); - SLV2Values data_uris = slv2_plugin_get_data_uris(p); + LilvValues data_uris = lilv_plugin_get_data_uris(p); bool first = true; - SLV2_FOREACH(values, i, data_uris) { + LILV_FOREACH(values, i, data_uris) { if (!first) { printf("\n\t "); } - printf("%s", slv2_value_as_uri(slv2_values_get(data_uris, i))); + printf("%s", lilv_value_as_uri(lilv_values_get(data_uris, i))); first = false; } printf("\n"); /* Required Features */ - SLV2Values features = slv2_plugin_get_required_features(p); + LilvValues features = lilv_plugin_get_required_features(p); if (features) printf("\tRequired Features: "); first = true; - SLV2_FOREACH(values, i, features) { + LILV_FOREACH(values, i, features) { if (!first) { printf("\n\t "); } - printf("%s", slv2_value_as_uri(slv2_values_get(features, i))); + printf("%s", lilv_value_as_uri(lilv_values_get(features, i))); first = false; } if (features) printf("\n"); - slv2_values_free(features); + lilv_values_free(features); /* Optional Features */ - features = slv2_plugin_get_optional_features(p); + features = lilv_plugin_get_optional_features(p); if (features) printf("\tOptional Features: "); first = true; - SLV2_FOREACH(values, i, features) { + LILV_FOREACH(values, i, features) { if (!first) { printf("\n\t "); } - printf("%s", slv2_value_as_uri(slv2_values_get(features, i))); + printf("%s", lilv_value_as_uri(lilv_values_get(features, i))); first = false; } if (features) printf("\n"); - slv2_values_free(features); + lilv_values_free(features); /* Presets */ - SLV2Values presets = slv2_plugin_get_value(p, preset_pred); + LilvValues presets = lilv_plugin_get_value(p, preset_pred); if (presets) printf("\tPresets: \n"); - SLV2_FOREACH(values, i, presets) { - SLV2Values titles = slv2_plugin_get_value_for_subject( - p, slv2_values_get(presets, i), title_pred); + LILV_FOREACH(values, i, presets) { + LilvValues titles = lilv_plugin_get_value_for_subject( + p, lilv_values_get(presets, i), title_pred); if (titles) { - SLV2Value title = slv2_values_get(titles, slv2_values_begin(titles)); - printf("\t %s\n", slv2_value_as_string(title)); + LilvValue title = lilv_values_get(titles, lilv_values_begin(titles)); + printf("\t %s\n", lilv_value_as_string(title)); } } /* Ports */ - const uint32_t num_ports = slv2_plugin_get_num_ports(p); + const uint32_t num_ports = lilv_plugin_get_num_ports(p); float* mins = calloc(num_ports, sizeof(float)); float* maxes = calloc(num_ports, sizeof(float)); float* defaults = calloc(num_ports, sizeof(float)); - slv2_plugin_get_port_ranges_float(p, mins, maxes, defaults); + lilv_plugin_get_port_ranges_float(p, mins, maxes, defaults); for (uint32_t i = 0; i < num_ports; ++i) print_port(p, i, mins, maxes, defaults); @@ -290,7 +290,7 @@ void print_version() { printf( - "lv2_inspect (slv2) " SLV2_VERSION "\n" + "lv2_inspect (slv2) " LILV_VERSION "\n" "Copyright 2007-2011 David Robillard <http://drobilla.net>\n" "License: <http://www.opensource.org/licenses/isc-license>\n" "This is free software: you are free to change and redistribute it.\n" @@ -310,19 +310,19 @@ main(int argc, char** argv) int ret = 0; setlocale (LC_ALL, ""); - SLV2World world = slv2_world_new(); - slv2_world_load_all(world); + LilvWorld world = lilv_world_new(); + lilv_world_load_all(world); #define NS_DC "http://dublincore.org/documents/dcmi-namespace/" #define NS_PG "http://lv2plug.in/ns/ext/port-groups#" #define NS_PSET "http://lv2plug.in/ns/ext/presets#" - control_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_CONTROL); - event_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_EVENT); - in_group_pred = slv2_value_new_uri(world, NS_PG "inGroup"); - preset_pred = slv2_value_new_uri(world, NS_PSET "hasPreset"); - role_pred = slv2_value_new_uri(world, NS_PG "role"); - title_pred = slv2_value_new_uri(world, NS_DC "title"); + control_class = lilv_value_new_uri(world, LILV_PORT_CLASS_CONTROL); + event_class = lilv_value_new_uri(world, LILV_PORT_CLASS_EVENT); + in_group_pred = lilv_value_new_uri(world, NS_PG "inGroup"); + preset_pred = lilv_value_new_uri(world, NS_PSET "hasPreset"); + role_pred = lilv_value_new_uri(world, NS_PG "role"); + title_pred = lilv_value_new_uri(world, NS_DC "title"); if (argc != 2) { print_usage(); @@ -344,10 +344,10 @@ main(int argc, char** argv) goto done; } - SLV2Plugins plugins = slv2_world_get_all_plugins(world); - SLV2Value uri = slv2_value_new_uri(world, argv[1]); + LilvPlugins plugins = lilv_world_get_all_plugins(world); + LilvValue uri = lilv_value_new_uri(world, argv[1]); - SLV2Plugin p = slv2_plugins_get_by_uri(plugins, uri); + LilvPlugin p = lilv_plugins_get_by_uri(plugins, uri); if (p) { print_plugin(p); @@ -357,16 +357,16 @@ main(int argc, char** argv) ret = (p != NULL ? 0 : -1); - slv2_value_free(uri); + lilv_value_free(uri); done: - slv2_value_free(title_pred); - slv2_value_free(role_pred); - slv2_value_free(preset_pred); - slv2_value_free(in_group_pred); - slv2_value_free(event_class); - slv2_value_free(control_class); - slv2_world_free(world); + lilv_value_free(title_pred); + lilv_value_free(role_pred); + lilv_value_free(preset_pred); + lilv_value_free(in_group_pred); + lilv_value_free(event_class); + lilv_value_free(control_class); + lilv_world_free(world); return ret; } diff --git a/utils/lv2_jack_host.c b/utils/lv2_jack_host.c index 5e0bca8..20c9ad7 100644 --- a/utils/lv2_jack_host.c +++ b/utils/lv2_jack_host.c @@ -30,17 +30,17 @@ #include "lv2/lv2plug.in/ns/ext/event/event.h" #include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h" -#include "slv2/slv2.h" +#include "lilv/lilv.h" -#include "slv2-config.h" +#include "lilv-config.h" -#ifdef SLV2_JACK_SESSION +#ifdef LILV_JACK_SESSION #include <jack/session.h> #include <glib.h> GMutex* exit_mutex; GCond* exit_cond; -#endif /* SLV2_JACK_SESSION */ +#endif /* LILV_JACK_SESSION */ #define MIDI_BUFFER_SIZE 1024 @@ -51,7 +51,7 @@ enum PortType { }; struct Port { - SLV2Port slv2_port; + LilvPort lilv_port; enum PortType type; jack_port_t* jack_port; /**< For audio/MIDI ports, otherwise NULL */ float control; /**< For control ports, otherwise 0.0f */ @@ -62,17 +62,17 @@ struct Port { /** This program's data */ struct JackHost { jack_client_t* jack_client; /**< Jack client */ - SLV2Plugin plugin; /**< Plugin "class" (actually just a few strings) */ - SLV2Instance instance; /**< Plugin "instance" (loaded shared lib) */ + LilvPlugin plugin; /**< Plugin "class" (actually just a few strings) */ + LilvInstance instance; /**< Plugin "instance" (loaded shared lib) */ uint32_t num_ports; /**< Size of the two following arrays: */ struct Port* ports; /**< Port array of size num_ports */ - SLV2Value input_class; /**< Input port class (URI) */ - SLV2Value output_class; /**< Output port class (URI) */ - SLV2Value control_class; /**< Control port class (URI) */ - SLV2Value audio_class; /**< Audio port class (URI) */ - SLV2Value event_class; /**< Event port class (URI) */ - SLV2Value midi_class; /**< MIDI event class (URI) */ - SLV2Value optional; /**< lv2:connectionOptional port property */ + LilvValue input_class; /**< Input port class (URI) */ + LilvValue output_class; /**< Output port class (URI) */ + LilvValue control_class; /**< Control port class (URI) */ + LilvValue audio_class; /**< Audio port class (URI) */ + LilvValue event_class; /**< Event port class (URI) */ + LilvValue midi_class; /**< MIDI event class (URI) */ + LilvValue optional; /**< lv2:connectionOptional port property */ }; /** URI map feature, for event types (we use only MIDI) */ @@ -83,7 +83,7 @@ uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char* uri) { /* Note a non-trivial host needs to use an actual dictionary here */ - if (!strcmp(map, LV2_EVENT_URI) && !strcmp(uri, SLV2_EVENT_CLASS_MIDI)) + if (!strcmp(map, LV2_EVENT_URI) && !strcmp(uri, LILV_EVENT_CLASS_MIDI)) return MIDI_EVENT_ID; else return 0; /* Refuse to map ID */ @@ -118,45 +118,45 @@ create_port(struct JackHost* host, { struct Port* const port = &host->ports[port_index]; - port->slv2_port = slv2_plugin_get_port_by_index(host->plugin, port_index); + port->lilv_port = lilv_plugin_get_port_by_index(host->plugin, port_index); port->jack_port = NULL; port->control = 0.0f; port->ev_buffer = NULL; - slv2_instance_connect_port(host->instance, port_index, NULL); + lilv_instance_connect_port(host->instance, port_index, NULL); /* Get the port symbol for console printing */ - SLV2Value symbol = slv2_port_get_symbol(host->plugin, port->slv2_port); - const char* symbol_str = slv2_value_as_string(symbol); + LilvValue symbol = lilv_port_get_symbol(host->plugin, port->lilv_port); + const char* symbol_str = lilv_value_as_string(symbol); enum JackPortFlags jack_flags = 0; - if (slv2_port_is_a(host->plugin, port->slv2_port, host->input_class)) { + if (lilv_port_is_a(host->plugin, port->lilv_port, host->input_class)) { jack_flags = JackPortIsInput; port->is_input = true; - } else if (slv2_port_is_a(host->plugin, port->slv2_port, host->output_class)) { + } else if (lilv_port_is_a(host->plugin, port->lilv_port, host->output_class)) { jack_flags = JackPortIsOutput; port->is_input = false; - } else if (slv2_port_has_property(host->plugin, port->slv2_port, host->optional)) { - slv2_instance_connect_port(host->instance, port_index, NULL); + } else if (lilv_port_has_property(host->plugin, port->lilv_port, host->optional)) { + lilv_instance_connect_port(host->instance, port_index, NULL); } else { die("Mandatory port has unknown type (neither input or output)"); } /* Set control values */ - if (slv2_port_is_a(host->plugin, port->slv2_port, host->control_class)) { + if (lilv_port_is_a(host->plugin, port->lilv_port, host->control_class)) { port->type = CONTROL; port->control = isnan(default_value) ? 0.0 : default_value; printf("%s = %f\n", symbol_str, host->ports[port_index].control); - } else if (slv2_port_is_a(host->plugin, port->slv2_port, host->audio_class)) { + } else if (lilv_port_is_a(host->plugin, port->lilv_port, host->audio_class)) { port->type = AUDIO; - } else if (slv2_port_is_a(host->plugin, port->slv2_port, host->event_class)) { + } else if (lilv_port_is_a(host->plugin, port->lilv_port, host->event_class)) { port->type = EVENT; } /* Connect the port based on its type */ switch (port->type) { case CONTROL: - slv2_instance_connect_port(host->instance, port_index, &port->control); + lilv_instance_connect_port(host->instance, port_index, &port->control); break; case AUDIO: port->jack_port = jack_port_register( @@ -166,11 +166,11 @@ create_port(struct JackHost* host, port->jack_port = jack_port_register( host->jack_client, symbol_str, JACK_DEFAULT_MIDI_TYPE, jack_flags, 0); port->ev_buffer = lv2_event_buffer_new(MIDI_BUFFER_SIZE, LV2_EVENT_AUDIO_STAMP); - slv2_instance_connect_port(host->instance, port_index, port->ev_buffer); + lilv_instance_connect_port(host->instance, port_index, port->ev_buffer); break; default: /* FIXME: check if port connection is optional and die if not */ - slv2_instance_connect_port(host->instance, port_index, NULL); + lilv_instance_connect_port(host->instance, port_index, NULL); fprintf(stderr, "WARNING: Unknown port type, port not connected.\n"); } } @@ -188,7 +188,7 @@ jack_process_cb(jack_nframes_t nframes, void* data) if (host->ports[p].type == AUDIO) { /* Connect plugin port directly to Jack port buffer. */ - slv2_instance_connect_port( + lilv_instance_connect_port( host->instance, p, jack_port_get_buffer(host->ports[p].jack_port, nframes)); @@ -217,7 +217,7 @@ jack_process_cb(jack_nframes_t nframes, void* data) } /* Run plugin for this cycle */ - slv2_instance_run(host->instance, nframes); + lilv_instance_run(host->instance, nframes); /* Deliver MIDI output */ for (uint32_t p = 0; p < host->num_ports; ++p) { @@ -245,7 +245,7 @@ jack_process_cb(jack_nframes_t nframes, void* data) return 0; } -#ifdef SLV2_JACK_SESSION +#ifdef LILV_JACK_SESSION void jack_session_cb(jack_session_event_t* event, void* arg) { @@ -253,7 +253,7 @@ jack_session_cb(jack_session_event_t* event, void* arg) char cmd[256]; snprintf(cmd, sizeof(cmd), "lv2_jack_host %s %s", - slv2_value_as_uri(slv2_plugin_get_uri(host->plugin)), + lilv_value_as_uri(lilv_plugin_get_uri(host->plugin)), event->client_uuid); event->command_line = strdup(cmd); @@ -273,12 +273,12 @@ jack_session_cb(jack_session_event_t* event, void* arg) jack_session_event_free(event); } -#endif /* SLV2_JACK_SESSION */ +#endif /* LILV_JACK_SESSION */ static void signal_handler(int ignored) { -#ifdef SLV2_JACK_SESSION +#ifdef LILV_JACK_SESSION g_mutex_lock(exit_mutex); g_cond_signal(exit_cond); g_mutex_unlock(exit_mutex); @@ -293,7 +293,7 @@ main(int argc, char** argv) host.num_ports = 0; host.ports = NULL; -#ifdef SLV2_JACK_SESSION +#ifdef LILV_JACK_SESSION if (!g_thread_supported()) { g_thread_init(NULL); } @@ -305,28 +305,28 @@ main(int argc, char** argv) signal(SIGTERM, signal_handler); /* Find all installed plugins */ - SLV2World world = slv2_world_new(); - slv2_world_load_all(world); - SLV2Plugins plugins = slv2_world_get_all_plugins(world); + LilvWorld world = lilv_world_new(); + lilv_world_load_all(world); + LilvPlugins plugins = lilv_world_get_all_plugins(world); /* Set up the port classes this app supports */ - host.input_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_INPUT); - host.output_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_OUTPUT); - host.control_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_CONTROL); - host.audio_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_AUDIO); - host.event_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_EVENT); - host.midi_class = slv2_value_new_uri(world, SLV2_EVENT_CLASS_MIDI); - host.optional = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 + host.input_class = lilv_value_new_uri(world, LILV_PORT_CLASS_INPUT); + host.output_class = lilv_value_new_uri(world, LILV_PORT_CLASS_OUTPUT); + host.control_class = lilv_value_new_uri(world, LILV_PORT_CLASS_CONTROL); + host.audio_class = lilv_value_new_uri(world, LILV_PORT_CLASS_AUDIO); + host.event_class = lilv_value_new_uri(world, LILV_PORT_CLASS_EVENT); + host.midi_class = lilv_value_new_uri(world, LILV_EVENT_CLASS_MIDI); + host.optional = lilv_value_new_uri(world, LILV_NAMESPACE_LV2 "connectionOptional"); -#ifdef SLV2_JACK_SESSION +#ifdef LILV_JACK_SESSION if (argc != 2 && argc != 3) { fprintf(stderr, "Usage: %s PLUGIN_URI [JACK_UUID]\n", argv[0]); #else if (argc != 2) { fprintf(stderr, "Usage: %s PLUGIN_URI\n", argv[0]); #endif - slv2_world_free(world); + lilv_world_free(world); return EXIT_FAILURE; } @@ -334,19 +334,19 @@ main(int argc, char** argv) printf("Plugin: %s\n", plugin_uri_str); - SLV2Value plugin_uri = slv2_value_new_uri(world, plugin_uri_str); - host.plugin = slv2_plugins_get_by_uri(plugins, plugin_uri); - slv2_value_free(plugin_uri); + LilvValue plugin_uri = lilv_value_new_uri(world, plugin_uri_str); + host.plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); + lilv_value_free(plugin_uri); if (!host.plugin) { fprintf(stderr, "Failed to find plugin %s.\n", plugin_uri_str); - slv2_world_free(world); + lilv_world_free(world); return EXIT_FAILURE; } /* Get the plugin's name */ - SLV2Value name = slv2_plugin_get_name(host.plugin); - const char* name_str = slv2_value_as_string(name); + LilvValue name = lilv_plugin_get_name(host.plugin); + const char* name_str = lilv_value_as_string(name); /* Truncate plugin name to suit JACK (if necessary) */ char* jack_name = NULL; @@ -359,7 +359,7 @@ main(int argc, char** argv) /* Connect to JACK */ printf("JACK Name: %s\n\n", jack_name); -#ifdef SLV2_JACK_SESSION +#ifdef LILV_JACK_SESSION const char* const jack_uuid_str = (argc > 2) ? argv[2] : NULL; if (jack_uuid_str) { host.jack_client = jack_client_open(jack_name, JackSessionID, NULL, @@ -372,28 +372,28 @@ main(int argc, char** argv) } free(jack_name); - slv2_value_free(name); + lilv_value_free(name); if (!host.jack_client) die("Failed to connect to JACK.\n"); /* Instantiate the plugin */ - host.instance = slv2_plugin_instantiate( + host.instance = lilv_plugin_instantiate( host.plugin, jack_get_sample_rate(host.jack_client), features); if (!host.instance) die("Failed to instantiate plugin.\n"); jack_set_process_callback(host.jack_client, &jack_process_cb, (void*)(&host)); -#ifdef SLV2_JACK_SESSION +#ifdef LILV_JACK_SESSION jack_set_session_callback(host.jack_client, &jack_session_cb, (void*)(&host)); #endif /* Create ports */ - host.num_ports = slv2_plugin_get_num_ports(host.plugin); + host.num_ports = lilv_plugin_get_num_ports(host.plugin); host.ports = calloc((size_t)host.num_ports, sizeof(struct Port)); - float* default_values = calloc(slv2_plugin_get_num_ports(host.plugin), + float* default_values = calloc(lilv_plugin_get_num_ports(host.plugin), sizeof(float)); - slv2_plugin_get_port_ranges_float(host.plugin, NULL, NULL, default_values); + lilv_plugin_get_port_ranges_float(host.plugin, NULL, NULL, default_values); for (uint32_t i = 0; i < host.num_ports; ++i) create_port(&host, i, default_values[i]); @@ -401,11 +401,11 @@ main(int argc, char** argv) free(default_values); /* Activate plugin and JACK */ - slv2_instance_activate(host.instance); + lilv_instance_activate(host.instance); jack_activate(host.jack_client); /* Run */ -#ifdef SLV2_JACK_SESSION +#ifdef LILV_JACK_SESSION printf("\nPress Ctrl-C to quit: "); fflush(stdout); g_cond_wait(exit_cond, exit_mutex); @@ -431,21 +431,21 @@ main(int argc, char** argv) jack_client_close(host.jack_client); /* Deactivate plugin */ - slv2_instance_deactivate(host.instance); - slv2_instance_free(host.instance); + lilv_instance_deactivate(host.instance); + lilv_instance_free(host.instance); /* Clean up */ free(host.ports); - slv2_value_free(host.input_class); - slv2_value_free(host.output_class); - slv2_value_free(host.control_class); - slv2_value_free(host.audio_class); - slv2_value_free(host.event_class); - slv2_value_free(host.midi_class); - slv2_value_free(host.optional); - slv2_world_free(world); - -#ifdef SLV2_JACK_SESSION + lilv_value_free(host.input_class); + lilv_value_free(host.output_class); + lilv_value_free(host.control_class); + lilv_value_free(host.audio_class); + lilv_value_free(host.event_class); + lilv_value_free(host.midi_class); + lilv_value_free(host.optional); + lilv_world_free(world); + +#ifdef LILV_JACK_SESSION g_mutex_free(exit_mutex); g_cond_free(exit_cond); #endif diff --git a/utils/lv2_list.c b/utils/lv2_list.c index d62699a..88769ae 100644 --- a/utils/lv2_list.c +++ b/utils/lv2_list.c @@ -18,21 +18,21 @@ #include <stdio.h> #include <string.h> -#include "slv2/slv2.h" +#include "lilv/lilv.h" -#include "slv2-config.h" +#include "lilv-config.h" void -list_plugins(SLV2Plugins list, bool show_names) +list_plugins(LilvPlugins list, bool show_names) { - SLV2_FOREACH(plugins, i, list) { - SLV2Plugin p = slv2_plugins_get(list, i); + LILV_FOREACH(plugins, i, list) { + LilvPlugin p = lilv_plugins_get(list, i); if (show_names) { - SLV2Value n = slv2_plugin_get_name(p); - printf("%s\n", slv2_value_as_string(n)); - slv2_value_free(n); + LilvValue n = lilv_plugin_get_name(p); + printf("%s\n", lilv_value_as_string(n)); + lilv_value_free(n); } else { - printf("%s\n", slv2_value_as_uri(slv2_plugin_get_uri(p))); + printf("%s\n", lilv_value_as_uri(lilv_plugin_get_uri(p))); } } } @@ -41,7 +41,7 @@ void print_version() { printf( - "lv2_list (slv2) " SLV2_VERSION "\n" + "lv2_list (lilv) " LILV_VERSION "\n" "Copyright 2007-2011 David Robillard <http://drobilla.net>\n" "License: <http://www.opensource.org/licenses/isc-license>\n" "This is free software: you are free to change and redistribute it.\n" @@ -81,14 +81,14 @@ main(int argc, char** argv) } } - SLV2World world = slv2_world_new(); - slv2_world_load_all(world); + LilvWorld world = lilv_world_new(); + lilv_world_load_all(world); - SLV2Plugins plugins = slv2_world_get_all_plugins(world); + LilvPlugins plugins = lilv_world_get_all_plugins(world); list_plugins(plugins, show_names); - slv2_world_free(world); + lilv_world_free(world); return 0; } |