summaryrefslogtreecommitdiffstats
path: root/hosts/lv2_simple_jack_host.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-02-07 01:45:53 +0000
committerDavid Robillard <d@drobilla.net>2007-02-07 01:45:53 +0000
commit17ec1c5594772a89a5284449754b56ccb705ebe4 (patch)
treed3ee843acc698345b3760818b1a09f55a18517bb /hosts/lv2_simple_jack_host.c
parent87e016baff11bd74d905b68e48577461b36b992c (diff)
downloadlilv-17ec1c5594772a89a5284449754b56ccb705ebe4.tar.gz
lilv-17ec1c5594772a89a5284449754b56ccb705ebe4.tar.bz2
lilv-17ec1c5594772a89a5284449754b56ccb705ebe4.zip
Added lv2.ttl installation, lv2.ttl added as source by default to queries.
Changed port API to work by referring to either index or symbol. Plugged some leaks. Added access to plugin/port hints/properties. Updated lv2.ttl. git-svn-id: http://svn.drobilla.net/lad/slv2@285 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'hosts/lv2_simple_jack_host.c')
-rw-r--r--hosts/lv2_simple_jack_host.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/hosts/lv2_simple_jack_host.c b/hosts/lv2_simple_jack_host.c
index 4b7493f..ef386b7 100644
--- a/hosts/lv2_simple_jack_host.c
+++ b/hosts/lv2_simple_jack_host.c
@@ -49,6 +49,8 @@ main(int argc, char** argv)
host.jack_ports = NULL;
host.controls = NULL;
+ slv2_init();
+
/* Find all installed plugins */
SLV2List plugins = slv2_list_new();
slv2_list_load_all(plugins);
@@ -125,6 +127,8 @@ main(int argc, char** argv)
}
jack_client_close(host.jack_client);
+ slv2_finish();
+
return 0;
}
@@ -147,40 +151,42 @@ die(const char* msg)
*/
void
create_port(struct JackHost* host,
- uint32_t port_index)
+ uint32_t index)
{
+ SLV2PortID id = slv2_port_by_index(index);
+
/* Make sure this is a float port */
- char* type = slv2_port_get_data_type(host->plugin, port_index);
+ char* type = slv2_port_get_data_type(host->plugin, id);
if (strcmp(type, SLV2_DATA_TYPE_FLOAT))
die("Unrecognized data type, aborting.");
free(type);
/* Get the port symbol (label) for console printing */
- char* symbol = slv2_port_get_symbol(host->plugin, port_index);
+ char* symbol = slv2_port_get_symbol(host->plugin, id);
/* Initialize the port array elements */
- host->jack_ports[port_index] = NULL;
- host->controls[port_index] = 0.0f;
+ host->jack_ports[index] = NULL;
+ host->controls[index] = 0.0f;
/* Get the 'class' of the port (control input, audio output, etc) */
- enum SLV2PortClass class = slv2_port_get_class(host->plugin, port_index);
+ enum SLV2PortClass class = slv2_port_get_class(host->plugin, id);
/* Connect the port based on it's 'class' */
switch (class) {
case SLV2_CONTROL_RATE_INPUT:
- host->controls[port_index] = slv2_port_get_default_value(host->plugin, port_index);
- slv2_instance_connect_port(host->instance, port_index, &host->controls[port_index]);
- printf("Set %s to %f\n", symbol, host->controls[port_index]);
+ host->controls[index] = slv2_port_get_default_value(host->plugin, id);
+ slv2_instance_connect_port(host->instance, index, &host->controls[index]);
+ printf("Set %s to %f\n", symbol, host->controls[index]);
break;
case SLV2_CONTROL_RATE_OUTPUT:
- slv2_instance_connect_port(host->instance, port_index, &host->controls[port_index]);
+ slv2_instance_connect_port(host->instance, index, &host->controls[index]);
break;
case SLV2_AUDIO_RATE_INPUT:
- host->jack_ports[port_index] = jack_port_register(host->jack_client,
+ host->jack_ports[index] = jack_port_register(host->jack_client,
symbol, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
break;
case SLV2_AUDIO_RATE_OUTPUT:
- host->jack_ports[port_index] = jack_port_register(host->jack_client,
+ host->jack_ports[index] = jack_port_register(host->jack_client,
symbol, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
break;
default: