aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-09-22 22:12:55 +0200
committerDavid Robillard <d@drobilla.net>2018-09-22 22:14:37 +0200
commiteb95b6f0e129dd185a833be2f55aaa4e7f37f703 (patch)
treef841cdd8d999d8055c448443c26548d516658067 /src
parentc5b75a160cdae33c08d32ea82486ae599a594712 (diff)
downloadjalv-eb95b6f0e129dd185a833be2f55aaa4e7f37f703.tar.gz
jalv-eb95b6f0e129dd185a833be2f55aaa4e7f37f703.tar.bz2
jalv-eb95b6f0e129dd185a833be2f55aaa4e7f37f703.zip
Simplify control display in console interface
Diffstat (limited to 'src')
-rw-r--r--src/control.c5
-rw-r--r--src/jalv.c19
-rw-r--r--src/jalv_console.c2
-rw-r--r--src/jalv_internal.h1
4 files changed, 9 insertions, 18 deletions
diff --git a/src/control.c b/src/control.c
index 9fe5924..2326280 100644
--- a/src/control.c
+++ b/src/control.c
@@ -136,11 +136,6 @@ new_property_control(Jalv* jalv, const LilvNode* property)
id->is_integer = (id->value_type == jalv->forge.Int ||
id->value_type == jalv->forge.Long);
- const size_t sym_len = strlen(lilv_node_as_string(id->symbol));
- if (sym_len > jalv->longest_sym) {
- jalv->longest_sym = sym_len;
- }
-
if (!id->value_type) {
fprintf(stderr, "Unknown value type for property <%s>\n",
lilv_node_as_string(property));
diff --git a/src/jalv.c b/src/jalv.c
index 062d126..63167bc 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -215,12 +215,16 @@ create_port(Jalv* jalv,
die("Mandatory port has unknown type (neither input nor output)");
}
+ const bool hidden = !jalv->opts.show_hidden &&
+ lilv_port_has_property(jalv->plugin,
+ port->lilv_port,
+ jalv->nodes.pprops_notOnGUI);
+
/* Set control values */
if (lilv_port_is_a(jalv->plugin, port->lilv_port, jalv->nodes.lv2_ControlPort)) {
port->type = TYPE_CONTROL;
port->control = isnan(default_value) ? 0.0f : default_value;
- if (jalv->opts.show_hidden ||
- !lilv_port_has_property(jalv->plugin, port->lilv_port, jalv->nodes.pprops_notOnGUI)) {
+ if (!hidden) {
add_control(&jalv->controls, new_port_control(jalv, port->index));
}
} else if (lilv_port_is_a(jalv->plugin, port->lilv_port,
@@ -251,13 +255,6 @@ create_port(Jalv* jalv,
jalv->opts.buffer_size, port->buf_size * N_BUFFER_CYCLES);
}
lilv_node_free(min_size);
-
- /* Update longest symbol for aligned console printing */
- const LilvNode* sym = lilv_port_get_symbol(jalv->plugin, port->lilv_port);
- const size_t len = strlen(lilv_node_as_string(sym));
- if (len > jalv->longest_sym) {
- jalv->longest_sym = len;
- }
}
/**
@@ -352,7 +349,7 @@ 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);
+ printf("%s = %f\n", lilv_node_as_string(sym), value);
}
void
@@ -753,7 +750,7 @@ jalv_apply_control_arg(Jalv* jalv, const char* s)
}
jalv_set_control(control, sizeof(float), jalv->urids.atom_Float, &val);
- printf("%-*s = %f\n", jalv->longest_sym, sym, val);
+ printf("%s = %f\n", sym, val);
return true;
}
diff --git a/src/jalv_console.c b/src/jalv_console.c
index f78641c..71b476d 100644
--- a/src/jalv_console.c
+++ b/src/jalv_console.c
@@ -153,7 +153,7 @@ jalv_process_command(Jalv* jalv, const char* cmd)
}
if (port) {
port->control = value;
- printf("%-*s = %f\n", jalv->longest_sym, sym, value);
+ printf("%s = %f\n", sym, value);
} else {
fprintf(stderr, "error: no port `%s'\n", sym);
}
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index bdf5e79..c8b45ab 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -308,7 +308,6 @@ struct Jalv {
size_t midi_buf_size; ///< Size of MIDI port buffers
uint32_t control_in; ///< Index of control input port
uint32_t num_ports; ///< Size of the two following arrays:
- uint32_t longest_sym; ///< Longest port symbol
uint32_t plugin_latency; ///< Latency reported by plugin (if any)
float ui_update_hz; ///< Frequency of UI updates
uint32_t sample_rate; ///< Sample rate