ref: 18a378eef755e01d6f5907dde97a4b272110b4f4
parent: 3d2fe263adc0b0308acdc8c2ba5fdbc646c953a6
author: Paul Brossier <piem@piem.org>
date: Thu Mar 21 16:50:06 EDT 2013
src/io/source_sndfile.c: pad with 0 when end of file is reached
--- a/src/io/source_sndfile.c
+++ b/src/io/source_sndfile.c
@@ -171,6 +171,13 @@
#endif /* HAVE_SAMPLERATE */
*read = (int)FLOOR(s->ratio * read_samples / input_channels + .5);
+
+ if (*read < s->hop_size) {
+ for (j = *read; j < s->hop_size; j++) {
+ data[j] = 0;
+ }
+ }
+
}
void aubio_source_sndfile_do_multi(aubio_source_sndfile_t * s, fmat_t * read_data, uint_t * read){
@@ -205,6 +212,15 @@
#endif /* HAVE_SAMPLERATE */
*read = (int)FLOOR(s->ratio * read_samples / input_channels + .5);
+
+ if (*read < s->hop_size) {
+ for (i = 0; i < input_channels; i++) {
+ for (j = *read; j < s->hop_size; j++) {
+ data[i][j] = 0.;
+ }
+ }
+ }
+
}
uint_t aubio_source_sndfile_get_samplerate(aubio_source_sndfile_t * s) {