History

ext/py-musicutils.c: complete window implementation

Paul Brossier committed 11 years ago

Commit efa62ce1 parent 5e394ec3 files · +22 −8Browse files

Showing the changes to python/ext (2 of 3 files). Show all

Unified · Split

2 files
  1. python/ext/py-musicutils.c +10 −7
  2. python/ext/py-musicutils.h +3 −1
python/ext/py-musicutils.c+10−7
@@ -3,17 +3,20 @@ · 2 unmodified lines
3PyObject *3PyObject *
4Py_aubio_window(PyObject *self, PyObject *args)4Py_aubio_window(PyObject *self, PyObject *args)
5{5{
6 PyObject *output = NULL;
7 char_t *wintype = NULL;6 char_t *wintype = NULL;
8 uint_t winlen = 0;7 uint_t winlen = 0;
9 fvec_t *window;8 fvec_t *window = NULL;
10 9
11 if (!PyArg_ParseTuple (args, "|sd", &wintype, &winlen)) {10 if (!PyArg_ParseTuple (args, "|sI", &wintype, &winlen)) {
12 PyErr_SetString (PyExc_ValueError,11 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
13 "failed parsing arguments");
14 return NULL;12 return NULL;
15 }13 }
16 14
17 //return (PyObject *) PyAubio_CFvecToArray(vec);15 window = new_aubio_window(wintype, winlen);
18 Py_RETURN_NONE;16 if (window == NULL) {
17 PyErr_SetString (PyExc_ValueError, "failed computing window");
18 return NULL;
19 }
20
21 return (PyObject *) PyAubio_CFvecToArray(window);
19}22}
python/ext/py-musicutils.h+3−1
@@ -9,7 +9,9 @@ static char Py_aubio_window_doc[] = "" · 8 unmodified lines
9"Example\n"9"Example\n"
10"-------\n"10"-------\n"
11"\n"11"\n"
12">>> window('hanningz', 1024)";12">>> window('hanningz', 1024)\n"
13"array([ 0.00000000e+00, 9.41753387e-06, 3.76403332e-05, ...,\n"
14" 8.46982002e-05, 3.76403332e-05, 9.41753387e-06], dtype=float32)";
13 15
14PyObject * Py_aubio_window(PyObject *self, PyObject *args);16PyObject * Py_aubio_window(PyObject *self, PyObject *args);
15 17

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