Changeset dde06ad for src


Ignore:
Timestamp:
Jul 13, 2006, 3:42:23 PM (18 years ago)
Author:
Paul Brossier <piem@altern.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:
9c54265
Parents:
c84300e
Message:

update hist deletion function
update hist deletion function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hist.c

    rc84300e rdde06ad  
    3636};
    3737
    38 
    39 /********************************************************
    40  * Object Memory Allocation
     38/**
     39 * Object creation/deletion calls
    4140 */
    42 
    43 static aubio_hist_t * aubio_hist_malloc(uint_t channels, uint_t nelems);
    44 static void aubio_hist_free(aubio_hist_t * s);
    45 
    46 aubio_hist_t * aubio_hist_malloc(uint_t channels, uint_t nelems) {
     41aubio_hist_t * new_aubio_hist (smpl_t ilow, smpl_t ihig, uint_t nelems, uint_t channels){
     42        aubio_hist_t * s = AUBIO_NEW(aubio_hist_t);
     43        smpl_t step = (ihig-ilow)/(smpl_t)(nelems);
     44        smpl_t accum = step;
    4745        uint_t i;
    48         aubio_hist_t * s = AUBIO_NEW(aubio_hist_t);
    4946        s->channels = channels;
    5047        s->nelems = nelems;
    51        
    5248        s->hist = AUBIO_ARRAY(smpl_t*, channels);
    5349        for (i=0; i< s->channels; i++) {
     
    5551        }
    5652        s->cent = AUBIO_ARRAY(smpl_t, nelems);
    57         return s;
    58 }
    59 
    60 void aubio_hist_free(aubio_hist_t * s) {
    61         AUBIO_FREE(s);
    62 }
    63 
    64 /***
    65  * Object creation/deletion calls
    66  */
    67 aubio_hist_t * new_aubio_hist (smpl_t ilow, smpl_t ihig, uint_t nelems, uint_t channels){
    68         smpl_t step = (ihig-ilow)/(smpl_t)(nelems);
    69         smpl_t accum = step;
    70         uint_t i;
    71         aubio_hist_t * s = aubio_hist_malloc(channels, nelems);
    7253       
    7354        /* use scale to map ilow/ihig -> 0/nelems */
     
    8263
    8364void del_aubio_hist(aubio_hist_t *s) {
    84         aubio_hist_free(s);
     65        uint_t i;
     66        for (i=0; i< s->channels; i++) {
     67                AUBIO_FREE(s->hist[i]);
     68        }
     69        AUBIO_FREE(s->hist);
     70        AUBIO_FREE(s->cent);
     71        del_aubio_scale(s->scaler);
     72        AUBIO_FREE(s);
    8573}
    8674
Note: See TracChangeset for help on using the changeset viewer.