Changeset 91ce8d5 for interfaces
- Timestamp:
- Dec 25, 2009, 4:52:00 AM (15 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:
- 3e882a8
- Parents:
- 6c50245
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
interfaces/python/gen_pyobject.py
r6c50245 r91ce8d5 125 125 # aubio to pyaubio 126 126 aubio2pyaubio = { 127 'fvec_t*': ' Py_fvec',128 'cvec_t*': ' Py_cvec',127 'fvec_t*': 'fvec_t', 128 'cvec_t*': 'cvec_t', 129 129 } 130 130 131 131 # array to aubio 132 132 aubiovecfrompyobj = { 133 'fvec_t*': 'PyAubio_ArrayTo Fvec',134 'cvec_t*': 'PyAubio_ArrayToC vec',133 'fvec_t*': 'PyAubio_ArrayToCFvec', 134 'cvec_t*': 'PyAubio_ArrayToCCvec', 135 135 } 136 136 … … 143 143 aubiovectopyobj_new = { 144 144 'fvec_t*': 'PyAubio_CFvecToArray', 145 'cvec_t*': 'PyAubio_CCvecTo Array',145 'cvec_t*': 'PyAubio_CCvecToPyCvec', 146 146 'smpl_t': 'PyFloat_FromDouble', 147 147 } … … 292 292 outputvecs = "\n ".join([aubio2pyaubio[p[0]]+" * " + p[-1] + ";" for p in outputparams]) 293 293 outputcreate = "\n ".join(["""\ 294 AUBIO_NEW_VEC(%(name)s, %(pytype)s, %(length)s) 295 %(name)s->o = new_%(autype)s (%(length)s);""" % \ 294 %(name)s = new_%(autype)s (%(length)s);""" % \ 296 295 {'name': p[-1], 'pytype': aubio2pyaubio[p[0]], 'autype': p[0][:-3], 297 296 'length': defaultsizes[name]} \ … … 300 299 returnval = "PyObject *outputs = PyList_New(0);\n" 301 300 for p in outputparams: 302 returnval += " PyList_Append( outputs, (PyObject *)" + aubiovectopyobj [p[0]] + " (" + p[-1] + ")" +");\n"301 returnval += " PyList_Append( outputs, (PyObject *)" + aubiovectopyobj_new[p[0]] + " (" + p[-1] + ")" +");\n" 303 302 returnval += " return outputs;" 304 303 else: 305 returnval = "return (PyObject *)" + aubiovectopyobj [p[0]] + " (" + p[-1] + ")"304 returnval = "return (PyObject *)" + aubiovectopyobj_new[p[0]] + " (" + p[-1] + ")" 306 305 else: 307 306 # no output … … 309 308 outputcreate = "" 310 309 #returnval = "Py_None"; 311 returnval = "return (PyObject *)" + aubiovectopyobj [p[0]] + " (" + p[-1] + ")"310 returnval = "return (PyObject *)" + aubiovectopyobj_new[p[0]] + " (" + p[-1] + ")" 312 311 # end of output strings 313 312 314 313 # build the parameters for the _do() call 315 doparams_string = "self->o, " + ", ".join([p[-1] +"->o"for p in doparams])314 doparams_string = "self->o, " + ", ".join([p[-1] for p in doparams]) 316 315 317 316 # put it all together
Note: See TracChangeset
for help on using the changeset viewer.