Changeset 41b985f for src/pitch/pitch.c


Ignore:
Timestamp:
Mar 12, 2017, 11:26:24 AM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
sampler
Children:
bde49c4a
Parents:
71f2e5f (diff), 67b6618 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge 'origin/master' into sampler

Conflicts:

.travis.yml
Makefile
examples/aubionotes.c
examples/parse_args.h
python/demos/demo_timestretch_online.py
python/lib/moresetuptools.py
python/tests/test_source.py
setup.py
src/io/source.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitch/pitch.c

    r71f2e5f r41b985f  
    112112  aubio_pitch_t *p = AUBIO_NEW (aubio_pitch_t);
    113113  aubio_pitch_type pitch_type;
     114  if (pitch_mode == NULL) {
     115    AUBIO_ERR ("pitch: can not use ‘NULL‘ for pitch detection method\n");
     116    goto beach;
     117  }
    114118  if (strcmp (pitch_mode, "mcomb") == 0)
    115119    pitch_type = aubio_pitcht_mcomb;
     
    139143    goto beach;
    140144  } else if (bufsize < hopsize) {
    141     AUBIO_ERR("pitch: hop size (%d) is larger than win size (%d)\n", bufsize, hopsize);
     145    AUBIO_ERR("pitch: hop size (%d) is larger than win size (%d)\n", hopsize, bufsize);
    142146    goto beach;
    143147  } else if ((sint_t)samplerate < 1) {
     
    156160      p->buf = new_fvec (bufsize);
    157161      p->p_object = new_aubio_pitchyin (bufsize);
     162      if (!p->p_object) goto beach;
    158163      p->detect_cb = aubio_pitch_do_yin;
    159164      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyin_get_confidence;
     
    163168      p->filtered = new_fvec (hopsize);
    164169      p->pv = new_aubio_pvoc (bufsize, hopsize);
     170      if (!p->pv) goto beach;
    165171      p->fftgrain = new_cvec (bufsize);
    166172      p->p_object = new_aubio_pitchmcomb (bufsize, hopsize);
     
    171177      p->buf = new_fvec (bufsize);
    172178      p->p_object = new_aubio_pitchfcomb (bufsize, hopsize);
     179      if (!p->p_object) goto beach;
    173180      p->detect_cb = aubio_pitch_do_fcomb;
    174181      break;
     
    181188      p->buf = new_fvec (bufsize);
    182189      p->p_object = new_aubio_pitchyinfft (samplerate, bufsize);
     190      if (!p->p_object) goto beach;
    183191      p->detect_cb = aubio_pitch_do_yinfft;
    184192      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchyinfft_get_confidence;
     
    188196      p->buf = new_fvec (bufsize);
    189197      p->p_object = new_aubio_pitchspecacf (bufsize);
     198      if (!p->p_object) goto beach;
    190199      p->detect_cb = aubio_pitch_do_specacf;
    191200      p->conf_cb = (aubio_pitch_get_conf_t)aubio_pitchspecacf_get_tolerance;
     
    198207
    199208beach:
     209  if (p->filtered) del_fvec(p->filtered);
     210  if (p->buf) del_fvec(p->buf);
    200211  AUBIO_FREE(p);
    201212  return NULL;
Note: See TracChangeset for help on using the changeset viewer.