History

[py] add filterbank.set_power and set_norm

Paul Brossier committed 7 years ago

Commit 78706cd1 parent 831f7021 file · +50 −0Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/ext/py-filterbank.c+50−0
@@ -265,6 +265,52 @@ Py_filterbank_get_coeffs (Py_filterbank * self, PyObject *unused) · 264 unmodified lines
265 aubio_filterbank_get_coeffs (self->o) );265 aubio_filterbank_get_coeffs (self->o) );
266}266}
267 267
268static PyObject *
269Py_filterbank_set_power(Py_filterbank *self, PyObject *args)
270{
271 uint_t playing;
272
273 if (!PyArg_ParseTuple (args, "I", &playing)) {
274 return NULL;
275 }
276 if(aubio_filterbank_set_power (self->o, playing)) {
277 if (PyErr_Occurred() == NULL) {
278 PyErr_SetString (PyExc_ValueError,
279 "error running filterbank.set_power");
280 } else {
281 // change the RuntimeError into ValueError
282 PyObject *type, *value, *traceback;
283 PyErr_Fetch(&type, &value, &traceback);
284 PyErr_Restore(PyExc_ValueError, value, traceback);
285 }
286 return NULL;
287 }
288 Py_RETURN_NONE;
289}
290
291static PyObject *
292Py_filterbank_set_norm(Py_filterbank *self, PyObject *args)
293{
294 uint_t playing;
295
296 if (!PyArg_ParseTuple (args, "I", &playing)) {
297 return NULL;
298 }
299 if(aubio_filterbank_set_norm (self->o, playing)) {
300 if (PyErr_Occurred() == NULL) {
301 PyErr_SetString (PyExc_ValueError,
302 "error running filterbank.set_power");
303 } else {
304 // change the RuntimeError into ValueError
305 PyObject *type, *value, *traceback;
306 PyErr_Fetch(&type, &value, &traceback);
307 PyErr_Restore(PyExc_ValueError, value, traceback);
308 }
309 return NULL;
310 }
311 Py_RETURN_NONE;
312}
313
268static PyMethodDef Py_filterbank_methods[] = {314static PyMethodDef Py_filterbank_methods[] = {
269 {"set_triangle_bands", (PyCFunction) Py_filterbank_set_triangle_bands,315 {"set_triangle_bands", (PyCFunction) Py_filterbank_set_triangle_bands,
270 METH_VARARGS, "set coefficients of filterbanks"},316 METH_VARARGS, "set coefficients of filterbanks"},
@@ -278,6 +324,10 @@ static PyMethodDef Py_filterbank_methods[] = { · 7 unmodified lines
278 METH_NOARGS, "get coefficients of filterbank"},324 METH_NOARGS, "get coefficients of filterbank"},
279 {"set_coeffs", (PyCFunction) Py_filterbank_set_coeffs,325 {"set_coeffs", (PyCFunction) Py_filterbank_set_coeffs,
280 METH_VARARGS, "set coefficients of filterbank"},326 METH_VARARGS, "set coefficients of filterbank"},
327 {"set_power", (PyCFunction) Py_filterbank_set_power,
328 METH_VARARGS, "set power applied to filterbank input spectrum"},
329 {"set_norm", (PyCFunction) Py_filterbank_set_norm,
330 METH_VARARGS, "set norm applied to filterbank input spectrum"},
281 {NULL}331 {NULL}
282};332};
283 333

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t