Changeset 9638f84


Ignore:
Timestamp:
Nov 24, 2007, 5:44:49 PM (13 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
d7a104c
Parents:
4bb32f4
Message:

pitchmcomb.c: make sure all variables are initialised

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitchmcomb.c

    r4bb32f4 r9638f84  
    192192  uint_t l;
    193193  uint_t d;
    194   uint_t curlen;
     194  uint_t curlen = 0;
    195195
    196196  smpl_t delta2;
     
    214214    candidate[l]->ebin=scaler*peaks[root_peak].ebin;
    215215    /* if less than N peaks available, curlen < N */
    216     curlen = (uint_t)FLOOR(length/(candidate[l]->ebin));
     216    if (candidate[l]->ebin != 0.)
     217      curlen = (uint_t)FLOOR(length/(candidate[l]->ebin));
    217218    curlen = (N < curlen )? N : curlen;
    218219    /* fill candidate[l]->ecomb[k] with (k+1)*candidate[l]->ebin */
     
    326327  aubio_pitchmcomb_t * p = AUBIO_NEW(aubio_pitchmcomb_t);
    327328  /* bug: should check if size / 8 > post+pre+1 */
    328   uint_t i;
     329  uint_t i, j;
    329330  uint_t spec_size;
    330331  p->spec_partition   = 4;
     
    353354  /* array of spectral peaks */
    354355  p->peaks      = AUBIO_ARRAY(aubio_spectralpeak_t,spec_size);
     356  for (i = 0; i < spec_size; i++) {
     357    p->peaks[i].bin = 0.;
     358    p->peaks[i].ebin = 0.;
     359    p->peaks[i].mag = 0.;
     360  }
    355361  /* array of pointers to spectral candidates */
    356362  p->candidates = AUBIO_ARRAY(aubio_spectralcandidate_t *,p->ncand);
     
    358364    p->candidates[i] = AUBIO_NEW(aubio_spectralcandidate_t);
    359365    p->candidates[i]->ecomb = AUBIO_ARRAY(smpl_t, spec_size);
     366    for (j=0; j < spec_size; j++) {
     367      p->candidates[i]->ecomb[j] = 0.;
     368    }
     369    p->candidates[i]->ene = 0.;
     370    p->candidates[i]->ebin = 0.;
     371    p->candidates[i]->len = 0.;
    360372  }
    361373  return p;
     
    371383  AUBIO_FREE(p->peaks);
    372384  for (i=0;i<p->ncand;i++) {
     385    AUBIO_FREE(p->candidates[i]->ecomb);
    373386    AUBIO_FREE(p->candidates[i]);
    374387  }
Note: See TracChangeset for help on using the changeset viewer.