aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-11-01 22:21:08 +0000
committerDavid Robillard <d@drobilla.net>2013-11-01 22:21:08 +0000
commit277aa925a66e7009a735fa389ee30670b8b00456 (patch)
tree71ff3c80c912c8262995740a46bc44dd23e5eafb
parent6f24e3c12694a2ec697be35b16b47c0dbe47d507 (diff)
downloadjalv-277aa925a66e7009a735fa389ee30670b8b00456.tar.gz
jalv-277aa925a66e7009a735fa389ee30670b8b00456.tar.bz2
jalv-277aa925a66e7009a735fa389ee30670b8b00456.zip
Support ui:portMap feature to allow UIs to avoid hard-coded port indices
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5170 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--NEWS4
-rw-r--r--src/jalv.c11
-rw-r--r--src/jalv_internal.h3
3 files changed, 16 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 7cf05a3..63a9b49 100644
--- a/NEWS
+++ b/NEWS
@@ -2,8 +2,10 @@ jalv (1.4.3) unstable;
* Hide controls for ports with notOnGUI property in generic UI
(based on patch from Robin Gareus)
+ * Support ui:portMap feature to allow UIs to avoid hard-coded port indices
+ (useful for compatibility and separately distributed UIs)
- -- David Robillard <d@drobilla.net> Thu, 31 Oct 2013 22:38:42 -0400
+ -- David Robillard <d@drobilla.net> Fri, 01 Nov 2013 18:20:19 -0400
jalv (1.4.2) stable;
diff --git a/src/jalv.c b/src/jalv.c
index f3a7f72..fe17d08 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -644,7 +644,7 @@ jack_session_cb(jack_session_event_t* event, void* arg)
void
jalv_ui_instantiate(Jalv* jalv, const char* native_ui_type, void* parent)
{
- jalv->ui_host = suil_host_new(jalv_ui_write, NULL, NULL, NULL);
+ jalv->ui_host = suil_host_new(jalv_ui_write, jalv_ui_port_index, NULL, NULL);
const LV2_Feature parent_feature = {
LV2_UI__parent, parent
@@ -747,6 +747,15 @@ jalv_ui_write(SuilController controller,
jack_ringbuffer_write(jalv->ui_events, buf, sizeof(buf));
}
+uint32_t
+jalv_ui_port_index(SuilController controller, const char* symbol)
+{
+ Jalv* const jalv = (Jalv*)controller;
+ struct Port* port = jalv_port_by_symbol(jalv, symbol);
+
+ return port ? port->index : LV2UI_INVALID_PORT_INDEX;
+}
+
bool
jalv_emit_ui_events(Jalv* jalv)
{
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 8ea45df..5bcb175 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -237,6 +237,9 @@ jalv_ui_write(SuilController controller,
uint32_t protocol,
const void* buffer);
+uint32_t
+jalv_ui_port_index(SuilController controller, const char* port_symbol);
+
void
jalv_ui_port_event(Jalv* jalv,
uint32_t port_index,