mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
filter-chain: add dirac pulse
This commit is contained in:
parent
a54fa5f26d
commit
75f15accd5
1 changed files with 21 additions and 0 deletions
|
|
@ -551,6 +551,24 @@ static float *create_hilbert(const char *filename, float gain, int delay, int of
|
|||
return samples;
|
||||
}
|
||||
|
||||
static float *create_dirac(const char *filename, float gain, int delay, int offset,
|
||||
int length, int *n_samples)
|
||||
{
|
||||
float *samples;
|
||||
int n;
|
||||
|
||||
n = delay + 1;
|
||||
|
||||
samples = calloc(n, sizeof(float));
|
||||
if (samples == NULL)
|
||||
return NULL;
|
||||
|
||||
samples[delay] = gain;
|
||||
|
||||
*n_samples = n;
|
||||
return samples;
|
||||
}
|
||||
|
||||
static void * convolver_instantiate(const struct fc_descriptor * Descriptor,
|
||||
unsigned long SampleRate, int index, const char *config)
|
||||
{
|
||||
|
|
@ -619,6 +637,9 @@ static void * convolver_instantiate(const struct fc_descriptor * Descriptor,
|
|||
if (spa_streq(filename, "/hilbert")) {
|
||||
samples = create_hilbert(filename, gain, delay, offset,
|
||||
length, &n_samples);
|
||||
} else if (spa_streq(filename, "/dirac")) {
|
||||
samples = create_dirac(filename, gain, delay, offset,
|
||||
length, &n_samples);
|
||||
} else {
|
||||
samples = read_samples(filename, gain, delay, offset,
|
||||
length, channel, &n_samples);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue