Changeset 9be906a


Ignore:
Timestamp:
Jan 29, 2015, 4:23:30 PM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
deb1fd4
Parents:
16f8dcc
Message:

src/tempo/tempo.c: check parameters for new_aubio_tempo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tempo/tempo.c

    r16f8dcc r9be906a  
    164164  char_t specdesc_func[20];
    165165  o->samplerate = samplerate;
     166  // check parameters are valid
     167  if ((sint_t)hop_size < 1) {
     168    AUBIO_ERR("tempo: got hop size %d, but can not be < 1\n", hop_size);
     169    goto beach;
     170  } else if ((sint_t)buf_size < 1) {
     171    AUBIO_ERR("tempo: got window size %d, but can not be < 1\n", buf_size);
     172    goto beach;
     173  } else if (buf_size < hop_size) {
     174    AUBIO_ERR("tempo: hop size (%d) is larger than window size (%d)\n", buf_size, hop_size);
     175    goto beach;
     176  } else if ((sint_t)samplerate < 1) {
     177    AUBIO_ERR("tempo: samplerate (%d) can not be < 1\n", samplerate);
     178    goto beach;
     179  }
     180
    166181  /* length of observations, worth about 6 seconds */
    167182  o->winlen = aubio_next_power_of_two(5.8 * samplerate / hop_size);
     183  if (o->winlen < 4) o->winlen = 4;
    168184  o->step = o->winlen/4;
    169185  o->blockpos = 0;
     
    194210  }*/
    195211  return o;
     212
     213beach:
     214  AUBIO_FREE(o);
     215  return NULL;
    196216}
    197217
Note: See TracChangeset for help on using the changeset viewer.