Changeset ad3770f for python


Ignore:
Timestamp:
Sep 15, 2018, 5:31:46 PM (6 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
Children:
8c4918a, c9ca2608
Parents:
87e181d (diff), 3cb2a52 (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.
Message:

Merge branch 'feature/dct_multiopt'

Location:
python
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gen_code.py

    r87e181d rad3770f  
    33    'buf_size': 'Py_default_vector_length',
    44    'win_s': 'Py_default_vector_length',
     5    'size': 'Py_default_vector_length',
    56    # and here too
    67    'hop_size': 'Py_default_vector_length / 2',
     
    8384        'filterbank': 'self->n_filters',
    8485        'tss': 'self->buf_size',
     86        'dct': 'self->size',
    8587        }
    8688
     
    177179        self.do_outputs = get_params_types_names(self.do_proto)[2:]
    178180        struct_output_str = ["PyObject *{0[name]}; {1} c_{0[name]}".format(i, i['type'][:-1]) for i in self.do_outputs]
     181        if len(self.prototypes['rdo']):
     182            rdo_outputs = get_params_types_names(prototypes['rdo'][0])[2:]
     183            struct_output_str += ["PyObject *{0[name]}; {1} c_{0[name]}".format(i, i['type'][:-1]) for i in rdo_outputs]
     184            self.outputs += rdo_outputs
    179185        self.struct_outputs = ";\n    ".join(struct_output_str)
    180186
     
    191197            out += self.gen_del()
    192198            out += self.gen_do()
     199            if len(self.prototypes['rdo']):
     200                self.do_proto = self.prototypes['rdo'][0]
     201                self.do_inputs = [get_params_types_names(self.do_proto)[1]]
     202                self.do_outputs = get_params_types_names(self.do_proto)[2:]
     203                out += self.gen_do(method='rdo')
    193204            out += self.gen_memberdef()
    194205            out += self.gen_set()
     
    371382        return out
    372383
    373     def gen_do(self):
     384    def gen_do(self, method = 'do'):
    374385        out = """
    375386// do {shortname}
    376387static PyObject*
    377 Py_{shortname}_do  (Py_{shortname} * self, PyObject * args)
    378 {{""".format(**self.__dict__)
     388Pyaubio_{shortname}_{method}  (Py_{shortname} * self, PyObject * args)
     389{{""".format(method = method, **self.__dict__)
    379390        input_params = self.do_inputs
    380391        output_params = self.do_outputs
     
    516527  {{"{shortname}", (PyCFunction) Py{name},
    517528    METH_NOARGS, ""}},""".format(name = name, shortname = shortname)
     529        for m in self.prototypes['rdo']:
     530            name = get_name(m)
     531            shortname = name.replace('aubio_%s_' % self.shortname, '')
     532            out += """
     533  {{"{shortname}", (PyCFunction) Py{name},
     534    METH_VARARGS, ""}},""".format(name = name, shortname = shortname)
    518535        out += """
    519536  {NULL} /* sentinel */
     
    541558  0,
    542559  0,
    543   (ternaryfunc)Py_{shortname}_do,
     560  (ternaryfunc)Pyaubio_{shortname}_do,
    544561  0,
    545562  0,
  • python/lib/gen_external.py

    r87e181d rad3770f  
    182182            shortname = o[6:-2]  # without aubio_ prefix and _t suffix
    183183
    184         lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'get': [], 'set': [], 'other': []}
     184        lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'rdo': [], 'get': [], 'set': [], 'other': []}
    185185        lib[shortname]['longname'] = o
    186186        lib[shortname]['shortname'] = shortname
     
    196196                elif '_do' in fn:
    197197                    lib[shortname]['do'].append(fn)
     198                elif '_rdo' in fn:
     199                    lib[shortname]['rdo'].append(fn)
    198200                elif 'new_' in fn:
    199201                    lib[shortname]['new'].append(fn)
Note: See TracChangeset for help on using the changeset viewer.