Changeset 1ee5e21
- Timestamp:
- Apr 29, 2016, 9:37:46 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:
- 307fdfc
- Parents:
- ede5d38
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-source.c
rede5d38 r1ee5e21 10 10 uint_t hop_size; 11 11 uint_t duration; 12 fvec_t *read_to; 13 fmat_t *mread_to; 12 PyObject *read_to; 13 fvec_t c_read_to; 14 PyObject *mread_to; 15 fmat_t c_mread_to; 14 16 } Py_source; 15 17 … … 150 152 self->duration = aubio_source_get_duration ( self->o ); 151 153 152 self->read_to = new_ fvec(self->hop_size);153 self->mread_to = new_ fmat(self->channels, self->hop_size);154 self->read_to = new_py_fvec(self->hop_size); 155 self->mread_to = new_py_fmat(self->channels, self->hop_size); 154 156 155 157 return 0; … … 160 162 { 161 163 del_aubio_source(self->o); 162 del_fvec(self->read_to); 163 del_fmat(self->mread_to); 164 //del_fvec(self->read_to); 165 Py_XDECREF(self->read_to); 166 Py_XDECREF(self->mread_to); 164 167 Py_TYPE(self)->tp_free((PyObject *) self); 165 168 } … … 170 173 Py_source_do(Py_source * self, PyObject * args) 171 174 { 172 173 174 /* output vectors prototypes */175 175 uint_t read; 176 177 178 179 180 181 182 /* creating output read_to as a new_fvec of length self->hop_size */183 176 read = 0; 184 177 185 178 Py_INCREF(self->read_to); 179 if (!PyAubio_ArrayToCFvec(self->read_to, &(self->c_read_to))) { 180 return NULL; 181 } 186 182 /* compute _do function */ 187 aubio_source_do (self->o, self->read_to, &read);183 aubio_source_do (self->o, &(self->c_read_to), &read); 188 184 189 185 PyObject *outputs = PyTuple_New(2); 190 PyTuple_SetItem( outputs, 0, (PyObject *)PyAubio_CFvecToArray (self->read_to));186 PyTuple_SetItem( outputs, 0, self->read_to ); 191 187 PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read)); 192 188 return outputs; … … 197 193 Py_source_do_multi(Py_source * self, PyObject * args) 198 194 { 199 200 201 /* output vectors prototypes */202 195 uint_t read; 203 204 205 206 207 208 209 /* creating output mread_to as a new_fvec of length self->hop_size */210 196 read = 0; 211 197 212 198 Py_INCREF(self->mread_to); 199 if (!PyAubio_ArrayToCFmat(self->mread_to, &(self->c_mread_to))) { 200 return NULL; 201 } 213 202 /* compute _do function */ 214 aubio_source_do_multi (self->o, self->mread_to, &read);203 aubio_source_do_multi (self->o, &(self->c_mread_to), &read); 215 204 216 205 PyObject *outputs = PyTuple_New(2); 217 PyTuple_SetItem( outputs, 0, (PyObject *)PyAubio_CFmatToArray (self->mread_to));206 PyTuple_SetItem( outputs, 0, self->mread_to); 218 207 PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read)); 219 208 return outputs;
Note: See TracChangeset
for help on using the changeset viewer.