static int
Py_cvec_set_norm (Py_cvec * vec, PyObject *input, void * closure)
{
+ npy_intp length;
if (!PyAubio_IsValidVector(input)) {
return 1;
}
- npy_intp length = PyArray_SIZE ((PyArrayObject *)input);
+ length = PyArray_SIZE ((PyArrayObject *)input);
if (length != vec->length) {
PyErr_Format (PyExc_ValueError,
"input array has length %ld, but cvec has length %d", length,
static int
Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure)
{
+ npy_intp length;
if (!PyAubio_IsValidVector(input)) {
return 1;
}
- npy_intp length = PyArray_SIZE ((PyArrayObject *)input);
+ length = PyArray_SIZE ((PyArrayObject *)input);
if (length != vec->length) {
PyErr_Format (PyExc_ValueError,
"input array has length %ld, but cvec has length %d", length,
Py_fft_do(Py_fft * self, PyObject * args)
{
PyObject *input;
+ cvec_t c_out;
if (!PyArg_ParseTuple (args, "O", &input)) {
return NULL;
return NULL;
}
- cvec_t c_out;
Py_INCREF(self->doout);
if (!PyAubio_PyCvecToCCvec(self->doout, &c_out)) {
return NULL;
Py_fft_rdo(Py_fft * self, PyObject * args)
{
PyObject *input;
+ fvec_t out;
if (!PyArg_ParseTuple (args, "O", &input)) {
return NULL;
return NULL;
}
- fvec_t out;
Py_INCREF(self->rdoout);
if (!PyAubio_ArrayToCFvec(self->rdoout, &out) ) {
return NULL;
static PyObject *
Py_source_do(Py_source * self, PyObject * args)
{
+ PyObject *outputs;
uint_t read;
read = 0;
/* compute _do function */
aubio_source_do (self->o, &(self->c_read_to), &read);
- PyObject *outputs = PyTuple_New(2);
+ outputs = PyTuple_New(2);
PyTuple_SetItem( outputs, 0, self->read_to );
PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read));
return outputs;
static PyObject *
Py_source_do_multi(Py_source * self, PyObject * args)
{
+ PyObject *outputs;
uint_t read;
read = 0;
/* compute _do function */
aubio_source_do_multi (self->o, &(self->c_mread_to), &read);
- PyObject *outputs = PyTuple_New(2);
+ outputs = PyTuple_New(2);
PyTuple_SetItem( outputs, 0, self->mread_to);
PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read));
return outputs;
void add_ufuncs ( PyObject *m )
{
int err = 0;
+ PyObject *dict, *f, *g, *h;
err = _import_umath ();
if (err != 0) {
"Unable to import Numpy umath from aubio module (error %d)\n", err);
}
- PyObject *f, *dict;
dict = PyModule_GetDict(m);
f = PyUFunc_FromFuncAndData(Py_aubio_unary_functions, Py_unwrap2pi_data, Py_aubio_unary_types,
Py_aubio_unary_n_types, Py_aubio_unary_n_inputs, Py_aubio_unary_n_outputs,
PyDict_SetItemString(dict, "unwrap2pi", f);
Py_DECREF(f);
- PyObject *g;
g = PyUFunc_FromFuncAndData(Py_aubio_unary_functions, Py_freqtomidi_data, Py_aubio_unary_types,
Py_aubio_unary_n_types, Py_aubio_unary_n_inputs, Py_aubio_unary_n_outputs,
PyUFunc_None, "freqtomidi", Py_freqtomidi_doc, 0);
PyDict_SetItemString(dict, "freqtomidi", g);
Py_DECREF(g);
- PyObject *h;
h = PyUFunc_FromFuncAndData(Py_aubio_unary_functions, Py_miditofreq_data, Py_aubio_unary_types,
Py_aubio_unary_n_types, Py_aubio_unary_n_inputs, Py_aubio_unary_n_outputs,
PyUFunc_None, "miditofreq", Py_miditofreq_doc, 0);