aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-07-13 21:24:10 +0000
committerDavid Robillard <d@drobilla.net>2014-07-13 21:24:10 +0000
commit712f209ee60da9ed61f58353b05b6b025d9321c0 (patch)
tree719377180b6f5dd1a89a6363f0a10d747d74c53c
parentea74eb527d8cb7af2545f960f34e7d3517bd37fa (diff)
downloadjalv-712f209ee60da9ed61f58353b05b6b025d9321c0.tar.gz
jalv-712f209ee60da9ed61f58353b05b6b025d9321c0.tar.bz2
jalv-712f209ee60da9ed61f58353b05b6b025d9321c0.zip
Add option to print control output changes to stdout.
Update man pages and console jalv help output for new options. git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5410 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--NEWS4
-rw-r--r--doc/jalv.112
-rw-r--r--doc/jalv.gtk.114
-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
7 files changed, 58 insertions, 16 deletions
diff --git a/NEWS b/NEWS
index 2034552..5f02b9e 100644
--- a/NEWS
+++ b/NEWS
@@ -6,8 +6,10 @@ jalv (1.4.5) unstable;
* Set port pretty names via new Jack metadata API
* Add support for data-access extension (based on patch by Filipe Coelho)
* Support new UI show/hide interface in console version
+ * Add option to print control output changes to stdout
+ * Update man pages and console jalv help output for new options
- -- David Robillard <d@drobilla.net> Sat, 26 Apr 2014 20:33:45 -0400
+ -- David Robillard <d@drobilla.net> Sun, 13 Jul 2014 17:21:51 -0400
jalv (1.4.4) stable;
diff --git a/doc/jalv.1 b/doc/jalv.1
index 9cb4982..a196c01 100644
--- a/doc/jalv.1
+++ b/doc/jalv.1
@@ -13,6 +13,14 @@
Print the command line options.
.TP
+\fB\-c\fR
+Print control output changes to stdout.
+
+.TP
+\fB\-c SYM=VAL\fR
+Set control value (e.g. "vol=1.4").
+
+.TP
\fB\-u UUID\fR, \fB\-\-uuid UUID\fR
UUID for Jack session restoration.
@@ -24,6 +32,10 @@ Load state from state directory.
\fB\-d\fR, \fB\-\-dump\fR
Dump plugin <=> UI communication.
+.TP
+\fB\-b SIZE\fR
+Buffer size for plugin <=> UI communication.
+
.SH SEE ALSO
.BR jalv.gtk(1),
.BR jalv.gtkmm(1),
diff --git a/doc/jalv.gtk.1 b/doc/jalv.gtk.1
index 5c8c4b5..c3e8f2b 100644
--- a/doc/jalv.gtk.1
+++ b/doc/jalv.gtk.1
@@ -13,6 +13,14 @@
Print the command line options.
.TP
+\fB\-c\fR
+Print control output changes to stdout.
+
+.TP
+\fB\-c SYM=VAL\fR
+Set control value (e.g. "vol=1.4").
+
+.TP
\fB\-u UUID\fR, \fB\-\-uuid UUID\fR
UUID for Jack session restoration.
@@ -25,8 +33,12 @@ Load state from state directory.
Dump plugin <=> UI communication.
.TP
+\fB\-b SIZE\fR
+Buffer size for plugin <=> UI communication.
+
+.TP
\fB\-g\fR, \fB\-\-generic\-ui\fR
-Use Jalv generic UI and not the plugin UI
+Use Jalv generic UI and not the plugin UI.
.SH SEE ALSO
.BR jalv(1),
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 {