]> git.alsa-project.org Git - alsa-lib.git/commit
pcm: route: Use get32 for multi-source route calculation
authorTakashi Iwai <tiwai@suse.de>
Tue, 22 Jul 2014 09:55:40 +0000 (11:55 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 22 Jul 2014 12:06:12 +0000 (14:06 +0200)
commitfd84adc63e307572d05274be44c782a787087cda
treeb9492c3fd5737f94c10db519bd1c61365afaea29
parent55c53625212702debf55c719ec62f6c81c780927
pcm: route: Use get32 for multi-source route calculation

The PCM route plugin can assign the destination value from average of
multiple sources with attenuation.  This requires the read of each
channel value, sums and writes the resultant value in the requested
format.

Currently, get_labels is used for reading source values while
put32_labels is used for writing the dest value.  This is, however,
a buggy implementation; get_labels gives the value as is only with
endianness and signedness conversions, but put32_labels assumes that
the value is normalized to 32bit int and it shifts down to the dest
format.  In addition, the current code lacks get_labels entries for
the 24bit formats, as Shengjiu Wang spotted out.

For fixing these bugs, this patch replaces the read with
get32_labels and use always 64bit int for sum.  This simplifies the
code a lot and drops many lines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_route.c
src/pcm/plugin_ops.h