- Timestamp:
- Sep 15, 2018, 5:31:46 PM (6 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
- 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. - Location:
- python
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_code.py
r87e181d rad3770f 3 3 'buf_size': 'Py_default_vector_length', 4 4 'win_s': 'Py_default_vector_length', 5 'size': 'Py_default_vector_length', 5 6 # and here too 6 7 'hop_size': 'Py_default_vector_length / 2', … … 83 84 'filterbank': 'self->n_filters', 84 85 'tss': 'self->buf_size', 86 'dct': 'self->size', 85 87 } 86 88 … … 177 179 self.do_outputs = get_params_types_names(self.do_proto)[2:] 178 180 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 179 185 self.struct_outputs = ";\n ".join(struct_output_str) 180 186 … … 191 197 out += self.gen_del() 192 198 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') 193 204 out += self.gen_memberdef() 194 205 out += self.gen_set() … … 371 382 return out 372 383 373 def gen_do(self ):384 def gen_do(self, method = 'do'): 374 385 out = """ 375 386 // do {shortname} 376 387 static PyObject* 377 Py _{shortname}_do(Py_{shortname} * self, PyObject * args)378 {{""".format( **self.__dict__)388 Pyaubio_{shortname}_{method} (Py_{shortname} * self, PyObject * args) 389 {{""".format(method = method, **self.__dict__) 379 390 input_params = self.do_inputs 380 391 output_params = self.do_outputs … … 516 527 {{"{shortname}", (PyCFunction) Py{name}, 517 528 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) 518 535 out += """ 519 536 {NULL} /* sentinel */ … … 541 558 0, 542 559 0, 543 (ternaryfunc)Py _{shortname}_do,560 (ternaryfunc)Pyaubio_{shortname}_do, 544 561 0, 545 562 0, -
python/lib/gen_external.py
r87e181d rad3770f 182 182 shortname = o[6:-2] # without aubio_ prefix and _t suffix 183 183 184 lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], ' get': [], 'set': [], 'other': []}184 lib[shortname] = {'struct': [], 'new': [], 'del': [], 'do': [], 'rdo': [], 'get': [], 'set': [], 'other': []} 185 185 lib[shortname]['longname'] = o 186 186 lib[shortname]['shortname'] = shortname … … 196 196 elif '_do' in fn: 197 197 lib[shortname]['do'].append(fn) 198 elif '_rdo' in fn: 199 lib[shortname]['rdo'].append(fn) 198 200 elif 'new_' in fn: 199 201 lib[shortname]['new'].append(fn)
Note: See TracChangeset
for help on using the changeset viewer.