Changeset ce323e4
- Timestamp:
- Nov 26, 2018, 11:35:06 AM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
- Children:
- 88a4d8a
- Parents:
- 1cf031a (diff), 0f5f40b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/onset/onset.c
r1cf031a rce323e4 257 257 o->pp = new_aubio_peakpicker(); 258 258 o->od = new_aubio_specdesc(onset_mode,buf_size); 259 if (o->od == NULL) goto beach_specdesc;260 259 o->fftgrain = new_cvec(buf_size); 261 260 o->desc = new_fvec(1); 262 261 o->spectral_whitening = new_aubio_spectral_whitening(buf_size, hop_size, samplerate); 263 262 263 if (!o->pv || !o->pp || !o->od || !o->fftgrain 264 || !o->desc || !o->spectral_whitening) 265 goto beach; 266 264 267 /* initialize internal variables */ 265 268 aubio_onset_set_default_parameters (o, onset_mode); … … 268 271 return o; 269 272 270 beach_specdesc:271 del_aubio_peakpicker(o->pp);272 del_aubio_pvoc(o->pv);273 273 beach: 274 AUBIO_FREE(o);274 del_aubio_onset(o); 275 275 return NULL; 276 276 } … … 340 340 void del_aubio_onset (aubio_onset_t *o) 341 341 { 342 del_aubio_spectral_whitening(o->spectral_whitening); 343 del_aubio_specdesc(o->od); 344 del_aubio_peakpicker(o->pp); 345 del_aubio_pvoc(o->pv); 346 del_fvec(o->desc); 347 del_cvec(o->fftgrain); 342 if (o->spectral_whitening) 343 del_aubio_spectral_whitening(o->spectral_whitening); 344 if (o->od) 345 del_aubio_specdesc(o->od); 346 if (o->pp) 347 del_aubio_peakpicker(o->pp); 348 if (o->pv) 349 del_aubio_pvoc(o->pv); 350 if (o->desc) 351 del_fvec(o->desc); 352 if (o->fftgrain) 353 del_cvec(o->fftgrain); 348 354 AUBIO_FREE(o); 349 355 } -
tests/src/onset/test-onset.c
r1cf031a rce323e4 1 1 #include <aubio.h> 2 2 #include "utils_tests.h" 3 4 int test_wrong_params(void); 3 5 4 6 int main (int argc, char **argv) … … 7 9 if (argc < 2) { 8 10 err = 2; 9 PRINT_ERR("not enough arguments\n"); 10 PRINT_MSG("read a wave file as a mono vector\n"); 11 PRINT_WRN("no arguments, running tests\n"); 12 if (test_wrong_params() != 0) { 13 PRINT_ERR("tests failed!\n"); 14 err = 1; 15 } else { 16 err = 0; 17 } 11 18 PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]); 12 19 return err; … … 61 68 return err; 62 69 } 70 71 int test_wrong_params(void) 72 { 73 uint_t win_size = 1024; 74 uint_t hop_size = win_size / 2; 75 uint_t samplerate = 44100; 76 // hop_size < 1 77 if (new_aubio_onset("default", 5, 0, samplerate)) 78 return 1; 79 // buf_size < 2 80 if (new_aubio_onset("default", 1, 1, samplerate)) 81 return 1; 82 // buf_size < hop_size 83 if (new_aubio_onset("default", hop_size, win_size, samplerate)) 84 return 1; 85 // samplerate < 1 86 if (new_aubio_onset("default", 1024, 512, 0)) 87 return 1; 88 89 // specdesc creation failed 90 if (new_aubio_onset("abcd", win_size, win_size/2, samplerate)) 91 return 1; 92 // pv creation failed 93 if (new_aubio_onset("default", 5, 2, samplerate)) 94 return 1; 95 96 aubio_onset_t *o; 97 o = new_aubio_onset("default", win_size, hop_size, samplerate); 98 if (!aubio_onset_set_default_parameters(o, "wrong_type")) 99 return 1; 100 del_aubio_onset(o); 101 102 return 0; 103 }
Note: See TracChangeset
for help on using the changeset viewer.