Changeset 2abe563 for src/pitch/pitch.c


Ignore:
Timestamp:
Sep 20, 2014, 3:23:16 PM (10 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:
892c369
Parents:
f33ab63
Message:

src/pitch/pitch.c: check parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitch/pitch.c

    rf33ab63 r2abe563  
    130130    pitch_type = aubio_pitcht_default;
    131131  }
     132
     133  // check parameters are valid
     134  if ((sint_t)hopsize < 1) {
     135    AUBIO_ERR("onset: got hopsize %d, but can not be < 1\n", hopsize);
     136    goto beach;
     137  } else if ((sint_t)bufsize < 1) {
     138    AUBIO_ERR("onset: got buffer_size %d, but can not be < 1\n", bufsize);
     139    goto beach;
     140  } else if (bufsize < hopsize) {
     141    AUBIO_ERR("onset: hop size (%d) is larger than win size (%d)\n", bufsize, hopsize);
     142    goto beach;
     143  } else if ((sint_t)samplerate < 1) {
     144    AUBIO_ERR("onset: samplerate (%d) can not be < 1\n", samplerate);
     145    goto beach;
     146  }
     147
    132148  p->samplerate = samplerate;
    133149  p->type = pitch_type;
     
    179195  }
    180196  return p;
     197
     198beach:
     199  AUBIO_FREE(p);
     200  return NULL;
    181201}
    182202
Note: See TracChangeset for help on using the changeset viewer.