aboutsummaryrefslogtreecommitdiffstats
path: root/src/jalv_console.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-11-17 09:01:46 -0500
committerDavid Robillard <d@drobilla.net>2024-11-24 19:04:31 -0500
commit4466b8525cd97f5fde392a42f2c730ab46ccb18a (patch)
tree0e019e8ad7e721ee3a29a9efdd0f921d97ba7d86 /src/jalv_console.c
parent57b544a5b036e671a516192dd2b4c2b84c37a3df (diff)
downloadjalv-4466b8525cd97f5fde392a42f2c730ab46ccb18a.tar.gz
jalv-4466b8525cd97f5fde392a42f2c730ab46ccb18a.tar.bz2
jalv-4466b8525cd97f5fde392a42f2c730ab46ccb18a.zip
Move control port buffers to a separate array
Diffstat (limited to 'src/jalv_console.c')
-rw-r--r--src/jalv_console.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/jalv_console.c b/src/jalv_console.c
index 430dfe1..7a8f5e8 100644
--- a/src/jalv_console.c
+++ b/src/jalv_console.c
@@ -184,13 +184,12 @@ jalv_print_controls(Jalv* jalv, bool writable, bool readable)
{
for (size_t i = 0; i < jalv->controls.n_controls; ++i) {
ControlID* const control = jalv->controls.controls[i];
- if ((control->is_writable && writable) ||
- (control->is_readable && readable)) {
- JalvPort* const port = &jalv->ports[control->index];
+ if (control->type == PORT && ((control->is_writable && writable) ||
+ (control->is_readable && readable))) {
jalv_log(JALV_LOG_INFO,
"%s = %f\n",
lilv_node_as_string(control->symbol),
- port->control);
+ jalv->controls_buf[control->index]);
}
}
@@ -239,7 +238,7 @@ jalv_process_command(Jalv* jalv, const char* cmd)
jalv_print_controls(jalv, false, true);
} else if (sscanf(cmd, "set %u %f", &index, &value) == 2) {
if (index < jalv->num_ports) {
- jalv->ports[index].control = value;
+ jalv->controls_buf[index] = value;
jalv_print_control(jalv, &jalv->ports[index], value);
} else {
fprintf(stderr, "error: port index out of range\n");
@@ -248,7 +247,7 @@ jalv_process_command(Jalv* jalv, const char* cmd)
sscanf(cmd, "%1023[a-zA-Z0-9_] = %f", sym, &value) == 2) {
JalvPort* const port = jalv_port_by_symbol(jalv, sym);
if (port) {
- port->control = value;
+ jalv->controls_buf[port->index] = value;
jalv_print_control(jalv, port, value);
} else {
fprintf(stderr, "error: no control named `%s'\n", sym);