Changes in src/mathutils.c [5644069:ca45e58]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mathutils.c
r5644069 rca45e58 50 50 { 51 51 fvec_t * win = new_fvec (length); 52 uint_t err;53 52 if (win == NULL) { 54 53 return NULL; 55 54 } 56 err = fvec_set_window (win, window_type);55 uint_t err = fvec_set_window (win, window_type); 57 56 if (err != 0) { 58 57 del_fvec(win); … … 418 417 419 418 smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t pos) { 420 smpl_t s0, s1, s2; uint_t x0, x2;419 smpl_t s0, s1, s2; 421 420 if (pos == 0 || pos == x->length - 1) return pos; 422 x0 = (pos < 1) ? pos : pos - 1;423 x2 = (pos + 1 < x->length) ? pos + 1 : pos;421 uint_t x0 = (pos < 1) ? pos : pos - 1; 422 uint_t x2 = (pos + 1 < x->length) ? pos + 1 : pos; 424 423 if (x0 == pos) return (x->data[pos] <= x->data[x2]) ? pos : x2; 425 424 if (x2 == pos) return (x->data[pos] <= x->data[x0]) ? pos : x0; … … 449 448 aubio_freqtomidi (smpl_t freq) 450 449 { 451 smpl_t midi;452 450 if (freq < 2. || freq > 100000.) return 0.; // avoid nans and infs 453 451 /* log(freq/A-2)/log(2) */ 454 midi = freq / 6.875;452 smpl_t midi = freq / 6.875; 455 453 midi = LOG (midi) / 0.69314718055995; 456 454 midi *= 12; … … 462 460 aubio_miditofreq (smpl_t midi) 463 461 { 464 smpl_t freq;465 462 if (midi > 140.) return 0.; // avoid infs 466 freq = (midi + 3.) / 12.;463 smpl_t freq = (midi + 3.) / 12.; 467 464 freq = EXP (freq * 0.69314718055995); 468 465 freq *= 6.875;
Note: See TracChangeset
for help on using the changeset viewer.