mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
resampler: Fix volume on downmix to mono
Patch credit: kwanghui When downmixing to mono, we should average the signal instead of summing it to avoid clipping. BugLink: http://pulseaudio.org/ticket/934 BugLink: https://bugs.launchpad.net/bugs/416190 Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
9887cd0a28
commit
ff4af902cf
1 changed files with 9 additions and 2 deletions
|
|
@ -716,7 +716,7 @@ static void calc_map_table(pa_resampler *r) {
|
||||||
*
|
*
|
||||||
* 2) Mono Handling:
|
* 2) Mono Handling:
|
||||||
* S:Mono: Copy into all D:channels
|
* S:Mono: Copy into all D:channels
|
||||||
* D:Mono: Copy in all S:channels
|
* D:Mono: Avg all S:channels
|
||||||
*
|
*
|
||||||
* 3) Mix D:Left, D:Right:
|
* 3) Mix D:Left, D:Right:
|
||||||
* D:Left: If not connected, avg all S:Left
|
* D:Left: If not connected, avg all S:Left
|
||||||
|
|
@ -759,9 +759,16 @@ static void calc_map_table(pa_resampler *r) {
|
||||||
* best to pass it to L+R.
|
* best to pass it to L+R.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (a == b || a == PA_CHANNEL_POSITION_MONO || b == PA_CHANNEL_POSITION_MONO) {
|
if (a == b || a == PA_CHANNEL_POSITION_MONO) {
|
||||||
m->map_table_f[oc][ic] = 1.0;
|
m->map_table_f[oc][ic] = 1.0;
|
||||||
|
|
||||||
|
oc_connected = TRUE;
|
||||||
|
ic_connected[ic] = TRUE;
|
||||||
|
}
|
||||||
|
else if (b == PA_CHANNEL_POSITION_MONO) {
|
||||||
|
if (n_ic)
|
||||||
|
m->map_table_f[oc][ic] = 1.0f / (float) n_ic;
|
||||||
|
|
||||||
oc_connected = TRUE;
|
oc_connected = TRUE;
|
||||||
ic_connected[ic] = TRUE;
|
ic_connected[ic] = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue