Changeset f264b17 for python/ext/py-sink.c
- Timestamp:
- Jun 22, 2016, 1:00:10 PM (8 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:
- 4b9443c4
- Parents:
- 60fc05b (diff), 6769586 (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-sink.c
r60fc05b rf264b17 1 #include "aubio wraphell.h"1 #include "aubio-types.h" 2 2 3 3 typedef struct … … 8 8 uint_t samplerate; 9 9 uint_t channels; 10 fvec_t write_data; 11 fmat_t mwrite_data; 10 12 } Py_sink; 11 13 … … 116 118 } 117 119 if (self->o == NULL) { 118 PyErr_SetString (PyExc_ StandardError, "error creating sink with this uri");120 PyErr_SetString (PyExc_RuntimeError, "error creating sink with this uri"); 119 121 return -1; 120 122 } … … 125 127 } 126 128 127 AUBIO_DEL(sink) 129 static void 130 Py_sink_del (Py_sink *self, PyObject *unused) 131 { 132 del_aubio_sink(self->o); 133 free(self->mwrite_data.data); 134 Py_TYPE(self)->tp_free((PyObject *) self); 135 } 128 136 129 137 /* function Py_sink_do */ … … 135 143 136 144 /* input vectors prototypes */ 137 fvec_t* write_data;138 145 uint_t write; 139 146 … … 143 150 } 144 151 145 146 152 /* input vectors parsing */ 147 write_data = PyAubio_ArrayToCFvec (write_data_obj); 148 149 if (write_data == NULL) { 150 return NULL; 151 } 152 153 154 153 if (!PyAubio_ArrayToCFvec(write_data_obj, &(self->write_data))) { 154 return NULL; 155 } 155 156 156 157 157 158 /* compute _do function */ 158 aubio_sink_do (self->o, write_data, write);159 aubio_sink_do (self->o, &(self->write_data), write); 159 160 160 161 Py_RETURN_NONE; … … 169 170 170 171 /* input vectors prototypes */ 171 fmat_t * write_data;172 172 uint_t write; 173 173 … … 179 179 180 180 /* input vectors parsing */ 181 write_data = PyAubio_ArrayToCFmat (write_data_obj); 182 183 if (write_data == NULL) { 184 return NULL; 185 } 186 187 188 189 181 if (!PyAubio_ArrayToCFmat(write_data_obj, &(self->mwrite_data))) { 182 return NULL; 183 } 190 184 191 185 /* compute _do function */ 192 aubio_sink_do_multi (self->o, write_data, write);186 aubio_sink_do_multi (self->o, &(self->mwrite_data), write); 193 187 Py_RETURN_NONE; 194 188 } 195 189 196 AUBIO_MEMBERS_START(sink) 190 static PyMemberDef Py_sink_members[] = { 197 191 {"uri", T_STRING, offsetof (Py_sink, uri), READONLY, 198 192 "path at which the sink was created"}, … … 201 195 {"channels", T_INT, offsetof (Py_sink, channels), READONLY, 202 196 "number of channels with which the sink was created"}, 203 AUBIO_MEMBERS_STOP(sink) 197 { NULL } // sentinel 198 }; 204 199 205 200 static PyObject * … … 217 212 }; 218 213 219 AUBIO_TYPEOBJECT(sink, "aubio.sink") 214 PyTypeObject Py_sinkType = { 215 PyVarObject_HEAD_INIT (NULL, 0) 216 "aubio.sink", 217 sizeof (Py_sink), 218 0, 219 (destructor) Py_sink_del, 220 0, 221 0, 222 0, 223 0, 224 0, 225 0, 226 0, 227 0, 228 0, 229 (ternaryfunc)Py_sink_do, 230 0, 231 0, 232 0, 233 0, 234 Py_TPFLAGS_DEFAULT, 235 Py_sink_doc, 236 0, 237 0, 238 0, 239 0, 240 0, 241 0, 242 Py_sink_methods, 243 Py_sink_members, 244 0, 245 0, 246 0, 247 0, 248 0, 249 0, 250 (initproc) Py_sink_init, 251 0, 252 Py_sink_new, 253 0, 254 0, 255 0, 256 0, 257 0, 258 0, 259 0, 260 0, 261 0, 262 };
Note: See TracChangeset
for help on using the changeset viewer.