summaryrefslogtreecommitdiffstats
path: root/hosts/lv2_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_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_jack_host.c')
-rw-r--r--hosts/lv2_jack_host.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/hosts/lv2_jack_host.c b/hosts/lv2_jack_host.c
index e5e51a3..03d57d9 100644
--- a/hosts/lv2_jack_host.c
+++ b/hosts/lv2_jack_host.c
@@ -35,6 +35,7 @@ struct Port {
enum Direction { INPUT, OUTPUT} direction;
enum Type { UNKNOWN, FLOAT, MIDI } type;
+ SLV2PortID id;
jack_port_t* jack_port; /**< For audio and MIDI ports, otherwise NULL */
float control; /**< For control ports, otherwise 0.0f */
LV2_MIDI* midi_buffer; /**< For midi ports, otherwise NULL */
@@ -65,6 +66,8 @@ main(int argc, char** argv)
host.num_ports = 0;
host.ports = NULL;
+ slv2_init();
+
/* Find all installed plugins */
SLV2List plugins = slv2_list_new();
slv2_list_load_all(plugins);
@@ -143,6 +146,8 @@ main(int argc, char** argv)
}
jack_client_close(host.jack_client);
+ slv2_finish();
+
return 0;
}
@@ -170,6 +175,7 @@ create_port(struct JackHost* host,
//struct Port* port = (Port*)malloc(sizeof(Port));
struct Port* const port = &host->ports[port_index];
+ port->id = slv2_port_by_index(port_index);
port->type = UNKNOWN;
port->jack_port = NULL;
port->control = 0.0f;
@@ -177,17 +183,18 @@ create_port(struct JackHost* host,
slv2_instance_connect_port(host->instance, port_index, NULL);
- char* type_str = slv2_port_get_data_type(host->plugin, port_index);
+ char* type_str = slv2_port_get_data_type(host->plugin, port->id);
+
if (!strcmp(type_str, SLV2_DATA_TYPE_FLOAT))
port->type = FLOAT;
else if (!strcmp(type_str, SLV2_DATA_TYPE_MIDI))
port->type = MIDI;
/* 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, port->id);
/* Get the 'class' (not data type) 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, port->id);
if (port->type == FLOAT) {
@@ -195,7 +202,7 @@ create_port(struct JackHost* host,
switch (class) {
case SLV2_CONTROL_RATE_INPUT:
port->direction = INPUT;
- port->control = slv2_port_get_default_value(host->plugin, port_index);
+ port->control = slv2_port_get_default_value(host->plugin, port->id);
slv2_instance_connect_port(host->instance, port_index, &port->control);
printf("Set %s to %f\n", symbol, host->ports[port_index].control);
break;