Changeset ce4bfe3 for interfaces/python/aubiomodule.c
- Timestamp:
- Dec 25, 2009, 4:49:14 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:
- 7d9ec37
- Parents:
- 363ce7a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
interfaces/python/aubiomodule.c
r363ce7a rce4bfe3 12 12 { 13 13 PyObject *input; 14 Py_fvec*vec;14 fvec_t *vec; 15 15 smpl_t alpha; 16 16 PyObject *result; … … 24 24 } 25 25 26 vec = PyAubio_ArrayTo Fvec (input);26 vec = PyAubio_ArrayToCFvec (input); 27 27 28 28 if (vec == NULL) { … … 31 31 32 32 // compute the function 33 result = Py_BuildValue ("f", fvec_alpha_norm (vec ->o, alpha));33 result = Py_BuildValue ("f", fvec_alpha_norm (vec, alpha)); 34 34 if (result == NULL) { 35 35 return NULL; … … 45 45 { 46 46 PyObject *input; 47 Py_fvec*vec;47 fvec_t *vec; 48 48 PyObject *result; 49 49 … … 56 56 } 57 57 58 vec = PyAubio_ArrayTo Fvec (input);58 vec = PyAubio_ArrayToCFvec (input); 59 59 60 60 if (vec == NULL) { … … 63 63 64 64 // compute the function 65 result = Py_BuildValue ("f", aubio_zero_crossing_rate (vec ->o));65 result = Py_BuildValue ("f", aubio_zero_crossing_rate (vec)); 66 66 if (result == NULL) { 67 67 return NULL; … … 73 73 static char Py_min_removal_doc[] = "compute zero crossing rate"; 74 74 75 static PyObject * 75 static PyObject * 76 76 Py_min_removal(PyObject * self, PyObject * args) 77 77 { 78 78 PyObject *input; 79 Py_fvec*vec;79 fvec_t *vec; 80 80 81 81 if (!PyArg_ParseTuple (args, "O:min_removal", &input)) { … … 87 87 } 88 88 89 vec = PyAubio_ArrayTo Fvec (input);89 vec = PyAubio_ArrayToCFvec (input); 90 90 91 91 if (vec == NULL) { … … 94 94 95 95 // compute the function 96 fvec_min_removal (vec ->o);96 fvec_min_removal (vec); 97 97 98 98 // since this function does not return, we could return None 99 99 //return Py_None; 100 // however it is convenient to return the modified vector 101 return (PyObject *) PyAubio_ FvecToArray(vec);100 // however it is convenient to return the modified vector 101 return (PyObject *) PyAubio_CFvecToArray(vec); 102 102 // or even without converting it back to an array 103 103 //Py_INCREF(vec); … … 107 107 static PyMethodDef aubio_methods[] = { 108 108 {"alpha_norm", Py_alpha_norm, METH_VARARGS, Py_alpha_norm_doc}, 109 {"zero_crossing_rate", Py_zero_crossing_rate, METH_VARARGS, 109 {"zero_crossing_rate", Py_zero_crossing_rate, METH_VARARGS, 110 110 Py_zero_crossing_rate_doc}, 111 111 {"min_removal", Py_min_removal, METH_VARARGS, Py_min_removal_doc}, … … 121 121 int err; 122 122 123 if ((PyType_Ready (&Py_fvecType) < 0) 124 || (PyType_Ready (&Py_fmatType) < 0) 125 || (PyType_Ready (&Py_cvecType) < 0) 126 || (PyType_Ready (&Py_filterType) < 0) 127 || (PyType_Ready (&Py_filterbankType) < 0) 128 || (PyType_Ready (&Py_fftType) < 0) 129 || (PyType_Ready (&Py_pvocType) < 0) 123 if ( (PyType_Ready (&Py_cvecType) < 0) 124 || (PyType_Ready (&Py_filterType) < 0) 125 || (PyType_Ready (&Py_filterbankType) < 0) 126 || (PyType_Ready (&Py_fftType) < 0) 127 || (PyType_Ready (&Py_pvocType) < 0) 130 128 // generated objects 131 129 || (generated_types_ready() < 0 ) … … 147 145 } 148 146 149 Py_INCREF (&Py_fvecType);150 PyModule_AddObject (m, "fvec", (PyObject *) & Py_fvecType);151 Py_INCREF (&Py_fmatType);152 PyModule_AddObject (m, "fmat", (PyObject *) & Py_fmatType);153 147 Py_INCREF (&Py_cvecType); 154 148 PyModule_AddObject (m, "cvec", (PyObject *) & Py_cvecType);
Note: See TracChangeset
for help on using the changeset viewer.