aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-06-12 00:19:45 +0000
committerDavid Robillard <d@drobilla.net>2011-06-12 00:19:45 +0000
commit4445da72a563f9d0db1ee0cfdf3590705e536084 (patch)
tree31a460b41ccf7983a618f6b950f52aa7563171b3
parente8103f203c62daf7fb269a35e4fc0c92b7b16fe2 (diff)
downloadjalv-4445da72a563f9d0db1ee0cfdf3590705e536084.tar.gz
jalv-4445da72a563f9d0db1ee0cfdf3590705e536084.tar.bz2
jalv-4445da72a563f9d0db1ee0cfdf3590705e536084.zip
Support plugins without UIs. Clean up UI host/instance.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@3394 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/jalv.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/jalv.c b/src/jalv.c
index f2c3a1f..961102c 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -415,22 +415,26 @@ main(int argc, char** argv)
lilv_instance_activate(host.instance);
jack_activate(host.jack_client);
- SuilHost* ui_host = suil_host_new(lv2_ui_write, NULL, NULL, NULL);
-
- /* Instantiate the UI */
- SuilInstance* instance = suil_instance_new(
- ui_host,
- &host,
- lilv_node_as_uri(native_ui_type),
- lilv_node_as_uri(lilv_plugin_get_uri(host.plugin)),
- lilv_node_as_uri(lilv_ui_get_uri(ui)),
- lilv_node_as_uri(ui_type),
- lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui))),
- lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_binary_uri(ui))),
- NULL);
-
- /* Run UI */
- jalv_open_ui(&host, instance);
+ SuilHost* ui_host = NULL;
+ SuilInstance* ui_instance = NULL;
+ if (ui) {
+ /* Instantiate UI */
+ ui_host = suil_host_new(lv2_ui_write, NULL, NULL, NULL);
+
+ ui_instance = suil_instance_new(
+ ui_host,
+ &host,
+ lilv_node_as_uri(native_ui_type),
+ lilv_node_as_uri(lilv_plugin_get_uri(host.plugin)),
+ lilv_node_as_uri(lilv_ui_get_uri(ui)),
+ lilv_node_as_uri(ui_type),
+ lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui))),
+ lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_binary_uri(ui))),
+ NULL);
+ }
+
+ /* Run UI (or prompt at console) */
+ jalv_open_ui(&host, ui_instance);
/* Wait for finish signal from UI or signal handler */
sem_wait(&exit_sem);
@@ -460,6 +464,7 @@ main(int argc, char** argv)
lilv_node_free(host.event_class);
lilv_node_free(host.midi_class);
lilv_node_free(host.optional);
+ suil_instance_free(ui_instance);
suil_host_free(ui_host);
lilv_world_free(world);