Changeset 1164bcdf
- Timestamp:
- Feb 23, 2014, 8:13:43 PM (11 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:
- 31a5c405
- Parents:
- 4a1378c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-source.c
r4a1378c r1164bcdf 7 7 char_t* uri; 8 8 uint_t samplerate; 9 uint_t channels; 9 10 uint_t hop_size; 10 11 } Py_source; … … 67 68 } 68 69 self->samplerate = aubio_source_get_samplerate ( self->o ); 70 self->channels = aubio_source_get_channels ( self->o ); 69 71 70 72 return 0; … … 74 76 75 77 /* function Py_source_do */ 76 static PyObject * 78 static PyObject * 77 79 Py_source_do(Py_source * self, PyObject * args) 78 80 { … … 87 89 88 90 89 91 90 92 /* creating output read_to as a new_fvec of length self->hop_size */ 91 93 read_to = new_fvec (self->hop_size); … … 103 105 } 104 106 107 /* function Py_source_do_multi */ 108 static PyObject * 109 Py_source_do_multi(Py_source * self, PyObject * args) 110 { 111 112 113 /* output vectors prototypes */ 114 fmat_t* read_to; 115 uint_t read; 116 117 118 119 120 121 122 /* creating output read_to as a new_fvec of length self->hop_size */ 123 read_to = new_fmat (self->channels, self->hop_size); 124 read = 0; 125 126 127 /* compute _do function */ 128 aubio_source_do_multi (self->o, read_to, &read); 129 130 PyObject *outputs = PyList_New(0); 131 PyList_Append( outputs, (PyObject *)PyAubio_CFmatToArray (read_to)); 132 //del_fvec (read_to); 133 PyList_Append( outputs, (PyObject *)PyInt_FromLong (read)); 134 return outputs; 135 } 136 105 137 AUBIO_MEMBERS_START(source) 106 138 {"uri", T_STRING, offsetof (Py_source, uri), READONLY, ""}, 107 139 {"samplerate", T_INT, offsetof (Py_source, samplerate), READONLY, ""}, 140 {"channels", T_INT, offsetof (Py_source, channels), READONLY, ""}, 108 141 {"hop_size", T_INT, offsetof (Py_source, hop_size), READONLY, ""}, 109 142 AUBIO_MEMBERS_STOP(source) … … 136 169 {"get_channels", (PyCFunction) Pyaubio_source_get_channels, 137 170 METH_NOARGS, ""}, 171 {"do_multi", (PyCFunction) Py_source_do_multi, 172 METH_NOARGS, ""}, 138 173 {"close", (PyCFunction) Pyaubio_source_close, 139 174 METH_NOARGS, ""},
Note: See TracChangeset
for help on using the changeset viewer.