Changeset 155cc10 for python/ext/py-filter.c
- Timestamp:
- Mar 10, 2017, 2:26:32 PM (7 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, sampler
- Children:
- ee8a57c
- Parents:
- 00d0275 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-filter.c
r00d0275 r155cc10 6 6 aubio_filter_t * o; 7 7 uint_t order; 8 fvec_t vec; 9 PyObject *out; 10 fvec_t c_out; 8 11 } Py_filter; 9 12 … … 48 51 return -1; 49 52 } 50 53 self->out = NULL; 51 54 return 0; 52 55 } … … 55 58 Py_filter_del (Py_filter * self) 56 59 { 60 Py_XDECREF(self->out); 57 61 del_aubio_filter (self->o); 58 self->ob_type->tp_free ((PyObject *) self);59 } 60 61 static PyObject * 62 Py_TYPE(self)->tp_free ((PyObject *) self); 63 } 64 65 static PyObject * 62 66 Py_filter_do(Py_filter * self, PyObject * args) 63 67 { 64 68 PyObject *input; 65 fvec_t *vec;66 69 67 70 if (!PyArg_ParseTuple (args, "O:digital_filter.do", &input)) { … … 73 76 } 74 77 75 vec = PyAubio_ArrayToCFvec (input); 76 77 if (vec == NULL) { 78 return NULL; 79 } 80 78 if (!PyAubio_ArrayToCFvec(input, &(self->vec))) { 79 return NULL; 80 } 81 82 // initialize output now 83 if (self->out == NULL) { 84 self->out = new_py_fvec(self->vec.length); 85 } 86 87 Py_INCREF(self->out); 88 if (!PyAubio_ArrayToCFvec(self->out, &(self->c_out)) ) { 89 return NULL; 90 } 81 91 // compute the function 82 fvec_t * out = new_fvec(vec->length); 83 aubio_filter_do_outplace (self->o, vec, out); 84 return PyAubio_CFvecToArray(out); 85 } 86 87 static PyObject * 92 aubio_filter_do_outplace (self->o, &(self->vec), &(self->c_out)); 93 return self->out; 94 } 95 96 static PyObject * 88 97 Py_filter_set_c_weighting (Py_filter * self, PyObject *args) 89 98 { … … 103 112 } 104 113 105 static PyObject * 114 static PyObject * 106 115 Py_filter_set_a_weighting (Py_filter * self, PyObject *args) 107 116 { … … 157 166 158 167 PyTypeObject Py_filterType = { 159 PyObject_HEAD_INIT (NULL) 160 0, /* ob_size */ 168 PyVarObject_HEAD_INIT(NULL, 0) 161 169 "aubio.digital_filter", /* tp_name */ 162 170 sizeof (Py_filter), /* tp_basicsize */ … … 196 204 0, /* tp_alloc */ 197 205 Py_filter_new, /* tp_new */ 206 0, 207 0, 208 0, 209 0, 210 0, 211 0, 212 0, 213 0, 214 0, 198 215 };
Note: See TracChangeset
for help on using the changeset viewer.