diff options
author | David Robillard <d@drobilla.net> | 2022-08-10 14:26:06 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-17 13:51:06 -0400 |
commit | 53812b2fc4aa809bf8156faee88b59cc69d1b9ec (patch) | |
tree | d3973385b33dcac5ff23d8fca280bbc10d863960 /src/jalv.c | |
parent | 8e5bf419f1938fb2b97cd984641e51727a7673aa (diff) | |
download | jalv-53812b2fc4aa809bf8156faee88b59cc69d1b9ec.tar.gz jalv-53812b2fc4aa809bf8156faee88b59cc69d1b9ec.tar.bz2 jalv-53812b2fc4aa809bf8156faee88b59cc69d1b9ec.zip |
Factor out jalv_write_event()
Diffstat (limited to 'src/jalv.c')
-rw-r--r-- | src/jalv.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -592,12 +592,13 @@ jalv_init_ui(Jalv* jalv) } } -bool -jalv_send_to_ui(Jalv* jalv, - uint32_t port_index, - uint32_t type, - uint32_t size, - const void* body) +int +jalv_write_event(Jalv* const jalv, + ZixRing* const target, + const uint32_t port_index, + const uint32_t size, + const LV2_URID type, + const void* const body) { // TODO: Be more disciminate about what to send char evbuf[sizeof(ControlChange) + sizeof(LV2_Atom)]; @@ -610,14 +611,13 @@ jalv_send_to_ui(Jalv* jalv, atom->type = type; atom->size = size; - if (zix_ring_write_space(jalv->plugin_to_ui) >= sizeof(evbuf) + size) { - zix_ring_write(jalv->plugin_to_ui, evbuf, sizeof(evbuf)); - zix_ring_write(jalv->plugin_to_ui, (const char*)body, size); - return true; + if (zix_ring_write_space(target) >= sizeof(evbuf) + size) { + zix_ring_write(target, evbuf, sizeof(evbuf)); + zix_ring_write(target, (const char*)body, size); + return 0; } - jalv_log(JALV_LOG_ERR, "Plugin => UI buffer overflow\n"); - return false; + return 1; } int |