summaryrefslogtreecommitdiffstats
path: root/hosts
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
committerDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
commit0a04be1e9e8f3c6b355c014f5755bb30da0d5aec (patch)
treeb4eb149da0fc57af8c4e9356231aa191e6f1a118 /hosts
parent011d130c2b7f54b859ae41aac8b95d5825b975be (diff)
downloadlilv-0a04be1e9e8f3c6b355c014f5755bb30da0d5aec.tar.gz
lilv-0a04be1e9e8f3c6b355c014f5755bb30da0d5aec.tar.bz2
lilv-0a04be1e9e8f3c6b355c014f5755bb30da0d5aec.zip
Strip trailing whitespace.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@1999 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'hosts')
-rw-r--r--hosts/lv2_jack_host.c34
-rw-r--r--hosts/lv2_simple_jack_host.c34
2 files changed, 34 insertions, 34 deletions
diff --git a/hosts/lv2_jack_host.c b/hosts/lv2_jack_host.c
index 1beef0e..8daaaad 100644
--- a/hosts/lv2_jack_host.c
+++ b/hosts/lv2_jack_host.c
@@ -1,6 +1,6 @@
/* jack_host - SLV2 Jack Host
* Copyright (C) 2007 Dave Robillard <drobilla.net>
- *
+ *
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
@@ -113,12 +113,12 @@ main(int argc, char** argv)
host.jack_client = NULL;
host.num_ports = 0;
host.ports = NULL;
-
+
/* Find all installed plugins */
SLV2World world = slv2_world_new();
slv2_world_load_all(world);
SLV2Plugins plugins = slv2_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);
@@ -130,7 +130,7 @@ main(int argc, char** argv)
/* Find the plugin to run */
const char* plugin_uri_str = (argc == 2) ? argv[1] : NULL;
-
+
if (!plugin_uri_str) {
fprintf(stderr, "\nYou must specify a plugin URI to load.\n");
fprintf(stderr, "\nKnown plugins:\n\n");
@@ -144,7 +144,7 @@ main(int argc, char** argv)
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);
-
+
if (!host.plugin) {
fprintf(stderr, "Failed to find plugin %s.\n", plugin_uri_str);
slv2_world_free(world);
@@ -164,7 +164,7 @@ main(int argc, char** argv)
} else {
jack_name = strdup(name_str);
}
-
+
/* Connect to JACK */
printf("JACK Name:\t%s\n", jack_name);
host.jack_client = jack_client_open(jack_name, JackNullOption, NULL);
@@ -176,7 +176,7 @@ main(int argc, char** argv)
die("Failed to connect to JACK.");
else
printf("Connected to JACK.\n");
-
+
/* Instantiate the plugin */
host.instance = slv2_plugin_instantiate(
host.plugin, jack_get_sample_rate(host.jack_client), features);
@@ -186,11 +186,11 @@ main(int argc, char** argv)
printf("Succesfully instantiated plugin.\n");
jack_set_process_callback(host.jack_client, &jack_process_cb, (void*)(&host));
-
+
/* Create ports */
host.num_ports = slv2_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(slv2_plugin_get_num_ports(host.plugin),
sizeof(float));
slv2_plugin_get_port_ranges_float(host.plugin, NULL, NULL, default_values);
@@ -198,19 +198,19 @@ main(int argc, char** argv)
create_port(&host, i, default_values[i]);
free(default_values);
-
+
/* Activate plugin and JACK */
slv2_instance_activate(host.instance);
jack_activate(host.jack_client);
-
+
/* Run */
printf("Press enter to quit: ");
getc(stdin);
printf("\n");
-
+
/* Deactivate JACK */
jack_deactivate(host.jack_client);
-
+
printf("Shutting down JACK.\n");
for (unsigned long i=0; i < host.num_ports; ++i) {
if (host.ports[i].jack_port != NULL) {
@@ -222,11 +222,11 @@ main(int argc, char** argv)
}
}
jack_client_close(host.jack_client);
-
+
/* Deactivate plugin */
slv2_instance_deactivate(host.instance);
slv2_instance_free(host.instance);
-
+
/* Clean up */
free(host.ports);
slv2_value_free(host.input_class);
@@ -289,7 +289,7 @@ create_port(struct JackHost* host,
} 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)) {
port->type = CONTROL;
@@ -362,7 +362,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
}
}
}
-
+
/* Run plugin for this cycle */
slv2_instance_run(host->instance, nframes);
diff --git a/hosts/lv2_simple_jack_host.c b/hosts/lv2_simple_jack_host.c
index 32c852c..7751464 100644
--- a/hosts/lv2_simple_jack_host.c
+++ b/hosts/lv2_simple_jack_host.c
@@ -1,6 +1,6 @@
/* SLV2 Simple Jack Host Example
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
@@ -53,7 +53,7 @@ main(int argc, char** argv)
host.num_ports = 0;
host.jack_ports = NULL;
host.controls = NULL;
-
+
/* Find all installed plugins */
host.world = slv2_world_new();
slv2_world_load_all(host.world);
@@ -70,7 +70,7 @@ main(int argc, char** argv)
/* Find the plugin to run */
const char* plugin_uri_str = (argc == 2) ? argv[1] : NULL;
-
+
if (!plugin_uri_str) {
fprintf(stderr, "\nYou must specify a plugin URI to load.\n");
fprintf(stderr, "\nKnown plugins:\n\n");
@@ -83,7 +83,7 @@ main(int argc, char** argv)
SLV2Value plugin_uri = slv2_value_new_uri(host.world, plugin_uri_str);
host.plugin = slv2_plugins_get_by_uri(plugins, plugin_uri);
slv2_value_free(plugin_uri);
-
+
if (!host.plugin) {
fprintf(stderr, "Failed to find plugin %s.\n", plugin_uri_str);
slv2_world_free(host.world);
@@ -107,7 +107,7 @@ main(int argc, char** argv)
/* Connect to JACK */
printf("JACK Name:\t%s\n", jack_name);
host.jack_client = jack_client_open(jack_name, JackNullOption, NULL);
-
+
free(jack_name);
slv2_value_free(name);
@@ -115,7 +115,7 @@ main(int argc, char** argv)
die("Failed to connect to JACK.");
else
printf("Connected to JACK.\n");
-
+
/* Instantiate the plugin */
host.instance = slv2_plugin_instantiate(
host.plugin, jack_get_sample_rate(host.jack_client), NULL);
@@ -125,27 +125,27 @@ main(int argc, char** argv)
printf("Succesfully instantiated plugin.\n");
jack_set_process_callback(host.jack_client, &jack_process_cb, (void*)(&host));
-
+
/* Create ports */
host.num_ports = slv2_plugin_get_num_ports(host.plugin);
host.jack_ports = calloc((size_t)host.num_ports, sizeof(jack_port_t*));
host.controls = calloc((size_t)host.num_ports, sizeof(float*));
-
+
for (uint32_t i=0; i < host.num_ports; ++i)
create_port(&host, i);
-
+
/* Activate plugin and JACK */
slv2_instance_activate(host.instance);
jack_activate(host.jack_client);
-
+
/* Run */
printf("Press enter to quit: ");
getc(stdin);
printf("\n");
-
+
/* Deactivate JACK */
jack_deactivate(host.jack_client);
-
+
printf("Shutting down JACK.\n");
for (unsigned long i=0; i < host.num_ports; ++i) {
if (host.jack_ports[i] != NULL) {
@@ -154,7 +154,7 @@ main(int argc, char** argv)
}
}
jack_client_close(host.jack_client);
-
+
/* Deactivate plugin */
slv2_instance_deactivate(host.instance);
slv2_instance_free(host.instance);
@@ -195,11 +195,11 @@ create_port(struct JackHost* host,
/* Get the port symbol (label) for console printing */
SLV2Value symbol = slv2_port_get_symbol(host->plugin, port);
const char* symbol_str = slv2_value_as_string(symbol);
-
+
/* Initialize the port array elements */
host->jack_ports[index] = NULL;
host->controls[index] = 0.0f;
-
+
/* Connect control ports to controls array */
if (slv2_port_is_a(host->plugin, port, host->control_class)) {
@@ -211,7 +211,7 @@ create_port(struct JackHost* host,
printf("Set %s to %f\n", symbol_str, host->controls[index]);
slv2_value_free(def);
}
-
+
slv2_instance_connect_port(host->instance, index, &host->controls[index]);
} else if (slv2_port_is_a(host->plugin, port, host->audio_class)) {
@@ -240,7 +240,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
if (host->jack_ports[i] != NULL)
slv2_instance_connect_port(host->instance, i,
jack_port_get_buffer(host->jack_ports[i], nframes));
-
+
/* Run plugin for this cycle */
slv2_instance_run(host->instance, nframes);