/* function Py_source_do_multi */ static PyObject * Py_source_do_multi(Py_source * self, PyObject * args) { /* output vectors prototypes */ fmat_t* read_to; uint_t read; /* creating output read_to as a new_fvec of length self->hop_size */ read_to = new_fmat (self->channels, self->hop_size); read = 0; /* compute _do function */ aubio_source_do_multi (self->o, read_to, &read); PyObject *outputs = PyList_New(0); PyList_Append( outputs, (PyObject *)PyAubio_CFmatToArray (read_to)); //del_fvec (read_to); PyList_Append( outputs, (PyObject *)PyLong_FromLong (read)); return outputs; }
void aubio_sampler_do_multi ( aubio_sampler_t * o, fmat_t * input, fmat_t * output) { uint_t read = 0, i, j; if (o->playing) { aubio_source_do_multi (o->source, o->source_output_multi, &read); for (i = 0; i < output->height; i++) { for (j = 0; j < output->length; j++) { output->data[i][j] += o->source_output_multi->data[i][j]; } } if ( read < o->blocksize ) o->playing = 0; } if (input && input != output) { for (i = 0; i < output->height; i++) { for (j = 0; j < output->length; j++) { output->data[i][j] += input->data[i][j]; } } } }
/* function Py_source_do_multi */ static PyObject * Py_source_do_multi(Py_source * self, PyObject * args) { PyObject *outputs; uint_t read; read = 0; Py_INCREF(self->mread_to); if (!PyAubio_ArrayToCFmat(self->mread_to, &(self->c_mread_to))) { return NULL; } /* compute _do function */ aubio_source_do_multi (self->o, &(self->c_mread_to), &read); if (PyErr_Occurred() != NULL) { return NULL; } outputs = PyTuple_New(2); PyTuple_SetItem( outputs, 0, self->mread_to); PyTuple_SetItem( outputs, 1, (PyObject *)PyLong_FromLong(read)); return outputs; }