aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jalv.c14
-rw-r--r--src/jalv_console.c5
-rw-r--r--src/jalv_gtk.c4
-rw-r--r--src/jalv_internal.h21
4 files changed, 30 insertions, 14 deletions
diff --git a/src/jalv.c b/src/jalv.c
index 7ee1073..c819f20 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -336,6 +336,13 @@ jalv_port_by_symbol(Jalv* jalv, const char* sym)
return NULL;
}
+static void
+print_control_value(Jalv* jalv, const struct Port* port, float value)
+{
+ const LilvNode* sym = lilv_port_get_symbol(jalv->plugin, port->lilv_port);
+ printf("%-*s = %f\n", jalv->longest_sym, lilv_node_as_string(sym), value);
+}
+
/**
Expose a port to Jack (if applicable) and connect it to its buffer.
*/
@@ -361,8 +368,7 @@ activate_port(Jalv* jalv,
/* Connect the port based on its type */
switch (port->type) {
case TYPE_CONTROL:
- printf("%-*s = %f\n", jalv->longest_sym, lilv_node_as_string(sym),
- jalv->ports[port_index].control);
+ print_control_value(jalv, port, port->control);
lilv_instance_connect_port(jalv->instance, port_index, &port->control);
break;
case TYPE_AUDIO:
@@ -812,6 +818,10 @@ jalv_emit_ui_events(Jalv* jalv)
} else {
jalv_ui_port_event(jalv, ev.index, ev.size, ev.protocol, buf);
}
+
+ if (ev.protocol == 0 && jalv->opts.print_controls) {
+ print_control_value(jalv, &jalv->ports[ev.index], *(float*)buf);
+ }
}
return true;
diff --git a/src/jalv_console.c b/src/jalv_console.c
index c13880b..f3fafbb 100644
--- a/src/jalv_console.c
+++ b/src/jalv_console.c
@@ -33,7 +33,8 @@ print_usage(const char* name, bool error)
fprintf(os, "Usage: %s [OPTION...] PLUGIN_URI\n", name);
fprintf(os, "Run an LV2 plugin as a Jack application.\n");
fprintf(os, " -h Display this help and exit\n");
- fprintf(os, " -s Show non-embedded UI if possible\n");
+ fprintf(os, " -p Print control output changes to stdout\n");
+ fprintf(os, " -c SYM=VAL Set control value (e.g. \"vol=1.4\")\n");
fprintf(os, " -u UUID UUID for Jack session restoration\n");
fprintf(os, " -l DIR Load state from save directory\n");
fprintf(os, " -d DIR Dump plugin <=> UI communication\n");
@@ -69,6 +70,8 @@ jalv_init(int* argc, char*** argv, JalvOptions* opts)
return print_usage((*argv)[0], true);
} else if ((*argv)[a][1] == 's') {
opts->show_ui = true;
+ } else if ((*argv)[a][1] == 'p') {
+ opts->print_controls = true;
} else if ((*argv)[a][1] == 'u') {
if (++a == *argc) {
fprintf(stderr, "Missing argument for -u\n");
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c
index 76d9106..8e9259f 100644
--- a/src/jalv_gtk.c
+++ b/src/jalv_gtk.c
@@ -98,7 +98,9 @@ jalv_init(int* argc, char*** argv, JalvOptions* opts)
{ "update-frequency", 'r', 0, G_OPTION_ARG_DOUBLE, &opts->update_rate,
"UI update frequency", NULL},
{ "control", 'c', 0, G_OPTION_ARG_STRING_ARRAY, &opts->controls,
- "UI update frequency", NULL},
+ "Set control value (e.g. \"vol=1.4\")", NULL},
+ { "print-controls", 'p', 0, G_OPTION_ARG_NONE, &opts->print_controls,
+ "Print control output changes to stdout", NULL},
{ 0, 0, 0, 0, 0, 0, 0 } };
GError* error = NULL;
const int err = gtk_init_with_args(
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 47a210d..64b490a 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -85,16 +85,17 @@ typedef struct {
} ControlChange;
typedef struct {
- char* uuid; ///< Session UUID
- char* load; ///< Path for state to load
- char** controls; ///< Control values
- uint32_t buffer_size; ///< Plugin<=>UI communication buffer size
- double update_rate; ///< UI update rate in Hz
- int dump; ///< Dump communication iff true
- int generic_ui; ///< Use generic UI iff true
- int show_hidden; ///< Show controls for notOnGUI ports
- int no_menu; ///< Hide menu iff true
- int show_ui; ///< Show non-embedded UI
+ char* uuid; ///< Session UUID
+ char* load; ///< Path for state to load
+ char** controls; ///< Control values
+ uint32_t buffer_size; ///< Plugin <= >UI communication buffer size
+ double update_rate; ///< UI update rate in Hz
+ int dump; ///< Dump communication iff true
+ int generic_ui; ///< Use generic UI iff true
+ int show_hidden; ///< Show controls for notOnGUI ports
+ int no_menu; ///< Hide menu iff true
+ int show_ui; ///< Show non-embedded UI
+ int print_controls; ///< Print control changes to stdout
} JalvOptions;
typedef struct {