Changeset 195e22e4
- Timestamp:
- Nov 17, 2018, 3:03:08 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:
- da01353
- Parents:
- 11c899b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_code.py
r11c899b r195e22e4 463 463 """.format(**self.__dict__) 464 464 for set_param in self.prototypes['set']: 465 params = get_params_types_names(set_param)[1] 466 paramtype = params['type'] 465 params = get_params_types_names(set_param)[1:] 466 param = self.shortname.split('_set_')[-1] 467 paramdecls = "".join([""" 468 {0} {1};""".format(p['type'], p['name']) for p in params]) 467 469 method_name = get_name(set_param) 468 470 param = method_name.split('aubio_'+self.shortname+'_set_')[-1] 469 pyparamtype = pyargparse_chars[paramtype] 471 refs = ", ".join(["&%s" % p['name'] for p in params]) 472 paramlist = ", ".join(["%s" % p['name'] for p in params]) 473 pyparamtypes = ''.join([pyargparse_chars[p['type']] for p in params]) 470 474 out += """ 471 475 static PyObject * … … 473 477 {{ 474 478 uint_t err = 0; 475 {param type} {param};476 477 if (!PyArg_ParseTuple (args, "{pyparamtype }", &{param})) {{479 {paramdecls} 480 481 if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{ 478 482 return NULL; 479 483 }} 480 err = aubio_{shortname}_set_{param} (self->o, {param });484 err = aubio_{shortname}_set_{param} (self->o, {paramlist}); 481 485 482 486 if (err > 0) {{ … … 493 497 Py_RETURN_NONE; 494 498 }} 495 """.format(param = param, paramtype = paramtype, pyparamtype = pyparamtype, **self.__dict__) 499 """.format(param = param, refs = refs, paramdecls = paramdecls, 500 pyparamtypes = pyparamtypes, paramlist = paramlist, **self.__dict__) 496 501 return out 497 502
Note: See TracChangeset
for help on using the changeset viewer.