diff --git a/spa/plugins/filter-graph/audio-plugin.h b/spa/plugins/filter-graph/audio-plugin.h index e05d7a80a..d8925ea33 100644 --- a/spa/plugins/filter-graph/audio-plugin.h +++ b/spa/plugins/filter-graph/audio-plugin.h @@ -33,9 +33,10 @@ struct spa_fga_port { #define SPA_FGA_PORT_AUDIO (1ULL << 3) uint64_t flags; -#define SPA_FGA_HINT_BOOLEAN (1ULL << 2) -#define SPA_FGA_HINT_SAMPLE_RATE (1ULL << 3) -#define SPA_FGA_HINT_INTEGER (1ULL << 5) +#define SPA_FGA_HINT_BOOLEAN (1ULL << 0) +#define SPA_FGA_HINT_SAMPLE_RATE (1ULL << 1) +#define SPA_FGA_HINT_INTEGER (1ULL << 2) +#define SPA_FGA_HINT_LATENCY (1ULL << 3) uint64_t hint; float def; float min; diff --git a/spa/plugins/filter-graph/ladspa_plugin.c b/spa/plugins/filter-graph/ladspa_plugin.c index 45026c8e7..bad13e89f 100644 --- a/spa/plugins/filter-graph/ladspa_plugin.c +++ b/spa/plugins/filter-graph/ladspa_plugin.c @@ -116,7 +116,15 @@ static void ladspa_port_update_ranges(struct descriptor *dd, struct spa_fga_port lower = d->PortRangeHints[p].LowerBound; upper = d->PortRangeHints[p].UpperBound; - port->hint = hint; + port->hint = 0; + if (hint & LADSPA_HINT_TOGGLED) + port->hint |= SPA_FGA_HINT_BOOLEAN; + if (hint & LADSPA_HINT_SAMPLE_RATE) + port->hint |= SPA_FGA_HINT_SAMPLE_RATE; + if (hint & LADSPA_HINT_INTEGER) + port->hint |= SPA_FGA_HINT_INTEGER; + if (spa_streq(port->name, "latency")) + port->hint |= SPA_FGA_HINT_LATENCY; port->def = get_default(port, hint, lower, upper); port->min = lower; port->max = upper; diff --git a/spa/plugins/filter-graph/lv2_plugin.c b/spa/plugins/filter-graph/lv2_plugin.c index a2af22d6a..51ca4bc6a 100644 --- a/spa/plugins/filter-graph/lv2_plugin.c +++ b/spa/plugins/filter-graph/lv2_plugin.c @@ -399,6 +399,8 @@ static const struct spa_fga_descriptor *lv2_plugin_make_desc(void *plugin, const struct descriptor *desc; uint32_t i; float *mins, *maxes, *controls; + bool latent; + uint32_t latency_index; desc = calloc(1, sizeof(*desc)); if (desc == NULL) @@ -424,6 +426,9 @@ static const struct spa_fga_descriptor *lv2_plugin_make_desc(void *plugin, const maxes = alloca(desc->desc.n_ports * sizeof(float)); controls = alloca(desc->desc.n_ports * sizeof(float)); + latent = lilv_plugin_has_latency(p->p); + latency_index = latent ? lilv_plugin_get_latency_port_index(p->p) : 0; + lilv_plugin_get_port_ranges_float(p->p, mins, maxes, controls); for (i = 0; i < desc->desc.n_ports; i++) { @@ -445,6 +450,9 @@ static const struct spa_fga_descriptor *lv2_plugin_make_desc(void *plugin, const fp->flags |= SPA_FGA_PORT_AUDIO; fp->hint = 0; + if (latent && latency_index == i) + fp->flags |= SPA_FGA_HINT_LATENCY; + fp->min = mins[i]; fp->max = maxes[i]; fp->def = controls[i];