Changeset 93579e5 for src


Ignore:
Timestamp:
Mar 27, 2017, 10:37:58 AM (3 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, sampler
Children:
dccfad2
Parents:
25e0b0e
Message:

src/onset/onset.c: avoid start with doubled or negative onset

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/onset.c

    r25e0b0e r93579e5  
    7676      isonset  = 0;
    7777    } else {
     78      // we have an onset
    7879      uint_t new_onset = o->total_frames + (uint_t)ROUND(isonset * o->hop_size);
     80      // check if last onset time was more than minioi ago
    7981      if (o->last_onset + o->minioi < new_onset) {
    80         //AUBIO_DBG ("accepted detection, marking as onset\n");
    81         o->last_onset = new_onset;
     82        // start of file: make sure (new_onset - delay) >= 0
     83        if (o->last_onset > 0 && o->delay > new_onset) {
     84          isonset = 0;
     85        } else {
     86          //AUBIO_DBG ("accepted detection, marking as onset\n");
     87          o->last_onset = MAX(o->delay, new_onset);
     88        }
    8289      } else {
    8390        //AUBIO_DBG ("doubled onset, not marking as onset\n");
Note: See TracChangeset for help on using the changeset viewer.