aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <mk@cm4all.com>2008-10-24 08:41:34 +0200
committerMax Kellermann <mk@cm4all.com>2008-10-24 08:41:34 +0200
commit8b4829c2fe10cd4019ba8c352cf1d4d177e8a064 (patch)
treec5f9f558ccf0fe35f648e1a4f873f1fcfa30669a /src
parent5fefa954a32cb8bae15df12d4ffdfe23c86c3802 (diff)
downloadmpd-8b4829c2fe10cd4019ba8c352cf1d4d177e8a064.tar.gz
mpd-8b4829c2fe10cd4019ba8c352cf1d4d177e8a064.tar.xz
mpd-8b4829c2fe10cd4019ba8c352cf1d4d177e8a064.zip
pcm_resample: support for libsamplerate < 0.1.3
libsamplerate 0.1.2 didn't have the 32 bit <-> float conversion routines. Emulate them in case they aren't supported.
Diffstat (limited to 'src')
-rw-r--r--src/pcm_resample_libsamplerate.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pcm_resample_libsamplerate.c b/src/pcm_resample_libsamplerate.c
index 43a2a2f26..ced4a90b1 100644
--- a/src/pcm_resample_libsamplerate.c
+++ b/src/pcm_resample_libsamplerate.c
@@ -154,6 +154,26 @@ pcm_resample_16(uint8_t channels,
return data->output_frames_gen * sizeof(*dest_buffer) * channels;
}
+#ifdef HAVE_LIBSAMPLERATE_NOINT
+
+/* libsamplerate introduced these functions in v0.1.3 */
+
+static void
+src_int_to_float_array(const int *in, float *out, int len)
+{
+ while (len-- > 0)
+ *out++ = *in++ / (float)(1 << (24 - 1));
+}
+
+static void
+src_float_to_int_array (const float *in, int *out, int len)
+{
+ while (len-- > 0)
+ *out++ = *in++ * (float)(1 << (24 - 1));
+}
+
+#endif
+
size_t
pcm_resample_24(uint8_t channels,
unsigned src_rate,