186 |
SRC_DATA resample_data; |
SRC_DATA resample_data; |
187 |
float *infloat, *outfloat; |
float *infloat, *outfloat; |
188 |
int innum, outnum; |
int innum, outnum; |
189 |
|
int err; |
190 |
#else |
#else |
191 |
int offset; |
int offset; |
192 |
#endif |
#endif |
241 |
} |
} |
242 |
|
|
243 |
innum = size / samplewidth; |
innum = size / samplewidth; |
244 |
outnum = innum * (resample_to_srate / format->nSamplesPerSec); |
outnum = ((float)innum * ((float)resample_to_srate / (float)format->nSamplesPerSec)) + 1; |
245 |
|
|
246 |
infloat = xmalloc(sizeof(float) * innum); |
infloat = xmalloc(sizeof(float) * innum); |
247 |
outfloat = xmalloc(sizeof(float) * outnum); |
outfloat = xmalloc(sizeof(float) * outnum); |
256 |
resample_data.src_ratio = (double) resample_to_srate / (double) format->nSamplesPerSec; |
resample_data.src_ratio = (double) resample_to_srate / (double) format->nSamplesPerSec; |
257 |
resample_data.end_of_input = 0; |
resample_data.end_of_input = 0; |
258 |
|
|
259 |
src_process(src_converter, &resample_data); |
if ((err = src_process(src_converter, &resample_data)) != 0) |
260 |
|
error("src_process: %s", src_strerror(err)); |
261 |
|
|
262 |
xfree(infloat); |
xfree(infloat); |
263 |
|
|
264 |
outsize = outnum * samplewidth; |
outsize = resample_data.output_frames_gen * resample_to_channels * samplewidth; |
265 |
*out = xmalloc(outsize); |
*out = xmalloc(outsize); |
266 |
src_float_to_short_array(outfloat, (short *) *out, outnum); |
src_float_to_short_array(outfloat, (short *) *out, resample_data.output_frames_gen * resample_to_channels); |
267 |
xfree(outfloat); |
xfree(outfloat); |
268 |
|
|
269 |
#else |
#else |