diff options
-rw-r--r-- | src/jalv.c | 4 | ||||
-rw-r--r-- | src/state.c | 16 |
2 files changed, 13 insertions, 7 deletions
@@ -486,6 +486,10 @@ jalv_ui_write(SuilController controller, { Jalv* host = (Jalv*)controller; + if (!host->ui) { + return; + } + if (protocol != 0 && protocol != host->atom_prot_id) { fprintf(stderr, "UI write with unsupported protocol %d (%s)\n", protocol, symap_unmap(host->symap, protocol)); diff --git a/src/state.c b/src/state.c index 03362fb..3ef4d3d 100644 --- a/src/state.c +++ b/src/state.c @@ -140,13 +140,15 @@ set_port_value(const char* port_symbol, jalv_ui_write(jalv, port->index, sizeof(fvalue), 0, &fvalue); // Update UI - char buf[sizeof(ControlChange) + sizeof(fvalue)]; - ControlChange* ev = (ControlChange*)buf; - ev->index = port->index; - ev->protocol = 0; - ev->size = sizeof(fvalue); - *(float*)ev->body = fvalue; - jack_ringbuffer_write(jalv->plugin_events, buf, sizeof(buf)); + if (jalv->ui) { + char buf[sizeof(ControlChange) + sizeof(fvalue)]; + ControlChange* ev = (ControlChange*)buf; + ev->index = port->index; + ev->protocol = 0; + ev->size = sizeof(fvalue); + *(float*)ev->body = fvalue; + jack_ringbuffer_write(jalv->plugin_events, buf, sizeof(buf)); + } } void |