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