aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_utils.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-09 15:18:09 +0200
committerMax Kellermann <max@duempel.org>2008-10-09 15:18:09 +0200
commit40f59cacda872a494cf033a6f74da7feae282367 (patch)
tree0c9a458be5547c9de4db13dd9d2faf31d5132824 /src/pcm_utils.c
parentecc3c39e2f557f521135af8a52c8d6216a4a02bd (diff)
downloadmpd-40f59cacda872a494cf033a6f74da7feae282367.tar.gz
mpd-40f59cacda872a494cf033a6f74da7feae282367.tar.xz
mpd-40f59cacda872a494cf033a6f74da7feae282367.zip
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.
Diffstat (limited to '')
-rw-r--r--src/pcm_utils.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/pcm_utils.c b/src/pcm_utils.c
index 17449f7d2..c3526f9d1 100644
--- a/src/pcm_utils.c
+++ b/src/pcm_utils.c
@@ -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;