278 |
for (i = 0; i < outsize / (resample_to_channels * samplewidth); i++) |
for (i = 0; i < outsize / (resample_to_channels * samplewidth); i++) |
279 |
{ |
{ |
280 |
int source = ((i * 1000) + ratio1k - 1000) / (ratio1k + 1); |
int source = ((i * 1000) + ratio1k - 1000) / (ratio1k + 1); |
281 |
|
int j; |
282 |
|
|
283 |
if (source * resample_to_channels + samplewidth > size) |
if (source * resample_to_channels + samplewidth > size) |
284 |
break; |
break; |
285 |
|
|
286 |
if (resample_to_channels == 2) |
for (j = 0; j < resample_to_channels; j++) |
287 |
{ |
{ |
288 |
memcpy(*out + (i * resample_to_channels * samplewidth), |
memcpy(*out + (i * resample_to_channels * samplewidth) + (samplewidth * j), |
289 |
in + (source * resample_to_channels * samplewidth), samplewidth); |
in + (source * resample_to_channels * samplewidth) + (samplewidth * j), |
290 |
memcpy(*out + (i * resample_to_channels * samplewidth) + samplewidth, |
samplewidth); |
|
in + (source * resample_to_channels * samplewidth) + samplewidth, |
|
|
samplewidth); |
|
|
} |
|
|
else |
|
|
{ |
|
|
memcpy(*out + (i * samplewidth), in + (source * samplewidth), samplewidth); |
|
291 |
} |
} |
292 |
} |
} |
293 |
outsize = i * resample_to_channels * samplewidth; |
outsize = i * resample_to_channels * samplewidth; |