ref: 171ae68d6221cf0cd48fcdd0ad70bc895b2d39d3
parent: b8fa393ea2f4a0df4325c0bd7789ef3e175b7c33
parent: 8e76c71be6136f4e2289f8c67e422097f5e10dfe
author: Paul Brossier <piem@piem.org>
date: Thu Dec 20 18:30:52 EST 2018
Merge branch 'master' into feature/sink_vorbis
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,14 +11,18 @@
- python: 2.7
os: linux
compiler: gcc
+ - python: "pypy"
+ os: linux
+ compiler: gcc
+ env: CFLAGS="-Os" WAFOPTS="--disable-avcodec"
- python: 3.5
os: linux
compiler: gcc
- env: CFLAGS="-Os" WAFOPTS="--disable-samplerate --disable-sndfile"
+ env: CFLAGS="-Os" WAFOPTS="--disable-samplerate"
- python: 3.4
os: linux
compiler: gcc
- env: HAVE_AUBIO_DOUBLE=1 CFLAGS="-O3" WAFOPTS="--enable-fftw3 --disable-avcodec"
+ env: HAVE_AUBIO_DOUBLE=1 CFLAGS="-O3" WAFOPTS="--enable-fftw3"
- python: 2.7
os: linux
compiler: gcc
--- a/python/ext/py-source.c
+++ b/python/ext/py-source.c
@@ -573,7 +573,9 @@
return vec;
} else if (PyLong_AsLong(size) > 0) {
// short read, return a shorter array
- PyArrayObject *shortread = (PyArrayObject*)PyTuple_GetItem(done, 0);
+ PyArrayObject *shortread = (PyArrayObject*)
+ PyArray_FROM_OTF(PyTuple_GetItem(done, 0), NPY_NOTYPE,
+ NPY_ARRAY_ENSURECOPY);
PyArray_Dims newdims;
PyObject *reshaped;
newdims.len = PyArray_NDIM(shortread);
--- a/src/io/source_avcodec.c
+++ b/src/io/source_avcodec.c
@@ -525,9 +525,9 @@
uint_t i,j;
uint_t end = 0;
uint_t total_wrote = 0;
- uint_t length = aubio_source_validate_input_length("source_wavread", s->path,
+ uint_t length = aubio_source_validate_input_length("source_avcodec", s->path,
s->hop_size, read_data->length);
- uint_t channels = aubio_source_validate_input_channels("source_wavread",
+ uint_t channels = aubio_source_validate_input_channels("source_avcodec",
s->path, s->input_channels, read_data->height);
while (total_wrote < length) {
end = MIN(s->read_samples - s->read_index, length - total_wrote);
--- a/src/io/source_sndfile.c
+++ b/src/io/source_sndfile.c
@@ -173,9 +173,9 @@
uint_t length = aubio_source_validate_input_length("source_sndfile", s->path,
s->hop_size, read_data->length);
sf_count_t read_samples = aubio_sf_read_smpl (s->handle, s->scratch_data,
- s->input_channels * length);
+ s->scratch_size);
- length = MIN(read_samples / s->input_channels, length);
+ uint_t read_length = read_samples / s->input_channels;
/* where to store de-interleaved data */
smpl_t *ptr_data;
@@ -185,11 +185,12 @@
} else
#endif /* HAVE_SAMPLERATE */
{
+ read_length = MIN(length, read_length);
ptr_data = read_data->data;
}
/* de-interleaving and down-mixing data */
- for (j = 0; j < length; j++) {
+ for (j = 0; j < read_length; j++) {
ptr_data[j] = 0;
for (i = 0; i < input_channels; i++) {
ptr_data[j] += s->scratch_data[input_channels*j+i];
@@ -203,7 +204,7 @@
}
#endif /* HAVE_SAMPLERATE */
- *read = (int)FLOOR(s->ratio * length + .5);
+ *read = MIN(length, (uint_t)FLOOR(s->ratio * read_length + .5));
aubio_source_pad_output (read_data, *read);
@@ -217,9 +218,9 @@
uint_t channels = aubio_source_validate_input_channels("source_sndfile",
s->path, s->input_channels, read_data->height);
sf_count_t read_samples = aubio_sf_read_smpl (s->handle, s->scratch_data,
- length * s->input_channels);
+ s->scratch_size);
- length = MIN(read_samples / s->input_channels, length);
+ uint_t read_length = read_samples / s->input_channels;
/* where to store de-interleaved data */
smpl_t **ptr_data;
@@ -229,10 +230,11 @@
} else
#endif /* HAVE_SAMPLERATE */
{
+ read_length = MIN(read_length, length);
ptr_data = read_data->data;
}
- for (j = 0; j < length; j++) {
+ for (j = 0; j < read_length; j++) {
for (i = 0; i < channels; i++) {
ptr_data[i][j] = s->scratch_data[j * input_channels + i];
}
@@ -251,7 +253,7 @@
}
#endif /* HAVE_SAMPLERATE */
- *read = (int)FLOOR(s->ratio * length + .5);
+ *read = MIN(length, (uint_t)FLOOR(s->ratio * read_length + .5));
aubio_source_pad_multi_output(read_data, input_channels, *read);
}