Changeset 569b363 for python/ext/py-filterbank.c
- Timestamp:
- Apr 24, 2016, 6:23:14 PM (9 years ago)
- 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:
- 51b9c83
- Parents:
- a35db12
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-filterbank.c
ra35db12 r569b363 9 9 uint_t n_filters; 10 10 uint_t win_s; 11 cvec_t *vec; 11 cvec_t vec; 12 fvec_t freqs; 13 fmat_t coeffs; 12 14 fvec_t *out; 13 fvec_t *freqs;14 fmat_t *coeffs;15 15 } Py_filterbank; 16 16 … … 67 67 self->out = new_fvec(self->n_filters); 68 68 69 self->vec = (cvec_t *)malloc(sizeof(cvec_t));70 71 self->freqs = (fvec_t *)malloc(sizeof(fvec_t));72 73 self->coeffs = (fmat_t *)malloc(sizeof(fmat_t));74 self->coeffs->data = (smpl_t **)malloc(sizeof(smpl_t*) * self->n_filters);75 self->coeffs->height = self->n_filters;76 77 69 return 0; 78 70 } … … 83 75 del_aubio_filterbank(self->o); 84 76 del_fvec(self->out); 85 free(self->vec); 86 free(self->freqs); 87 free(self->coeffs->data); 88 free(self->coeffs); 77 free(self->coeffs.data); 89 78 Py_TYPE(self)->tp_free((PyObject *) self); 90 79 } … … 99 88 } 100 89 101 if (!PyAubio_ArrayToCCvec(input, self->vec)) {90 if (!PyAubio_ArrayToCCvec(input, &(self->vec) )) { 102 91 return NULL; 103 92 } 104 93 105 94 // compute the function 106 aubio_filterbank_do (self->o, self->vec, self->out);95 aubio_filterbank_do (self->o, &(self->vec), self->out); 107 96 return (PyObject *)PyAubio_CFvecToArray(self->out); 108 97 } … … 131 120 } 132 121 133 if (!PyAubio_ArrayToCFvec(input, self->freqs)) {122 if (!PyAubio_ArrayToCFvec(input, &(self->freqs) )) { 134 123 return NULL; 135 124 } 136 125 137 126 err = aubio_filterbank_set_triangle_bands (self->o, 138 self->freqs, samplerate);127 &(self->freqs), samplerate); 139 128 if (err > 0) { 140 129 PyErr_SetString (PyExc_ValueError, … … 174 163 } 175 164 176 if (!PyAubio_ArrayToCFmat(input, self->coeffs)) {177 return NULL; 178 } 179 180 err = aubio_filterbank_set_coeffs (self->o, self->coeffs);165 if (!PyAubio_ArrayToCFmat(input, &(self->coeffs))) { 166 return NULL; 167 } 168 169 err = aubio_filterbank_set_coeffs (self->o, &(self->coeffs)); 181 170 182 171 if (err > 0) {
Note: See TracChangeset
for help on using the changeset viewer.