Changeset de81d2b
 Timestamp:
 Apr 18, 2016, 9:07:24 PM (5 years ago)
 Branches:
 feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
 Children:
 7c785e6
 Parents:
 202697a
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

python/ext/pyfft.c
r202697a rde81d2b 3 3 static char Py_fft_doc[] = "fft object"; 4 4 5 AUBIO_DECLARE(fft, uint_t win_s) 5 typedef struct 6 { 7 PyObject_HEAD 8 aubio_fft_t * o; 9 uint_t win_s; 10 cvec_t *out; 11 fvec_t *rout; 12 } Py_fft; 6 13 7 14 //AUBIO_NEW(fft) … … 37 44 } 38 45 46 static int 47 Py_fft_init (Py_fft * self, PyObject * args, PyObject * kwds) 48 { 49 self>o = new_aubio_fft (self>win_s); 50 if (self>o == NULL) { 51 char_t errstr[30]; 52 sprintf(errstr, "error creating fft with win_s=%d", self>win_s); 53 PyErr_SetString (PyExc_StandardError, errstr); 54 return 1; 55 } 56 self>out = new_cvec(self>win_s); 57 self>rout = new_fvec(self>win_s); 39 58 40 AUBIO_INIT(fft, self>win_s) 59 return 0; 60 } 41 61 42 AUBIO_DEL(fft) 62 static void 63 Py_fft_del (Py_fft *self, PyObject *unused) 64 { 65 del_aubio_fft(self>o); 66 del_cvec(self>out); 67 del_fvec(self>rout); 68 self>ob_type>tp_free((PyObject *) self); 69 } 43 70 44 71 static PyObject * 45 Py_fft_do(Py Object * self, PyObject * args)72 Py_fft_do(Py_fft * self, PyObject * args) 46 73 { 47 74 PyObject *input; 48 75 fvec_t *vec; 49 cvec_t *output;50 76 51 77 if (!PyArg_ParseTuple (args, "O", &input)) { … … 59 85 } 60 86 61 output = new_cvec(((Py_fft *) self)>win_s);62 63 87 // compute the function 64 aubio_fft_do (((Py_fft *)self)>o, vec, output);65 return (PyObject *)PyAubio_CCvecToPyCvec( output);88 aubio_fft_do (((Py_fft *)self)>o, vec, self>out); 89 return (PyObject *)PyAubio_CCvecToPyCvec(self>out); 66 90 } 67 91 … … 76 100 PyObject *input; 77 101 cvec_t *vec; 78 fvec_t *output;79 102 80 103 if (!PyArg_ParseTuple (args, "O", &input)) { … … 88 111 } 89 112 90 output = new_fvec(self>win_s);91 92 113 // compute the function 93 aubio_fft_rdo (((Py_fft *)self)>o, vec, output);94 return (PyObject *)PyAubio_CFvecToArray( output);114 aubio_fft_rdo (((Py_fft *)self)>o, vec, self>rout); 115 return (PyObject *)PyAubio_CFvecToArray(self>rout); 95 116 } 96 117
Note: See TracChangeset
for help on using the changeset viewer.