mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
filter-graph: add latency option to the convolver
Sometimes you want to use the convolver as a delay without adding latency so add a latency option to tweak the automatic latency reporting. Use this in the upmix rear delay filters.
This commit is contained in:
parent
8ee51cd88f
commit
8bcf0460d1
3 changed files with 17 additions and 3 deletions
|
|
@ -688,7 +688,7 @@ struct convolver_impl {
|
||||||
struct spa_fga_dsp *dsp;
|
struct spa_fga_dsp *dsp;
|
||||||
unsigned long rate;
|
unsigned long rate;
|
||||||
float *port[3];
|
float *port[3];
|
||||||
unsigned long latency;
|
float latency;
|
||||||
|
|
||||||
struct convolver *conv;
|
struct convolver *conv;
|
||||||
};
|
};
|
||||||
|
|
@ -927,7 +927,7 @@ static void * convolver_instantiate(const struct spa_fga_plugin *plugin, const s
|
||||||
char *filenames[MAX_RATES] = { 0 };
|
char *filenames[MAX_RATES] = { 0 };
|
||||||
int blocksize = 0, tailsize = 0;
|
int blocksize = 0, tailsize = 0;
|
||||||
int resample_quality = RESAMPLE_DEFAULT_QUALITY;
|
int resample_quality = RESAMPLE_DEFAULT_QUALITY;
|
||||||
float gain = 1.0f, delay = 0.0f;
|
float gain = 1.0f, delay = 0.0f, latency = -1.0f;
|
||||||
unsigned long rate;
|
unsigned long rate;
|
||||||
|
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
|
@ -1009,6 +1009,12 @@ static void * convolver_instantiate(const struct spa_fga_plugin *plugin, const s
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (spa_streq(key, "latency")) {
|
||||||
|
if (spa_json_parse_float(val, len, &latency) <= 0) {
|
||||||
|
spa_log_error(pl->log, "convolver:latency requires a number");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
spa_log_warn(pl->log, "convolver: ignoring config key: '%s'", key);
|
spa_log_warn(pl->log, "convolver: ignoring config key: '%s'", key);
|
||||||
}
|
}
|
||||||
|
|
@ -1069,7 +1075,10 @@ static void * convolver_instantiate(const struct spa_fga_plugin *plugin, const s
|
||||||
if (impl->conv == NULL)
|
if (impl->conv == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
impl->latency = n_samples;
|
if (latency < 0.0f)
|
||||||
|
impl->latency = n_samples;
|
||||||
|
else
|
||||||
|
impl->latency = latency * impl->rate;
|
||||||
|
|
||||||
free(samples);
|
free(samples);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ context.modules = [
|
||||||
delay = 0.012
|
delay = 0.012
|
||||||
filename = "/hilbert"
|
filename = "/hilbert"
|
||||||
length = 33
|
length = 33
|
||||||
|
latency = 0.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -101,6 +102,7 @@ context.modules = [
|
||||||
delay = 0.012
|
delay = 0.012
|
||||||
filename = "/hilbert"
|
filename = "/hilbert"
|
||||||
length = 33
|
length = 33
|
||||||
|
latency = 0.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,7 @@ extern struct spa_handle_factory spa_filter_graph_factory;
|
||||||
* length = ...
|
* length = ...
|
||||||
* channel = ...
|
* channel = ...
|
||||||
* resample_quality = ...
|
* resample_quality = ...
|
||||||
|
* latency = ...
|
||||||
* }
|
* }
|
||||||
* ...
|
* ...
|
||||||
* }
|
* }
|
||||||
|
|
@ -361,6 +362,8 @@ extern struct spa_handle_factory spa_filter_graph_factory;
|
||||||
* - `channel` The channel to use from the file as the IR.
|
* - `channel` The channel to use from the file as the IR.
|
||||||
* - `resample_quality` The resample quality in case the IR does not match the graph
|
* - `resample_quality` The resample quality in case the IR does not match the graph
|
||||||
* samplerate.
|
* samplerate.
|
||||||
|
* - `latency` The extra latency in seconds to report. When left unspecified (or < 0.0)
|
||||||
|
* the convolver latency will be the length of the IR.
|
||||||
*
|
*
|
||||||
* ### Delay
|
* ### Delay
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue