Changeset 96fe713 for interfaces/python/py-fft.c
- Timestamp:
- Dec 5, 2009, 1:44:11 AM (15 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 0f045b2
- Parents:
- 7a7b00f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
interfaces/python/py-fft.c
r7a7b00f r96fe713 3 3 static char Py_fft_doc[] = "fft object"; 4 4 5 AUBIO_DECLARE(fft, uint_t win_s ; uint_t channels)5 AUBIO_DECLARE(fft, uint_t win_s) 6 6 7 7 //AUBIO_NEW(fft) … … 9 9 Py_fft_new (PyTypeObject * type, PyObject * args, PyObject * kwds) 10 10 { 11 int win_s = 0 , channels = 0;11 int win_s = 0; 12 12 Py_fft *self; 13 static char *kwlist[] = { "win_s", "channels",NULL };13 static char *kwlist[] = { "win_s", NULL }; 14 14 15 if (!PyArg_ParseTupleAndKeywords (args, kwds, "|I I", kwlist,16 &win_s , &channels)) {15 if (!PyArg_ParseTupleAndKeywords (args, kwds, "|I", kwlist, 16 &win_s)) { 17 17 return NULL; 18 18 } … … 25 25 26 26 self->win_s = Py_default_vector_length; 27 self->channels = Py_default_vector_channels;28 27 29 28 if (self == NULL) { … … 39 38 } 40 39 41 if (channels > 0) {42 self->channels = channels;43 } else if (channels < 0) {44 PyErr_SetString (PyExc_ValueError,45 "can not use negative number of filters");46 return NULL;47 }48 49 40 return (PyObject *) self; 50 41 } 51 42 52 43 53 AUBIO_INIT(fft, self->win_s , self->channels)44 AUBIO_INIT(fft, self->win_s) 54 45 55 46 AUBIO_DEL(fft) … … 73 64 74 65 output = (Py_cvec*) PyObject_New (Py_cvec, &Py_cvecType); 75 output->channels = vec->channels;76 66 output->length = ((Py_fft *) self)->win_s; 77 output->o = new_cvec(((Py_fft *) self)->win_s , vec->channels);67 output->o = new_cvec(((Py_fft *) self)->win_s); 78 68 79 69 // compute the function … … 87 77 {"win_s", T_INT, offsetof (Py_fft, win_s), READONLY, 88 78 "size of the window"}, 89 {"channels", T_INT, offsetof (Py_fft, channels), READONLY,90 "number of channels"},91 79 AUBIO_MEMBERS_STOP(fft) 92 80 … … 109 97 110 98 output = (Py_fvec*) PyObject_New (Py_fvec, &Py_fvecType); 111 output->channels = vec->channels;112 99 output->length = ((Py_fft *) self)->win_s; 113 output->o = new_fvec(output->length , output->channels);100 output->o = new_fvec(output->length); 114 101 115 102 // compute the function
Note: See TracChangeset
for help on using the changeset viewer.