Changeset 09b1777 for interfaces/python
- Timestamp:
- Oct 21, 2009, 3:40:23 PM (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:
- 3ad2ef6
- Parents:
- 1f8e522
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
interfaces/python/gen_pyobject.py
r1f8e522 r09b1777 41 41 'mfcc': ('self->n_coeffs', 'in->channels'), 42 42 'beattracking': ('self->winlen', 'self->channels'), 43 'tempo': (' self->buf_size', 'self->channels'),43 'tempo': ('1', 'self->channels'), 44 44 'peakpicker': ('1', 'self->channels'), 45 45 } … … 147 147 """ % locals() 148 148 for ptype, pname in newparams: 149 defval = aubioinitvalue[ptype]149 initval = aubioinitvalue[ptype] 150 150 s += """\ 151 %(ptype)s %(pname)s = %(defval)s; 152 """ % locals() 151 %(ptype)s %(pname)s = %(initval)s; 152 """ % locals() 153 # now the actual PyArg_Parse 153 154 s += """\ 154 155 Py_%(name)s *self; … … 169 170 for ptype, pname in newparams: 170 171 defval = aubiodefvalue[pname] 171 s += """\ 172 if ptype == 'char_t*': 173 s += """\ 174 175 self->%(pname)s = %(defval)s; 176 if (%(pname)s != NULL) { 177 self->%(pname)s = %(pname)s; 178 } 179 """ % locals() 180 elif ptype == 'uint_t': 181 s += """\ 172 182 173 183 self->%(pname)s = %(defval)s; … … 176 186 } else if (%(pname)s < 0) { 177 187 PyErr_SetString (PyExc_ValueError, 178 "can not use negative window size"); 179 return NULL; 180 } 181 """ % locals() 188 "can not use negative value for %(pname)s"); 189 return NULL; 190 } 191 """ % locals() 192 elif ptype == 'smpl_t': 193 s += """\ 194 195 self->%(pname)s = %(defval)s; 196 if (%(pname)s != %(defval)s) { 197 self->%(pname)s = %(pname)s; 198 } 199 """ % locals() 200 else: 201 print "ERROR, unknown type of parameter %s %s" % (ptype, pname) 182 202 s += """\ 183 203 … … 280 300 AUBIO_MEMBERS_START(%(name)s)""" % locals() 281 301 for param in newparams: 282 s += """ 302 if param[0] == 'char_t*': 303 s += """ 304 {"%(pname)s", T_STRING, offsetof (Py_%(name)s, %(pname)s), READONLY, ""},""" \ 305 % { 'pname': param[1], 'ptype': param[0], 'name': name} 306 elif param[0] == 'uint_t': 307 s += """ 283 308 {"%(pname)s", T_INT, offsetof (Py_%(name)s, %(pname)s), READONLY, ""},""" \ 284 309 % { 'pname': param[1], 'ptype': param[0], 'name': name} 310 else: 311 print "-- ERROR, unknown member type ", param 285 312 s += """ 286 313 AUBIO_MEMBERS_STOP(%(name)s)
Note: See TracChangeset
for help on using the changeset viewer.