pcm: fixed software volume, broken by unsigned integer
"volume" was passed as an unsigned integer, which is correct. It's just that when it was multiplied with the sample value, the whole operation was changed to unsigned, breaking the algorithm (and Qball's ears). Internally change "volume" to signed.
This commit is contained in:
parent
ecc3c39e2f
commit
40f59cacda
@ -47,8 +47,7 @@ pcm_range(int32_t sample, unsigned bits)
|
||||
}
|
||||
|
||||
static void
|
||||
pcm_volume_change_8(int8_t *buffer, unsigned num_samples,
|
||||
unsigned volume)
|
||||
pcm_volume_change_8(int8_t *buffer, unsigned num_samples, int volume)
|
||||
{
|
||||
while (num_samples > 0) {
|
||||
int32_t sample = *buffer;
|
||||
@ -61,8 +60,7 @@ pcm_volume_change_8(int8_t *buffer, unsigned num_samples,
|
||||
}
|
||||
|
||||
static void
|
||||
pcm_volume_change_16(int16_t *buffer, unsigned num_samples,
|
||||
unsigned volume)
|
||||
pcm_volume_change_16(int16_t *buffer, unsigned num_samples, int volume)
|
||||
{
|
||||
while (num_samples > 0) {
|
||||
int32_t sample = *buffer;
|
||||
@ -75,8 +73,7 @@ pcm_volume_change_16(int16_t *buffer, unsigned num_samples,
|
||||
}
|
||||
|
||||
static void
|
||||
pcm_volume_change_24(int32_t *buffer, unsigned num_samples,
|
||||
unsigned volume)
|
||||
pcm_volume_change_24(int32_t *buffer, unsigned num_samples, int volume)
|
||||
{
|
||||
while (num_samples > 0) {
|
||||
int64_t sample = *buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user