mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
pcm: dmix: fix wrong scaling in 32bits pcm mixing
Generic mixing function for 32bits pcm has used 8bits right shift for pre-scaling. But this is generating wrong result if pcm data is negative value because return value type of bswap_32() is unsigned int. This patch adds type cast bswap_32() result to signed int. Fixes: https://github.com/alsa-project/alsa-lib/pull/222 Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
a513e65e19
commit
b62fc061e4
1 changed files with 2 additions and 2 deletions
|
|
@ -330,7 +330,7 @@ static void generic_mix_areas_32_swap(unsigned int size,
|
||||||
register signed int sample;
|
register signed int sample;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
sample = bswap_32(*src) >> 8;
|
sample = (signed int) bswap_32(*src) >> 8;
|
||||||
if (! *dst) {
|
if (! *dst) {
|
||||||
*sum = sample;
|
*sum = sample;
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
|
|
@ -364,7 +364,7 @@ static void generic_remix_areas_32_swap(unsigned int size,
|
||||||
register signed int sample;
|
register signed int sample;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
sample = bswap_32(*src) >> 8;
|
sample = (signed int) bswap_32(*src) >> 8;
|
||||||
if (! *dst) {
|
if (! *dst) {
|
||||||
*sum = -sample;
|
*sum = -sample;
|
||||||
*dst = bswap_32(-sample);
|
*dst = bswap_32(-sample);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue