| @@ -2,6 +2,7 @@ aubiodefvalue = { · 1 unmodified line |
| 2 | # we have some clean up to do | 2 | # we have some clean up to do |
| 3 | 'buf_size': 'Py_default_vector_length', | 3 | 'buf_size': 'Py_default_vector_length', |
| 4 | 'win_s': 'Py_default_vector_length', | 4 | 'win_s': 'Py_default_vector_length', |
| | 5 | 'size': 'Py_default_vector_length', |
| 5 | # and here too | 6 | # and here too |
| 6 | 'hop_size': 'Py_default_vector_length / 2', | 7 | 'hop_size': 'Py_default_vector_length / 2', |
| 7 | 'hop_s': 'Py_default_vector_length / 2', | 8 | 'hop_s': 'Py_default_vector_length / 2', |
| @@ -82,6 +83,7 @@ objoutsize = { · 74 unmodified lines |
| 82 | 'tempo': '1', | 83 | 'tempo': '1', |
| 83 | 'filterbank': 'self->n_filters', | 84 | 'filterbank': 'self->n_filters', |
| 84 | 'tss': 'self->buf_size', | 85 | 'tss': 'self->buf_size', |
| | 86 | 'dct': 'self->size', |
| 85 | } | 87 | } |
| 86 | | 88 | |
| 87 | objinputsize = { | 89 | objinputsize = { |
| @@ -176,6 +178,10 @@ class MappedObject(object): · 88 unmodified lines |
| 176 | self.do_inputs = [get_params_types_names(self.do_proto)[1]] | 178 | self.do_inputs = [get_params_types_names(self.do_proto)[1]] |
| 177 | self.do_outputs = get_params_types_names(self.do_proto)[2:] | 179 | self.do_outputs = get_params_types_names(self.do_proto)[2:] |
| 178 | struct_output_str = ["PyObject *{0[name]}; {1} c_{0[name]}".format(i, i['type'][:-1]) for i in self.do_outputs] | 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 | self.struct_outputs = ";\n ".join(struct_output_str) | 185 | self.struct_outputs = ";\n ".join(struct_output_str) |
| 180 | | 186 | |
| 181 | #print ("input_params: ", map(split_type, get_input_params(self.do_proto))) | 187 | #print ("input_params: ", map(split_type, get_input_params(self.do_proto))) |
| @@ -190,6 +196,11 @@ class MappedObject(object): · 8 unmodified lines |
| 190 | out += self.gen_init() | 196 | out += self.gen_init() |
| 191 | out += self.gen_del() | 197 | out += self.gen_del() |
| 192 | out += self.gen_do() | 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 | out += self.gen_memberdef() | 204 | out += self.gen_memberdef() |
| 194 | out += self.gen_set() | 205 | out += self.gen_set() |
| 195 | out += self.gen_get() | 206 | out += self.gen_get() |
| @@ -370,12 +381,12 @@ Py_{shortname}_del (Py_{shortname} * self, PyObject * unused) · 174 unmodified lines |
| 370 | """.format(del_fn = del_fn) | 381 | """.format(del_fn = del_fn) |
| 371 | return out | 382 | return out |
| 372 | | 383 | |
| 373 | def gen_do(self): | 384 | def gen_do(self, method = 'do'): |
| 374 | out = """ | 385 | out = """ |
| 375 | // do {shortname} | 386 | // do {shortname} |
| 376 | static PyObject* | 387 | static PyObject* |
| 377 | Py_{shortname}_do (Py_{shortname} * self, PyObject * args) | 388 | Pyaubio_{shortname}_{method} (Py_{shortname} * self, PyObject * args) |
| 378 | {{""".format(**self.__dict__) | 389 | {{""".format(method = method, **self.__dict__) |
| 379 | input_params = self.do_inputs | 390 | input_params = self.do_inputs |
| 380 | output_params = self.do_outputs | 391 | output_params = self.do_outputs |
| 381 | #print input_params | 392 | #print input_params |
| @@ -515,6 +526,12 @@ static PyMethodDef Py_{shortname}_methods[] = {{""".format(**self.__dict__) · 133 unmodified lines |
| 515 | out += """ | 526 | out += """ |
| 516 | {{"{shortname}", (PyCFunction) Py{name}, | 527 | {{"{shortname}", (PyCFunction) Py{name}, |
| 517 | METH_NOARGS, ""}},""".format(name = name, shortname = shortname) | 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 | out += """ | 535 | out += """ |
| 519 | {NULL} /* sentinel */ | 536 | {NULL} /* sentinel */ |
| 520 | }; | 537 | }; |
| @@ -540,7 +557,7 @@ PyTypeObject Py_{shortname}Type = {{ · 19 unmodified lines |
| 540 | 0, | 557 | 0, |
| 541 | 0, | 558 | 0, |
| 542 | 0, | 559 | 0, |
| 543 | (ternaryfunc)Py_{shortname}_do, | 560 | (ternaryfunc)Pyaubio_{shortname}_do, |
| 544 | 0, | 561 | 0, |
| 545 | 0, | 562 | 0, |
| 546 | 0, | 563 | 0, |