From 181e9c6d5d11cb1e5d36a2777eeb233ad8ed00e5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 9 Oct 2008 18:15:23 +0200 Subject: big pile of updates to match more what happened with libcanberra --- src/resample.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src/resample.c') diff --git a/src/resample.c b/src/resample.c index 7babe05..991c195 100644 --- a/src/resample.c +++ b/src/resample.c @@ -1,3 +1,23 @@ +/*** + This file is part of libsydney. + + Copyright 2007-2008 Lennart Poettering + + libsydney is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 2.1 of the + License, or (at your option) any later version. + + libsydney is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with libsydney. If not, see + . +***/ + #ifdef HAVE_CONFIG_H #include #endif @@ -7,10 +27,10 @@ static void resample_s16(SpeexResamplerState *speex, unsigned channel, void *dst, size_t dstr, const void *src, size_t sstr, size_t in_bytes, size_t *out_bytes) { - spx_uint32_t in_samples = in_bytes/sizeof(int16_t), out_samples = *out_bytes/sizeof(int16_t); + spx_uint32_t in_samples = (uint32_t) (in_bytes/sizeof(int16_t)), out_samples = (uint32_t) (*out_bytes/sizeof(int16_t)); - speex_resampler_set_input_stride(speex, sstr/sizeof(int16_t)); - speex_resampler_set_input_stride(speex, dstr/sizeof(int16_t)); + speex_resampler_set_input_stride(speex, (uint32_t) (sstr/sizeof(int16_t))); + speex_resampler_set_input_stride(speex, (uint32_t) (dstr/sizeof(int16_t))); speex_resampler_process_int(speex, channel, src, &in_samples, dst, &out_samples); @@ -21,10 +41,10 @@ static void resample_s16(SpeexResamplerState *speex, unsigned channel, void *dst static void resample_f32(SpeexResamplerState *speex, unsigned channel, void *dst, size_t dstr, const void *src, size_t sstr, size_t in_bytes, size_t *out_bytes) { - spx_uint32_t in_samples = in_bytes/sizeof(float), out_samples = *out_bytes/sizeof(float); + spx_uint32_t in_samples = (uint32_t) (in_bytes/sizeof(float)), out_samples = (uint32_t) (*out_bytes/sizeof(float)); - speex_resampler_set_input_stride(speex, sstr/sizeof(float)); - speex_resampler_set_input_stride(speex, dstr/sizeof(float)); + speex_resampler_set_input_stride(speex, (uint32_t) (sstr/sizeof(float))); + speex_resampler_set_input_stride(speex, (uint32_t) (dstr/sizeof(float))); speex_resampler_process_float(speex, channel, src, &in_samples, dst, &out_samples); -- cgit