diff options
author | David Robillard <d@drobilla.net> | 2024-11-15 10:08:24 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-24 18:59:41 -0500 |
commit | 800356e507c5cc098e89b1cbe96f5f150dc12d96 (patch) | |
tree | 0859bac836bc25f147a5d51cdb67fc619d2726c8 /src/jalv.c | |
parent | 7c9858897ff6014a6cf36cefbd05f1f4f63817c4 (diff) | |
download | jalv-800356e507c5cc098e89b1cbe96f5f150dc12d96.tar.gz jalv-800356e507c5cc098e89b1cbe96f5f150dc12d96.tar.bz2 jalv-800356e507c5cc098e89b1cbe96f5f150dc12d96.zip |
Move low-level event sending functions to a separate file
Takes advantage of the dependency trimming of the previous commit to work
towards separating things more cleanly.
Diffstat (limited to 'src/jalv.c')
-rw-r--r-- | src/jalv.c | 51 |
1 files changed, 1 insertions, 50 deletions
@@ -2,6 +2,7 @@ // SPDX-License-Identifier: ISC #include "backend.h" +#include "comm.h" #include "control.h" #include "frontend.h" #include "jalv_config.h" @@ -642,56 +643,6 @@ jalv_init_ui(Jalv* jalv) } } -static ZixStatus -jalv_write_control_change(ZixRing* const target, - const void* const header, - const uint32_t header_size, - const void* const body, - const uint32_t body_size) -{ - ZixRingTransaction tx = zix_ring_begin_write(target); - - ZixStatus st = ZIX_STATUS_SUCCESS; - if (!(st = zix_ring_amend_write(target, &tx, header, header_size)) && - !(st = zix_ring_amend_write(target, &tx, body, body_size))) { - st = zix_ring_commit_write(target, &tx); - } - - return st; -} - -ZixStatus -jalv_write_event(ZixRing* const target, - const uint32_t port_index, - const uint32_t protocol, - const uint32_t size, - const LV2_URID type, - const void* const body) -{ - // TODO: Be more discriminate about what to send - - typedef struct { - ControlChange change; - LV2_Atom atom; - } Header; - - const Header header = {{port_index, protocol, sizeof(LV2_Atom) + size}, - {size, type}}; - - return jalv_write_control_change(target, &header, sizeof(header), body, size); -} - -ZixStatus -jalv_write_control(ZixRing* const target, - const uint32_t port_index, - const float value) -{ - const ControlChange header = {port_index, 0, sizeof(value)}; - - return jalv_write_control_change( - target, &header, sizeof(header), &value, sizeof(value)); -} - void jalv_dump_atom(Jalv* const jalv, FILE* const stream, |