Changes in / [4cb2d54:00c9444]
- Files:
-
- 1 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
.travis.yml
r4cb2d54 r00c9444 3 3 matrix: 4 4 include: 5 - python: 3. 65 - python: 3.5 6 6 os: linux 7 7 compiler: gcc 8 - python: 3. 58 - python: 3.4 9 9 os: linux 10 10 compiler: gcc … … 12 12 os: linux 13 13 compiler: gcc 14 - python: "pypy 3.5"14 - python: "pypy" 15 15 os: linux 16 16 compiler: gcc 17 17 env: CFLAGS="-Os" WAFOPTS="--disable-avcodec" 18 - python: 3. 618 - python: 3.5 19 19 os: linux 20 20 compiler: gcc 21 21 env: CFLAGS="-Os" WAFOPTS="--disable-samplerate" 22 - python: 3. 522 - python: 3.4 23 23 os: linux 24 24 compiler: gcc -
examples/utils.c
r4cb2d54 r00c9444 185 185 186 186 del_aubio_source (this_source); 187 if (this_sink) 188 del_aubio_sink (this_sink); 187 del_aubio_sink (this_sink); 189 188 190 189 } -
python/ext/py-filter.c
r4cb2d54 r00c9444 110 110 { 111 111 Py_XDECREF(self->out); 112 if (self->o) 113 del_aubio_filter (self->o); 112 del_aubio_filter (self->o); 114 113 Py_TYPE(self)->tp_free ((PyObject *) self); 115 114 } -
python/ext/py-sink.c
r4cb2d54 r00c9444 151 151 Py_sink_del (Py_sink *self, PyObject *unused) 152 152 { 153 if (self->o) { 154 del_aubio_sink(self->o); 155 free(self->mwrite_data.data); 156 } 153 del_aubio_sink(self->o); 154 free(self->mwrite_data.data); 157 155 if (self->uri) { 158 156 free(self->uri); -
python/ext/py-source.c
r4cb2d54 r00c9444 437 437 aubio_source_do (self->o, &(self->c_read_to), &read); 438 438 439 if (PyErr_Occurred() != NULL) {440 return NULL;441 }442 443 439 outputs = PyTuple_New(2); 444 440 PyTuple_SetItem( outputs, 0, self->read_to ); … … 461 457 /* compute _do function */ 462 458 aubio_source_do_multi (self->o, &(self->c_mread_to), &read); 463 464 if (PyErr_Occurred() != NULL) {465 return NULL;466 }467 459 468 460 outputs = PyTuple_New(2); … … 582 574 } else if (PyLong_AsLong(size) > 0) { 583 575 // short read, return a shorter array 584 PyArrayObject *shortread = (PyArrayObject*)PyTuple_GetItem(done, 0); 576 PyArrayObject *shortread = (PyArrayObject*) 577 PyArray_FROM_OTF(PyTuple_GetItem(done, 0), NPY_NOTYPE, 578 NPY_ARRAY_ENSURECOPY); 585 579 PyArray_Dims newdims; 586 580 PyObject *reshaped; -
python/tests/test_source.py
r4cb2d54 r00c9444 24 24 _debug = False 25 25 26 class Test_aubio_source_test_case( TestCase):26 class Test_aubio_source_test_case(object): 27 27 28 def setUp(self): 29 if not default_test_sound: 30 skipTest(no_sounds_msg) 31 32 def test_close_file(self): 28 @parametrize('filename', list_of_sounds) 29 def test_close_file(self, filename): 33 30 samplerate = 0 # use native samplerate 34 31 hop_size = 256 35 f = source( default_test_sound, samplerate, hop_size)32 f = source(filename, samplerate, hop_size) 36 33 f.close() 37 34 38 def test_close_file_twice(self): 35 @parametrize('filename', list_of_sounds) 36 def test_close_file_twice(self, filename): 39 37 samplerate = 0 # use native samplerate 40 38 hop_size = 256 41 f = source( default_test_sound, samplerate, hop_size)39 f = source(filename, samplerate, hop_size) 42 40 f.close() 43 41 f.close() 44 45 def test_read_after_close(self):46 samplerate = 0 # use native samplerate47 hop_size = 25648 f = source(default_test_sound, samplerate, hop_size)49 read, frames = f()50 f.close()51 with assert_raises(RuntimeError):52 read, frames = f()53 with assert_raises(RuntimeError):54 read, frames = f.do_multi()55 56 42 57 43 class Test_aubio_source_read(object): -
scripts/build_apple_frameworks
r4cb2d54 r00c9444 14 14 #VERSION+=+$(git log --pretty=format:"%h" -1) 15 15 16 CFLAGS="-Werror -O s"16 CFLAGS="-Werror -Ofast" 17 17 WAFCONF="--disable-sndfile --disable-avcodec --disable-samplerate --enable-fat" # --disable-memcpy --disable-accelerate" 18 18 -
src/io/sink.c
r4cb2d54 r00c9444 217 217 void del_aubio_sink(aubio_sink_t * s) { 218 218 AUBIO_ASSERT(s); 219 if (s && s->s_del && s->sink)219 if (s->s_del && s->sink) 220 220 s->s_del((void *)s->sink); 221 221 AUBIO_FREE(s); -
src/io/source.c
r4cb2d54 r00c9444 140 140 void del_aubio_source(aubio_source_t * s) { 141 141 AUBIO_ASSERT(s); 142 if (s && s->s_del && s->source)142 if (s->s_del && s->source) 143 143 s->s_del((void *)s->source); 144 144 AUBIO_FREE(s); -
src/io/source_apple_audio.c
r4cb2d54 r00c9444 345 345 "error in ExtAudioFileGetProperty (%s)\n", s->path, 346 346 getPrintableOSStatusError(errorstr, err)); 347 return 0;347 return err; 348 348 } 349 349 return (uint_t)fileLengthFrames; -
src/io/source_avcodec.c
r4cb2d54 r00c9444 492 492 uint_t length = aubio_source_validate_input_length("source_avcodec", s->path, 493 493 s->hop_size, read_data->length); 494 if (!s->avr || !s->avFormatCtx || !s->avCodecCtx) {495 AUBIO_ERR("source_avcodec: could not read from %s (file was closed)\n",496 s->path);497 *read= 0;498 return;499 }500 494 while (total_wrote < length) { 501 495 end = MIN(s->read_samples - s->read_index, length - total_wrote); … … 536 530 uint_t channels = aubio_source_validate_input_channels("source_avcodec", 537 531 s->path, s->input_channels, read_data->height); 538 if (!s->avr || !s->avFormatCtx || !s->avCodecCtx) {539 AUBIO_ERR("source_avcodec: could not read from %s (file was closed)\n",540 s->path);541 *read= 0;542 return;543 }544 532 while (total_wrote < length) { 545 533 end = MIN(s->read_samples - s->read_index, length - total_wrote); -
src/io/source_sndfile.c
r4cb2d54 r00c9444 175 175 sf_count_t read_samples = aubio_sf_read_smpl (s->handle, s->scratch_data, 176 176 s->scratch_size); 177 if (!s->handle) {178 AUBIO_ERR("source_sndfile: could not read from %s (file was closed)\n",179 s->path);180 *read = 0;181 return;182 }183 177 184 178 uint_t read_length = read_samples / s->input_channels; … … 226 220 sf_count_t read_samples = aubio_sf_read_smpl (s->handle, s->scratch_data, 227 221 s->scratch_size); 228 if (!s->handle) {229 AUBIO_ERR("source_sndfile: could not read from %s (file was closed)\n",230 s->path);231 *read = 0;232 return;233 }234 222 235 223 uint_t read_length = read_samples / s->input_channels; -
tests/src/io/base-sink_custom.h
r4cb2d54 r00c9444 152 152 close_temp_sink(sink_path, fd); 153 153 154 // shouldn't crash on null (bypassed, only check del_aubio_sink)155 // del_aubio_sink_custom(NULL);156 157 154 return run_on_default_source_and_sink(base_main); 158 155 } -
tests/src/io/base-source_custom.h
r4cb2d54 r00c9444 142 142 aubio_source_custom_close(s); 143 143 144 // reading after close fails145 del_fvec(vec);146 vec = new_fvec(hop_size);147 aubio_source_custom_do(s, vec, &read);148 del_fmat(mat);149 mat = new_fmat(channels, hop_size);150 aubio_source_custom_do_multi(s, mat, &read);151 152 144 del_aubio_source_custom(s); 153 145 del_fmat(mat); 154 146 del_fvec(vec); 155 156 // shouldn't crash on null (bypassed, only check del_aubio_source)157 // del_aubio_source_custom(NULL);158 147 159 148 return run_on_default_source(base_main); -
tests/src/io/test-sink.c
r4cb2d54 r00c9444 148 148 close_temp_sink(sink_path, fd); 149 149 150 // shouldn't crash on null151 del_aubio_sink(NULL);152 153 150 return run_on_default_source_and_sink(main); 154 151 } -
tests/src/io/test-source.c
r4cb2d54 r00c9444 138 138 aubio_source_close(s); 139 139 140 // reading after close fails141 del_fvec(vec);142 vec = new_fvec(hop_size);143 aubio_source_do(s, vec, &read);144 del_fmat(mat);145 mat = new_fmat(channels, hop_size);146 aubio_source_do_multi(s, mat, &read);147 148 140 del_aubio_source(s); 149 141 del_fmat(mat); 150 142 del_fvec(vec); 151 143 152 // shouldn't crash on null153 del_aubio_source(NULL);154 155 144 return run_on_default_source(main); 156 145 } -
tests/src/test-cvec.c
r4cb2d54 r00c9444 4 4 int main (void) 5 5 { 6 uint_t i, window_size = 16; 7 cvec_t * complex_vector = new_cvec (window_size);8 cvec_t * other_cvector = new_cvec(window_size);6 uint_t i, window_size = 16; // window size 7 cvec_t * complex_vector = new_cvec (window_size); // input buffer 8 uint_t rand_times = 4; 9 9 10 assert(cvec_norm_get_data(complex_vector) == complex_vector->norm); 11 assert(cvec_phas_get_data(complex_vector) == complex_vector->phas); 12 assert(complex_vector->length == window_size / 2 + 1); 10 utils_init_random(); 13 11 14 // all elements are initialized to 0 12 while (rand_times -- ) { 13 // fill with random phas and norm 14 for ( i = 0; i < complex_vector->length; i++ ) { 15 complex_vector->norm[i] = ( 2. / RAND_MAX * random() - 1. ); 16 complex_vector->phas[i] = ( 2. / RAND_MAX * random() - 1. ) * M_PI; 17 } 18 // print the vector 19 cvec_print(complex_vector); 20 } 21 22 // set all vector elements to `0` 23 cvec_norm_zeros(complex_vector); 15 24 for ( i = 0; i < complex_vector->length; i++ ) { 16 25 assert( complex_vector->norm[i] == 0. ); 17 assert( complex_vector->phas[i] == 0.);26 // assert( complex_vector->phas[i] == 0 ); 18 27 } 19 20 cvec_norm_set_sample(complex_vector, 2., 1);21 assert(cvec_norm_get_sample(complex_vector, 1));22 23 cvec_phas_set_sample(complex_vector, 2., 1);24 assert(cvec_phas_get_sample(complex_vector, 1));25 26 28 cvec_print(complex_vector); 27 29 28 // set all norm and phas elements to 0 29 cvec_zeros(complex_vector); 30 for ( i = 0; i < complex_vector->length; i++ ) { 31 assert( complex_vector->norm[i] == 0. ); 32 assert( complex_vector->phas[i] == 0. ); 33 } 34 35 // set all norm elements to 1 30 // set all vector elements to `1` 36 31 cvec_norm_ones(complex_vector); 37 32 for ( i = 0; i < complex_vector->length; i++ ) { 38 33 assert( complex_vector->norm[i] == 1. ); 34 // assert( complex_vector->phas[i] == 0 ); 39 35 } 36 cvec_print(complex_vector); 40 37 41 // set all norm elements to 0 38 cvec_zeros(complex_vector); 39 cvec_phas_zeros(complex_vector); 42 40 cvec_norm_zeros(complex_vector); 43 for ( i = 0; i < complex_vector->length; i++ ) {44 assert( complex_vector->norm[i] == 0.);45 }41 cvec_norm_ones(complex_vector); 42 cvec_phas_ones(complex_vector); 43 cvec_copy(complex_vector, complex_vector); 46 44 47 // set all phas elements to 1 48 cvec_phas_ones(complex_vector); 49 for ( i = 0; i < complex_vector->length; i++ ) { 50 assert( complex_vector->phas[i] == 1. ); 51 } 52 53 // set all phas elements to 0 54 cvec_phas_zeros(complex_vector); 55 for ( i = 0; i < complex_vector->length; i++ ) { 56 assert( complex_vector->phas[i] == 0. ); 57 } 58 59 cvec_copy(complex_vector, other_cvector); 60 // copy to self 61 cvec_copy(complex_vector, complex_vector); 62 // copy to a different size fails 63 del_cvec(other_cvector); 64 other_cvector = new_cvec(window_size + 2); 65 cvec_copy(complex_vector, other_cvector); 66 67 if (complex_vector) 68 del_cvec(complex_vector); 69 if (other_cvector) 70 del_cvec(other_cvector); 71 72 // wrong parameters 73 assert(new_cvec(-1) == NULL); 74 assert(new_cvec(0) == NULL); 75 45 // destroy it 46 del_cvec(complex_vector); 76 47 return 0; 77 48 } -
tests/src/test-fmat.c
r4cb2d54 r00c9444 5 5 // and j the column. 6 6 7 void assert_fmat_all_equal(fmat_t *mat, smpl_t scalar)7 int main (void) 8 8 { 9 uint_t i, j; 9 uint_t height = 3, length = 9, i, j; 10 // create fmat_t object 11 fmat_t * mat = new_fmat (height, length); 10 12 for ( i = 0; i < mat->height; i++ ) { 11 13 for ( j = 0; j < mat->length; j++ ) { 12 assert(mat->data[i][j] == scalar);13 }14 }15 }16 17 int main (void)18 {19 uint_t i, j;20 uint_t height = 3, length = 9;21 22 // create fmat_t object23 fmat_t * mat = new_fmat(height, length);24 fmat_t * other_mat = new_fmat(height, length);25 26 assert(mat);27 assert(other_mat);28 29 assert(mat->length == length);30 assert(mat->height == height);31 32 for (i = 0; i < mat->height; i++) {33 for (j = 0; j < mat->length; j++) {34 14 // all elements are already initialized to 0. 35 15 assert(mat->data[i][j] == 0); 36 16 // setting element of row i, column j 37 mat->data[i][j] = i * 1 0. + j;17 mat->data[i][j] = i * 1. + j *.1; 38 18 } 39 19 } 40 41 // print out matrix42 fmat_print(mat);43 44 // helpers45 fmat_rev(mat);46 fmat_print(mat);47 for (i = 0; i < mat->height; i++) {48 for (j = 0; j < mat->length; j++) {49 assert(mat->data[i][j] == i * 10. + mat->length - 1. - j);50 }51 }52 53 fmat_set_sample(mat, 3, 1, 1);54 assert(fmat_get_sample(mat, 1, 1) == 3.);55 56 fmat_ones(mat);57 assert_fmat_all_equal(mat, 1.);58 59 fmat_set(other_mat, .5);60 assert_fmat_all_equal(other_mat, .5);61 62 fmat_weight(mat, other_mat);63 assert_fmat_all_equal(mat, .5);64 65 20 fvec_t channel_onstack; 66 21 fvec_t *channel = &channel_onstack; 67 22 fmat_get_channel(mat, 1, channel); 68 assert(channel->data == mat->data[1]); 69 70 // copy of the same size 71 fmat_copy(mat, other_mat); 72 del_fmat(other_mat); 73 74 // copy to undersized 75 other_mat = new_fmat(height - 1, length); 76 fmat_copy(mat, other_mat); 77 del_fmat(other_mat); 78 79 // copy from undersized 80 other_mat = new_fmat(height, length + 1); 81 fmat_copy(mat, other_mat); 82 83 // wrong parameters 84 assert(new_fmat(-1, length) == NULL); 85 assert(new_fmat(height, -1) == NULL); 86 87 // methods for wrappers with opaque structure 88 assert (fmat_get_channel_data(mat, 0) == mat->data[0]); 89 assert (fmat_get_data(mat) == mat->data); 90 91 if (mat) 92 del_fmat(mat); 93 if (other_mat) 94 del_fmat(other_mat); 23 fvec_print (channel); 24 // print out matrix 25 fmat_print(mat); 26 // destroy it 27 del_fmat(mat); 95 28 return 0; 96 29 } 30 -
tests/src/test-fvec.c
r4cb2d54 r00c9444 2 2 #include "utils_tests.h" 3 3 4 void assert_fvec_all_equal(fvec_t *vec, smpl_t scalar)5 {6 uint_t i;7 for (i = 0; i < vec->length; i++) {8 assert(vec->data[i] == scalar);9 }10 }11 12 4 int main (void) 13 5 { 14 uint_t length = 10; 15 uint_t i; 16 17 fvec_t * vec = new_fvec (length); 18 fvec_t * other_vec = new_fvec (length); 19 20 assert (vec); 21 assert (other_vec); 6 uint_t vec_size = 10, i; 7 fvec_t * vec = new_fvec (vec_size); 22 8 23 9 // vec->length matches requested size 24 assert(vec->length == length);10 assert(vec->length == vec_size); 25 11 26 12 // all elements are initialized to `0.` … … 29 15 } 30 16 17 // all elements can be set to `0.` 18 fvec_zeros(vec); 19 for ( i = 0; i < vec->length; i++ ) { 20 assert(vec->data[i] == 0.); 21 } 22 fvec_print(vec); 23 31 24 // all elements can be set to `1.` 32 25 fvec_ones(vec); 33 assert_fvec_all_equal(vec, 1.); 34 35 // all elements can be set to `0.` 36 fvec_zeros(vec); 37 assert_fvec_all_equal(vec, 0.); 26 for ( i = 0; i < vec->length; i++ ) { 27 assert(vec->data[i] == 1.); 28 } 29 fvec_print(vec); 38 30 39 31 // each element can be accessed directly … … 44 36 fvec_print(vec); 45 37 46 fvec_set_sample(vec, 3, 2);47 assert(fvec_get_sample(vec, 2) == 3);38 // now destroys the vector 39 del_fvec(vec); 48 40 49 assert(fvec_get_data(vec) == vec->data);50 51 // wrong parameters52 assert(new_fvec(-1) == NULL);53 54 // copy to an identical size works55 fvec_copy(vec, other_vec);56 del_fvec(other_vec);57 58 // copy to a different size fail59 other_vec = new_fvec(length + 1);60 fvec_copy(vec, other_vec);61 del_fvec(other_vec);62 63 // copy to a different size fail64 other_vec = new_fvec(length - 1);65 fvec_copy(vec, other_vec);66 67 // now destroys the vector68 if (vec)69 del_fvec(vec);70 if (other_vec)71 del_fvec(other_vec);72 41 return 0; 73 42 } 43 -
tests/src/test-lvec.c
r4cb2d54 r00c9444 2 2 #include "utils_tests.h" 3 3 4 void assert_lvec_all_equal(lvec_t *vec, lsmp_t scalar)4 int main (void) 5 5 { 6 uint_t i; 7 for (i = 0; i < vec->length; i++) { 8 assert(vec->data[i] == scalar); 9 } 6 uint_t win_s = 32; // window size 7 lvec_t * sp = new_lvec (win_s); // input buffer 8 lvec_set_sample (sp, 2./3., 0); 9 PRINT_MSG(AUBIO_LSMP_FMT "\n", lvec_get_sample (sp, 0)); 10 lvec_print (sp); 11 lvec_ones (sp); 12 lvec_print (sp); 13 lvec_set_all (sp, 3./5.); 14 lvec_print (sp); 15 del_lvec(sp); 16 return 0; 10 17 } 11 18 12 int main (void)13 {14 uint_t length = 32; // window size15 16 lvec_t * vec = new_lvec (length); // input buffer17 18 assert(vec);19 20 assert(vec->length == length);21 22 lvec_set_sample (vec, 3., 0);23 assert(lvec_get_sample(vec, 0) == 3.);24 25 assert(lvec_get_data(vec) == vec->data);26 27 lvec_print (vec);28 // note AUBIO_LSMP_FMT can be used to print lsmp_t29 PRINT_MSG(AUBIO_LSMP_FMT "\n", lvec_get_sample (vec, 0));30 31 lvec_set_all (vec, 2.);32 assert_lvec_all_equal(vec, 2.);33 34 lvec_ones (vec);35 assert_lvec_all_equal(vec, 1.);36 37 lvec_zeros (vec);38 assert_lvec_all_equal(vec, 0.);39 40 del_lvec(vec);41 42 // wrong parameters43 assert(new_lvec(0) == NULL);44 assert(new_lvec(-1) == NULL);45 46 return 0;47 } -
tests/src/test-mathutils-window.c
r4cb2d54 r00c9444 8 8 uint_t lengths[4] = { 8, 10, 15, 16 }; 9 9 char *method = "default"; 10 char *window_types[1 1] = { "default",11 " ones", "rectangle", "hamming", "hanning", "hanningz",10 char *window_types[10] = { "default", 11 "rectangle", "hamming", "hanning", "hanningz", 12 12 "blackman", "blackman_harris", "gaussian", "welch", "parzen"}; 13 13 … … 27 27 } 28 28 } 29 30 assert (new_aubio_window("parzen", -1) == NULL);31 assert (new_aubio_window(NULL, length) == NULL);32 assert (new_aubio_window("\0", length) == NULL);33 29 return 0; 34 30 } -
wscript
r4cb2d54 r00c9444 438 438 # check for vorbisenc 439 439 if (ctx.options.enable_vorbis != False): 440 ctx.check_cfg(package = 'vorbisenc vorbis ogg',440 ctx.check_cfg(package = 'vorbisenc', 441 441 args = '--cflags --libs', 442 442 uselib_store = 'VORBISENC',
Note: See TracChangeset
for help on using the changeset viewer.