Changeset 91ce8d5 for interfaces


Ignore:
Timestamp:
Dec 25, 2009, 4:52:00 AM (15 years ago)
Author:
Paul Brossier <piem@piem.org>
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
Message:

gen_pyobject.py: updated to use proxy functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • interfaces/python/gen_pyobject.py

    r6c50245 r91ce8d5  
    125125# aubio to pyaubio
    126126aubio2pyaubio = {
    127     'fvec_t*': 'Py_fvec',
    128     'cvec_t*': 'Py_cvec',
     127    'fvec_t*': 'fvec_t',
     128    'cvec_t*': 'cvec_t',
    129129}
    130130
    131131# array to aubio
    132132aubiovecfrompyobj = {
    133     'fvec_t*': 'PyAubio_ArrayToFvec',
    134     'cvec_t*': 'PyAubio_ArrayToCvec',
     133    'fvec_t*': 'PyAubio_ArrayToCFvec',
     134    'cvec_t*': 'PyAubio_ArrayToCCvec',
    135135}
    136136
     
    143143aubiovectopyobj_new = {
    144144    'fvec_t*': 'PyAubio_CFvecToArray',
    145     'cvec_t*': 'PyAubio_CCvecToArray',
     145    'cvec_t*': 'PyAubio_CCvecToPyCvec',
    146146    'smpl_t': 'PyFloat_FromDouble',
    147147}
     
    292292        outputvecs = "\n  ".join([aubio2pyaubio[p[0]]+" * " + p[-1] + ";" for p in outputparams])
    293293        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);""" % \
    296295    {'name': p[-1], 'pytype': aubio2pyaubio[p[0]], 'autype': p[0][:-3],
    297296        'length': defaultsizes[name]} \
     
    300299            returnval = "PyObject *outputs = PyList_New(0);\n"
    301300            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"
    303302            returnval += "  return outputs;"
    304303        else:
    305             returnval = "return (PyObject *)" + aubiovectopyobj[p[0]] + " (" + p[-1] + ")"
     304            returnval = "return (PyObject *)" + aubiovectopyobj_new[p[0]] + " (" + p[-1] + ")"
    306305    else:
    307306        # no output
     
    309308        outputcreate = ""
    310309        #returnval = "Py_None";
    311         returnval = "return (PyObject *)" + aubiovectopyobj[p[0]] + " (" + p[-1] + ")"
     310        returnval = "return (PyObject *)" + aubiovectopyobj_new[p[0]] + " (" + p[-1] + ")"
    312311    # end of output strings
    313312
    314313    # 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])
    316315
    317316    # put it all together
Note: See TracChangeset for help on using the changeset viewer.