aboutsummaryrefslogtreecommitdiff
path: root/src/pcm_format.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-08 23:47:32 +0200
committerMax Kellermann <max@duempel.org>2011-09-08 23:47:32 +0200
commit5cf4ce9318acfcd3698b10e173315ad681d39560 (patch)
tree8f1dc34e03aabdeee79fb65dd6f69ded806ccc0d /src/pcm_format.c
parent5469941f2b12004dc6214af2732eb57ceab7aaf2 (diff)
pcm_format: fix 32-to-24 bit conversion (the "silence" bug)
D'oh, we were reading 16 bit integers instead of 32 bit integers! That caused silence when trying to play a 32 bit input file on a 24 bit sound card (e.g. USB sound chips with 24 bit packed samples).
Diffstat (limited to 'src/pcm_format.c')
-rw-r--r--src/pcm_format.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pcm_format.c b/src/pcm_format.c
index 3fd76a98..1e4b8d70 100644
--- a/src/pcm_format.c
+++ b/src/pcm_format.c
@@ -143,7 +143,7 @@ pcm_convert_16_to_24(int32_t *out, const int16_t *in,
}
static void
-pcm_convert_32_to_24(int32_t *out, const int16_t *in,
+pcm_convert_32_to_24(int32_t *out, const int32_t *in,
unsigned num_samples)
{
while (num_samples > 0) {
@@ -197,7 +197,7 @@ pcm_convert_to_24(struct pcm_buffer *buffer,
*dest_size_r = num_samples * sizeof(*dest);
dest = pcm_buffer_get(buffer, *dest_size_r);
- pcm_convert_32_to_24(dest, (const int16_t *)src,
+ pcm_convert_32_to_24(dest, (const int32_t *)src,
num_samples);
return dest;
}