static int Py_sink_init (Py_sink * self, PyObject * args, PyObject * kwds) { if (self->channels == 1) { self->o = new_aubio_sink ( self->uri, self->samplerate ); } else { self->o = new_aubio_sink ( self->uri, 0 ); aubio_sink_preset_channels ( self->o, self->channels ); aubio_sink_preset_samplerate ( self->o, self->samplerate ); } if (self->o == NULL) { PyErr_SetString (PyExc_StandardError, "error creating sink with this uri"); return -1; } self->samplerate = aubio_sink_get_samplerate ( self->o ); self->channels = aubio_sink_get_channels ( self->o ); return 0; }
static int Py_sink_init (Py_sink * self, PyObject * args, PyObject * kwds) { self->o = new_aubio_sink ( self->uri, 0 ); if (self->o == NULL) { // error string was set in new_aubio_sink return -1; } if (aubio_sink_preset_channels(self->o, self->channels) != 0) { // error string was set in aubio_sink_preset_channels return -1; } if (aubio_sink_preset_samplerate(self->o, self->samplerate) != 0) { // error string was set in aubio_sink_preset_samplerate return -1; } self->samplerate = aubio_sink_get_samplerate ( self->o ); self->channels = aubio_sink_get_channels ( self->o ); return 0; }