- Timestamp:
- Apr 18, 2016, 8:31:20 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:
- 202697a
- Parents:
- a28dab6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-filterbank.c
ra28dab6 r59cb451 3 3 static char Py_filterbank_doc[] = "filterbank object"; 4 4 5 AUBIO_DECLARE(filterbank, uint_t n_filters; uint_t win_s) 5 typedef struct 6 { 7 PyObject_HEAD 8 aubio_filterbank_t * o; 9 uint_t n_filters; 10 uint_t win_s; 11 fvec_t *out; 12 } Py_filterbank; 6 13 7 14 //AUBIO_NEW(filterbank) … … 45 52 } 46 53 47 48 AUBIO_INIT(filterbank, self->n_filters, self->win_s) 49 50 AUBIO_DEL(filterbank) 54 static int 55 Py_filterbank_init (Py_filterbank * self, PyObject * args, PyObject * kwds) 56 { 57 self->o = new_aubio_filterbank (self->n_filters, self->win_s); 58 if (self->o == NULL) { 59 char_t errstr[30]; 60 sprintf(errstr, "error creating filterbank with n_filters=%d, win_s=%d", 61 self->n_filters, self->win_s); 62 PyErr_SetString (PyExc_StandardError, errstr); 63 return -1; 64 } 65 self->out = new_fvec(self->n_filters); 66 67 return 0; 68 } 69 70 static void 71 Py_filterbank_del (Py_filterbank *self, PyObject *unused) 72 { 73 del_aubio_filterbank(self->o); 74 del_fvec(self->out); 75 self->ob_type->tp_free((PyObject *) self); 76 } 51 77 52 78 static PyObject * … … 55 81 PyObject *input; 56 82 cvec_t *vec; 57 fvec_t *out;58 83 59 84 if (!PyArg_ParseTuple (args, "O", &input)) { … … 67 92 } 68 93 69 out = new_fvec (self->n_filters);70 71 94 // compute the function 72 aubio_filterbank_do (self->o, vec, out);73 return (PyObject *)PyAubio_CFvecToArray( out);95 aubio_filterbank_do (self->o, vec, self->out); 96 return (PyObject *)PyAubio_CFvecToArray(self->out); 74 97 } 75 98
Note: See TracChangeset
for help on using the changeset viewer.