#define AUBIO_TYPEOBJECT(NAME, PYNAME) \
PyTypeObject Py_ ## NAME ## Type = { \
- PyObject_HEAD_INIT (NULL) \
- 0, \
+ PyVarObject_HEAD_INIT (NULL, 0) \
PYNAME, \
sizeof (Py_ ## NAME), \
0, \
PyObject *args = NULL;
PyObject *result = NULL;
- format = PyString_FromString ("aubio cvec of %d elements");
+ format = PyUnicode_FromString ("aubio cvec of %d elements");
if (format == NULL) {
goto fail;
}
}
cvec_print ( self->o );
- result = PyString_Format (format, args);
+ result = PyUnicode_Format (format, args);
fail:
Py_XDECREF (format);
};
PyTypeObject Py_cvecType = {
- PyObject_HEAD_INIT (NULL)
- 0, /* ob_size */
+ PyVarObject_HEAD_INIT(NULL, 0)
"aubio.cvec", /* tp_name */
sizeof (Py_cvec), /* tp_basicsize */
0, /* tp_itemsize */
if (self->o == NULL) {
char_t errstr[30];
sprintf(errstr, "error creating fft with win_s=%d", self->win_s);
- PyErr_SetString (PyExc_StandardError, errstr);
+ PyErr_SetString (PyExc_Exception, errstr);
return -1;
}
self->out = new_cvec(self->win_s);
del_aubio_fft(self->o);
del_cvec(self->out);
del_fvec(self->rout);
- self->ob_type->tp_free((PyObject *) self);
+ Py_TYPE(self)->tp_free((PyObject *) self);
}
static PyObject *
};
PyTypeObject Py_filterType = {
- PyObject_HEAD_INIT (NULL)
- 0, /* ob_size */
+ PyVarObject_HEAD_INIT(NULL, 0)
"aubio.digital_filter", /* tp_name */
sizeof (Py_filter), /* tp_basicsize */
0, /* tp_itemsize */
char_t errstr[30];
sprintf(errstr, "error creating filterbank with n_filters=%d, win_s=%d",
self->n_filters, self->win_s);
- PyErr_SetString (PyExc_StandardError, errstr);
+ PyErr_SetString (PyExc_RuntimeError, errstr);
return -1;
}
self->out = new_fvec(self->n_filters);
{
del_aubio_filterbank(self->o);
del_fvec(self->out);
- self->ob_type->tp_free((PyObject *) self);
+ Py_TYPE(self)->tp_free((PyObject *) self);
}
static PyObject *
del_aubio_pvoc(self->o);
del_cvec(self->output);
del_fvec(self->routput);
- self->ob_type->tp_free((PyObject *) self);
+ Py_TYPE(self)->tp_free((PyObject *) self);
}
del_aubio_source(self->o);
del_fvec(self->read_to);
del_fmat(self->mread_to);
- self->ob_type->tp_free((PyObject *) self);
+ Py_TYPE(self)->tp_free((PyObject *) self);
}
PyObject *outputs = PyList_New(0);
PyList_Append( outputs, (PyObject *)PyAubio_CFvecToArray (self->read_to));
- PyList_Append( outputs, (PyObject *)PyInt_FromLong (read));
+ PyList_Append( outputs, (PyObject *)PyLong_FromLong(read));
return outputs;
}
PyObject *outputs = PyList_New(0);
PyList_Append( outputs, (PyObject *)PyAubio_CFmatToArray (self->mread_to));
- PyList_Append( outputs, (PyObject *)PyInt_FromLong (read));
+ PyList_Append( outputs, (PyObject *)PyLong_FromLong(read));
return outputs;
}
Pyaubio_source_get_samplerate (Py_source *self, PyObject *unused)
{
uint_t tmp = aubio_source_get_samplerate (self->o);
- return (PyObject *)PyInt_FromLong (tmp);
+ return (PyObject *)PyLong_FromLong (tmp);
}
static PyObject *
Pyaubio_source_get_channels (Py_source *self, PyObject *unused)
{
uint_t tmp = aubio_source_get_channels (self->o);
- return (PyObject *)PyInt_FromLong (tmp);
+ return (PyObject *)PyLong_FromLong (tmp);
}
static PyObject *