diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/lilv_bench.c | 6 | ||||
-rw-r--r-- | utils/lv2_inspect.c | 86 | ||||
-rw-r--r-- | utils/lv2_jack_host.c | 48 | ||||
-rw-r--r-- | utils/lv2_list.c | 10 |
4 files changed, 79 insertions, 71 deletions
diff --git a/utils/lilv_bench.c b/utils/lilv_bench.c index 2920fb5..b9e72db 100644 --- a/utils/lilv_bench.c +++ b/utils/lilv_bench.c @@ -40,12 +40,12 @@ print_usage() int main(int argc, char** argv) { - LilvWorld world = lilv_world_new(); + LilvWorld* world = lilv_world_new(); lilv_world_load_all(world); - LilvPlugins plugins = lilv_world_get_all_plugins(world); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); LILV_FOREACH(plugins, p, plugins) { - LilvPlugin plugin = lilv_plugins_get(plugins, p); + const LilvPlugin* plugin = lilv_plugins_get(plugins, p); lilv_plugin_get_class(plugin); } diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c index e9b7cf5..453f37f 100644 --- a/utils/lv2_inspect.c +++ b/utils/lv2_inspect.c @@ -24,15 +24,18 @@ #include "lilv-config.h" -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; +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(LilvPlugin p, LilvValue group, LilvValue type, LilvValue symbol) +print_group(const LilvPlugin* p, + const LilvValue* group, + LilvValue* type, + LilvValue* symbol) { printf("\n\tGroup %s:\n", lilv_value_as_string(group)); printf("\t\tType: %s\n", lilv_value_as_string(type)); @@ -40,9 +43,13 @@ print_group(LilvPlugin p, LilvValue group, LilvValue type, LilvValue symbol) } void -print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defaults) +print_port(const LilvPlugin* p, + uint32_t index, + float* mins, + float* maxes, + float* defaults) { - LilvPort port = lilv_plugin_get_port_by_index(p, index); + const LilvPort* port = lilv_plugin_get_port_by_index(p, index); printf("\n\tPort %d:\n", index); @@ -53,10 +60,10 @@ print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defau bool first = true; - LilvValues classes = lilv_port_get_classes(p, port); + const LilvValues* classes = lilv_port_get_classes(p, port); printf("\t\tType: "); LILV_FOREACH(values, i, classes) { - LilvValue value = lilv_values_get(classes, i); + const LilvValue* value = lilv_values_get(classes, i); if (!first) { printf("\n\t\t "); } @@ -65,44 +72,44 @@ print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defau } if (lilv_port_is_a(p, port, event_class)) { - LilvValues supported = lilv_port_get_value_by_qname(p, port, + LilvValues* supported = lilv_port_get_value_by_qname(p, port, "lv2ev:supportsEvent"); if (lilv_values_size(supported) > 0) { printf("\n\t\tSupported events:\n"); LILV_FOREACH(values, i, supported) { - LilvValue value = lilv_values_get(supported, i); + const LilvValue* value = lilv_values_get(supported, i); printf("\t\t\t%s\n", lilv_value_as_uri(value)); } } lilv_values_free(supported); } - LilvScalePoints points = lilv_port_get_scale_points(p, port); + LilvScalePoints* points = lilv_port_get_scale_points(p, port); if (points) printf("\n\t\tScale Points:\n"); LILV_FOREACH(scale_points, i, points) { - LilvScalePoint p = lilv_scale_points_get(points, i); + const LilvScalePoint* p = lilv_scale_points_get(points, i); printf("\t\t\t%s = \"%s\"\n", lilv_value_as_string(lilv_scale_point_get_value(p)), lilv_value_as_string(lilv_scale_point_get_label(p))); } lilv_scale_points_free(points); - LilvValue val = lilv_port_get_symbol(p, port); - printf("\n\t\tSymbol: %s\n", lilv_value_as_string(val)); + const LilvValue* sym = lilv_port_get_symbol(p, port); + printf("\n\t\tSymbol: %s\n", lilv_value_as_string(sym)); - val = lilv_port_get_name(p, port); - printf("\t\tName: %s\n", lilv_value_as_string(val)); - lilv_value_free(val); + LilvValue* name = lilv_port_get_name(p, port); + printf("\t\tName: %s\n", lilv_value_as_string(name)); + lilv_value_free(name); - LilvValues groups = lilv_port_get_value(p, port, in_group_pred); + LilvValues* groups = lilv_port_get_value(p, port, in_group_pred); if (lilv_values_size(groups) > 0) printf("\t\tGroup: %s\n", lilv_value_as_string( lilv_values_get(groups, lilv_values_begin(groups)))); lilv_values_free(groups); - LilvValues roles = lilv_port_get_value(p, port, role_pred); + LilvValues* roles = lilv_port_get_value(p, port, role_pred); if (lilv_values_size(roles) > 0) printf("\t\tRole: %s\n", lilv_value_as_string( @@ -118,7 +125,7 @@ print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defau printf("\t\tDefault: %f\n", defaults[index]); } - LilvValues properties = lilv_port_get_properties(p, port); + LilvValues* properties = lilv_port_get_properties(p, port); if (lilv_values_size(properties) > 0) printf("\t\tProperties: "); first = true; @@ -135,9 +142,9 @@ print_port(LilvPlugin p, uint32_t index, float* mins, float* maxes, float* defau } void -print_plugin(LilvPlugin p) +print_plugin(const LilvPlugin* p) { - LilvValue val = NULL; + LilvValue* val = NULL; printf("%s\n\n", lilv_value_as_uri(lilv_plugin_get_uri(p))); @@ -147,7 +154,8 @@ print_plugin(LilvPlugin p) lilv_value_free(val); } - LilvValue class_label = lilv_plugin_class_get_label(lilv_plugin_get_class(p)); + const LilvPluginClass* pclass = lilv_plugin_get_class(p); + const LilvValue* class_label = lilv_plugin_class_get_label(pclass); if (class_label) { printf("\tClass: %s\n", lilv_value_as_string(class_label)); } @@ -180,22 +188,22 @@ print_plugin(LilvPlugin p) printf("\tBundle: %s\n", lilv_value_as_uri(lilv_plugin_get_bundle_uri(p))); - LilvValue binary_uri = lilv_plugin_get_library_uri(p); + const LilvValue* binary_uri = lilv_plugin_get_library_uri(p); if (binary_uri) { printf("\tBinary: %s\n", lilv_value_as_uri(lilv_plugin_get_library_uri(p))); } - LilvUIs uis = lilv_plugin_get_uis(p); + LilvUIs* uis = lilv_plugin_get_uis(p); if (lilv_values_size(uis) > 0) { printf("\tUI: "); LILV_FOREACH(uis, i, uis) { - LilvUI ui = lilv_uis_get(uis, i); + const LilvUI* ui = lilv_uis_get(uis, i); printf("%s\n", lilv_value_as_uri(lilv_ui_get_uri(ui))); const char* binary = lilv_value_as_uri(lilv_ui_get_binary_uri(ui)); - LilvValues types = lilv_ui_get_classes(ui); + const LilvValues* types = lilv_ui_get_classes(ui); LILV_FOREACH(values, i, types) { printf("\t Class: %s\n", lilv_value_as_uri(lilv_values_get(types, i))); @@ -211,7 +219,7 @@ print_plugin(LilvPlugin p) lilv_uis_free(uis); printf("\tData URIs: "); - LilvValues data_uris = lilv_plugin_get_data_uris(p); + const LilvValues* data_uris = lilv_plugin_get_data_uris(p); bool first = true; LILV_FOREACH(values, i, data_uris) { if (!first) { @@ -224,7 +232,7 @@ print_plugin(LilvPlugin p) /* Required Features */ - LilvValues features = lilv_plugin_get_required_features(p); + LilvValues* features = lilv_plugin_get_required_features(p); if (features) printf("\tRequired Features: "); first = true; @@ -258,14 +266,14 @@ print_plugin(LilvPlugin p) /* Presets */ - LilvValues presets = lilv_plugin_get_value(p, preset_pred); + LilvValues* presets = lilv_plugin_get_value(p, preset_pred); if (presets) printf("\tPresets: \n"); LILV_FOREACH(values, i, presets) { - LilvValues titles = lilv_plugin_get_value_for_subject( + LilvValues* titles = lilv_plugin_get_value_for_subject( p, lilv_values_get(presets, i), title_pred); if (titles) { - LilvValue title = lilv_values_get(titles, lilv_values_begin(titles)); + const LilvValue* title = lilv_values_get(titles, lilv_values_begin(titles)); printf("\t %s\n", lilv_value_as_string(title)); } } @@ -310,7 +318,7 @@ main(int argc, char** argv) int ret = 0; setlocale (LC_ALL, ""); - LilvWorld world = lilv_world_new(); + LilvWorld* world = lilv_world_new(); lilv_world_load_all(world); #define NS_DC "http://dublincore.org/documents/dcmi-namespace/" @@ -344,10 +352,10 @@ main(int argc, char** argv) goto done; } - LilvPlugins plugins = lilv_world_get_all_plugins(world); - LilvValue uri = lilv_value_new_uri(world, argv[1]); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); + LilvValue* uri = lilv_value_new_uri(world, argv[1]); - LilvPlugin p = lilv_plugins_get_by_uri(plugins, uri); + const LilvPlugin* p = lilv_plugins_get_by_uri(plugins, uri); if (p) { print_plugin(p); diff --git a/utils/lv2_jack_host.c b/utils/lv2_jack_host.c index 20c9ad7..1bdfe61 100644 --- a/utils/lv2_jack_host.c +++ b/utils/lv2_jack_host.c @@ -51,28 +51,28 @@ enum PortType { }; struct 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 */ - LV2_Event_Buffer* ev_buffer; /**< For MIDI ports, otherwise NULL */ - bool is_input; + const 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 */ + LV2_Event_Buffer* ev_buffer; /**< For MIDI ports, otherwise NULL */ + bool is_input; }; /** This program's data */ struct JackHost { - jack_client_t* jack_client; /**< Jack client */ - 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 */ - 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 */ + jack_client_t* jack_client; /**< Jack client */ + const 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 */ + 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) */ @@ -126,8 +126,8 @@ create_port(struct JackHost* host, lilv_instance_connect_port(host->instance, port_index, NULL); /* Get the port symbol for console printing */ - LilvValue symbol = lilv_port_get_symbol(host->plugin, port->lilv_port); - const char* symbol_str = lilv_value_as_string(symbol); + const 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 (lilv_port_is_a(host->plugin, port->lilv_port, host->input_class)) { @@ -305,9 +305,9 @@ main(int argc, char** argv) signal(SIGTERM, signal_handler); /* Find all installed plugins */ - LilvWorld world = lilv_world_new(); + LilvWorld* world = lilv_world_new(); lilv_world_load_all(world); - LilvPlugins plugins = lilv_world_get_all_plugins(world); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); /* Set up the port classes this app supports */ host.input_class = lilv_value_new_uri(world, LILV_PORT_CLASS_INPUT); @@ -334,7 +334,7 @@ main(int argc, char** argv) printf("Plugin: %s\n", plugin_uri_str); - LilvValue plugin_uri = lilv_value_new_uri(world, plugin_uri_str); + 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); @@ -345,7 +345,7 @@ main(int argc, char** argv) } /* Get the plugin's name */ - LilvValue name = lilv_plugin_get_name(host.plugin); + 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) */ diff --git a/utils/lv2_list.c b/utils/lv2_list.c index 34d8670..471c1bd 100644 --- a/utils/lv2_list.c +++ b/utils/lv2_list.c @@ -23,12 +23,12 @@ #include "lilv-config.h" void -list_plugins(LilvPlugins list, bool show_names) +list_plugins(const LilvPlugins* list, bool show_names) { LILV_FOREACH(plugins, i, list) { - LilvPlugin p = lilv_plugins_get(list, i); + const LilvPlugin* p = lilv_plugins_get(list, i); if (show_names) { - LilvValue n = lilv_plugin_get_name(p); + LilvValue* n = lilv_plugin_get_name(p); printf("%s\n", lilv_value_as_string(n)); lilv_value_free(n); } else { @@ -81,10 +81,10 @@ main(int argc, char** argv) } } - LilvWorld world = lilv_world_new(); + LilvWorld* world = lilv_world_new(); lilv_world_load_all(world); - LilvPlugins plugins = lilv_world_get_all_plugins(world); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); list_plugins(plugins, show_names); |