diff options
author | David Robillard <d@drobilla.net> | 2018-09-22 23:29:26 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-09-22 23:29:26 +0200 |
commit | 92f5dcb38adcc008049a16e1bde5751283e85d83 (patch) | |
tree | d9e93c9fc21b8b0e20ec856724a778e8c5826f08 /src | |
parent | 1df4368056d53a308e985ef4c102969e55753624 (diff) | |
download | jalv-92f5dcb38adcc008049a16e1bde5751283e85d83.tar.gz jalv-92f5dcb38adcc008049a16e1bde5751283e85d83.tar.bz2 jalv-92f5dcb38adcc008049a16e1bde5751283e85d83.zip |
Add commands to print control values
Diffstat (limited to 'src')
-rw-r--r-- | src/jalv_console.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/jalv_console.c b/src/jalv_console.c index dc3511e..fc95229 100644 --- a/src/jalv_console.c +++ b/src/jalv_console.c @@ -137,6 +137,21 @@ jalv_native_ui_type(Jalv* jalv) } static void +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)) { + struct Port* const port = &jalv->ports[control->index]; + printf("%s = %f\n", + lilv_node_as_string(control->symbol), + port->control); + } + } +} + +static void jalv_process_command(Jalv* jalv, const char* cmd) { char sym[64]; @@ -146,9 +161,15 @@ jalv_process_command(Jalv* jalv, const char* cmd) fprintf(stderr, "Commands:\n" " help Display this help message\n" + " controls Print settable control values\n" + " monitors Print output control values\n" " set INDEX VALUE Set control value by port index\n" " set SYMBOL VALUE Set control value by symbol\n" " SYMBOL = VALUE Set control value by symbol\n"); + } else if (strcmp(cmd, "controls\n") == 0) { + jalv_print_controls(jalv, true, false); + } else if (strcmp(cmd, "monitors\n") == 0) { + 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; |