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.
This commit is contained in:
@@ -390,6 +390,11 @@ if test x$enable_lsr = xyes; then
|
|||||||
[enable_lsr=no;AC_MSG_WARN([libsamplerate not found -- disabling])])
|
[enable_lsr=no;AC_MSG_WARN([libsamplerate not found -- disabling])])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x$enable_lsr = xyes; then
|
||||||
|
PKG_CHECK_MODULES([SAMPLERATE_013], [samplerate >= 0.1.3],,
|
||||||
|
[AC_DEFINE([HAVE_LIBSAMPLERATE_NOINT], 1, [libsamplerate doesn't provide src_int_to_float_array() (<0.1.3)])])
|
||||||
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
|
AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
|
||||||
|
|
||||||
if test x$enable_fifo = xyes; then
|
if test x$enable_fifo = xyes; then
|
||||||
|
@@ -154,6 +154,26 @@ pcm_resample_16(uint8_t channels,
|
|||||||
return data->output_frames_gen * sizeof(*dest_buffer) * 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
|
size_t
|
||||||
pcm_resample_24(uint8_t channels,
|
pcm_resample_24(uint8_t channels,
|
||||||
unsigned src_rate,
|
unsigned src_rate,
|
||||||
|
Reference in New Issue
Block a user