mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-27 07:58:02 -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. Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
This commit is contained in:
parent
76659453ef
commit
3b4335522f
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;
|
||||
|
||||
for (;;) {
|
||||
sample = bswap_32(*src) >> 8;
|
||||
sample = (signed int) bswap_32(*src) >> 8;
|
||||
if (! *dst) {
|
||||
*sum = sample;
|
||||
*dst = *src;
|
||||
|
|
@ -364,7 +364,7 @@ static void generic_remix_areas_32_swap(unsigned int size,
|
|||
register signed int sample;
|
||||
|
||||
for (;;) {
|
||||
sample = bswap_32(*src) >> 8;
|
||||
sample = (signed int) bswap_32(*src) >> 8;
|
||||
if (! *dst) {
|
||||
*sum = -sample;
|
||||
*dst = bswap_32(-sample);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue