mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-08 08:21:04 -04:00
spa-resample: enable clipping in sndfile
We can actually use a command to enable clipping in sndfile instead of doing it ourselves.
This commit is contained in:
parent
8e6945c496
commit
7aa8d8d628
1 changed files with 4 additions and 3 deletions
|
|
@ -187,6 +187,8 @@ static int open_files(struct data *d)
|
||||||
d->oname, sf_strerror(NULL));
|
d->oname, sf_strerror(NULL));
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
sf_command(d->ofile, SFC_SET_CLIPPING, NULL, 1);
|
||||||
|
|
||||||
if (d->verbose) {
|
if (d->verbose) {
|
||||||
fprintf(stdout, "input '%s': channels:%d rate:%d format:%s\n",
|
fprintf(stdout, "input '%s': channels:%d rate:%d format:%s\n",
|
||||||
d->iname, d->iinfo.channels, d->iinfo.samplerate,
|
d->iname, d->iinfo.channels, d->iinfo.samplerate,
|
||||||
|
|
@ -296,9 +298,8 @@ static int do_conversion(struct data *d)
|
||||||
|
|
||||||
if (pout_len > 0) {
|
if (pout_len > 0) {
|
||||||
for (k = 0, i = 0; i < pout_len; i++) {
|
for (k = 0, i = 0; i < pout_len; i++) {
|
||||||
for (j = 0; j < channels; j++) {
|
for (j = 0; j < channels; j++)
|
||||||
obuf[k++] = SPA_CLAMP(out[MAX_SAMPLES * j + i], -1.0f, 1.0f);
|
obuf[k++] = out[MAX_SAMPLES * j + i];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pout_len = sf_writef_float(d->ofile, obuf, pout_len);
|
pout_len = sf_writef_float(d->ofile, obuf, pout_len);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue