Changeset 9c9cd54 for interfaces
- Timestamp:
- Dec 25, 2009, 5:02:17 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:
- 474f297
- Parents:
- 1a6ef2c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
interfaces/python/gen_pyobject.py
r1a6ef2c r9c9cd54 123 123 } 124 124 125 # aubio to pyaubio 126 aubio2pyaubio = { 127 'fvec_t*': 'fvec_t', 128 'cvec_t*': 'cvec_t', 129 } 130 131 # array to aubio 125 # python to aubio 132 126 aubiovecfrompyobj = { 133 127 'fvec_t*': 'PyAubio_ArrayToCFvec', … … 135 129 } 136 130 137 # aubio to array131 # aubio to python 138 132 aubiovectopyobj = { 139 'fvec_t*': 'PyAubio_FvecToArray',140 'cvec_t*': 'PyAubio_CvecToArray',141 }142 143 aubiovectopyobj_new = {144 133 'fvec_t*': 'PyAubio_CFvecToArray', 145 134 'cvec_t*': 'PyAubio_CCvecToPyCvec', … … 270 259 inputdefs = "\n ".join(["PyObject * " + p[-1] + "_obj;" for p in inputparams]) 271 260 inputvecs = "\n ".join(map(lambda p: \ 272 aubio2pyaubio[p[0]]+" * "+ p[-1] + ";", inputparams))261 p[0] + p[-1] + ";", inputparams)) 273 262 parseinput = "" 274 263 for p in inputparams: … … 290 279 #assert len(outputparams) == 1, \ 291 280 # "too many output parameters" 292 outputvecs = "\n ".join([ aubio2pyaubio[p[0]]+" * "+ p[-1] + ";" for p in outputparams])281 outputvecs = "\n ".join([p[0] + p[-1] + ";" for p in outputparams]) 293 282 outputcreate = "\n ".join(["""\ 294 283 %(name)s = new_%(autype)s (%(length)s);""" % \ 295 {'name': p[-1], 'pytype': aubio2pyaubio[p[0]], 'autype': p[0][:-3],284 {'name': p[-1], 'pytype': p[0], 'autype': p[0][:-3], 296 285 'length': defaultsizes[name]} \ 297 286 for p in outputparams]) … … 299 288 returnval = "PyObject *outputs = PyList_New(0);\n" 300 289 for p in outputparams: 301 returnval += " PyList_Append( outputs, (PyObject *)" + aubiovectopyobj _new[p[0]] + " (" + p[-1] + ")" +");\n"290 returnval += " PyList_Append( outputs, (PyObject *)" + aubiovectopyobj[p[0]] + " (" + p[-1] + ")" +");\n" 302 291 returnval += " return outputs;" 303 292 else: 304 returnval = "return (PyObject *)" + aubiovectopyobj _new[p[0]] + " (" + p[-1] + ")"293 returnval = "return (PyObject *)" + aubiovectopyobj[p[0]] + " (" + p[-1] + ")" 305 294 else: 306 295 # no output … … 308 297 outputcreate = "" 309 298 #returnval = "Py_None"; 310 returnval = "return (PyObject *)" + aubiovectopyobj _new[p[0]] + " (" + p[-1] + ")"299 returnval = "return (PyObject *)" + aubiovectopyobj[p[0]] + " (" + p[-1] + ")" 311 300 # end of output strings 312 301 … … 420 409 "get method has more than one parameter %s" % params 421 410 getter_args = "self->o" 422 returnval = "(PyObject *)" + aubiovectopyobj _new[out_type] + " (tmp)"411 returnval = "(PyObject *)" + aubiovectopyobj[out_type] + " (tmp)" 423 412 shortname = method_name.split(name+'_')[-1] 424 413 method_defs += """\
Note: See TracChangeset
for help on using the changeset viewer.