Chris@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@26
|
3 /*
|
Chris@26
|
4 VampyHost
|
Chris@26
|
5
|
Chris@26
|
6 Use Vamp audio analysis plugins in Python
|
Chris@26
|
7
|
Chris@26
|
8 Gyorgy Fazekas and Chris Cannam
|
Chris@26
|
9 Centre for Digital Music, Queen Mary, University of London
|
Chris@117
|
10 Copyright 2008-2015 Queen Mary, University of London
|
Chris@26
|
11
|
Chris@26
|
12 Permission is hereby granted, free of charge, to any person
|
Chris@26
|
13 obtaining a copy of this software and associated documentation
|
Chris@26
|
14 files (the "Software"), to deal in the Software without
|
Chris@26
|
15 restriction, including without limitation the rights to use, copy,
|
Chris@26
|
16 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@26
|
17 of the Software, and to permit persons to whom the Software is
|
Chris@26
|
18 furnished to do so, subject to the following conditions:
|
Chris@26
|
19
|
Chris@26
|
20 The above copyright notice and this permission notice shall be
|
Chris@26
|
21 included in all copies or substantial portions of the Software.
|
Chris@26
|
22
|
Chris@26
|
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@26
|
24 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@26
|
25 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@26
|
26 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
Chris@26
|
27 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@26
|
28 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@26
|
29 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@26
|
30
|
Chris@26
|
31 Except as contained in this notice, the names of the Centre for
|
Chris@26
|
32 Digital Music; Queen Mary, University of London; and the authors
|
Chris@26
|
33 shall not be used in advertising or otherwise to promote the sale,
|
Chris@26
|
34 use or other dealings in this Software without prior written
|
Chris@26
|
35 authorization.
|
Chris@26
|
36 */
|
Chris@26
|
37
|
Chris@31
|
38 #include "PyPluginObject.h"
|
Chris@14
|
39
|
Chris@14
|
40 // define a unique API pointer
|
Chris@27
|
41 #define PY_ARRAY_UNIQUE_SYMBOL VAMPYHOST_ARRAY_API
|
Chris@14
|
42 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
Chris@31
|
43 #define NO_IMPORT_ARRAY
|
Chris@14
|
44 #include "numpy/arrayobject.h"
|
Chris@14
|
45
|
Chris@102
|
46 #if PY_MAJOR_VERSION < 3
|
Chris@102
|
47 #include "intobject.h"
|
Chris@102
|
48 #endif
|
Chris@102
|
49
|
Chris@33
|
50 #include "structmember.h"
|
Chris@33
|
51
|
Chris@48
|
52 #include "FloatConversion.h"
|
Chris@29
|
53 #include "VectorConversion.h"
|
Chris@112
|
54 #include "StringConversion.h"
|
Chris@16
|
55 #include "PyRealTime.h"
|
Chris@0
|
56
|
Chris@0
|
57 #include <string>
|
Chris@31
|
58 #include <vector>
|
Chris@33
|
59 #include <cstddef>
|
Chris@49
|
60 #include <set>
|
Chris@0
|
61
|
Chris@0
|
62 using namespace std;
|
Chris@0
|
63 using namespace Vamp;
|
Chris@0
|
64
|
Chris@31
|
65 static
|
Chris@21
|
66 PyPluginObject *
|
Chris@21
|
67 getPluginObject(PyObject *pyPluginHandle)
|
Chris@21
|
68 {
|
Chris@21
|
69 PyPluginObject *pd = 0;
|
Chris@21
|
70 if (PyPlugin_Check(pyPluginHandle)) {
|
Chris@21
|
71 pd = (PyPluginObject *)pyPluginHandle;
|
Chris@16
|
72 }
|
Chris@16
|
73 if (!pd || !pd->plugin) {
|
Chris@16
|
74 PyErr_SetString(PyExc_AttributeError,
|
Chris@39
|
75 "Invalid or already deleted plugin handle.");
|
Chris@16
|
76 return 0;
|
Chris@0
|
77 } else {
|
Chris@16
|
78 return pd;
|
Chris@0
|
79 }
|
Chris@0
|
80 }
|
Chris@0
|
81
|
Chris@134
|
82 static int
|
Chris@134
|
83 setint(PyObject *d, const char *name, int value)
|
Chris@134
|
84 {
|
Chris@134
|
85 PyObject *v;
|
Chris@134
|
86 int err;
|
Chris@134
|
87 #if (PY_MAJOR_VERSION >= 3)
|
Chris@134
|
88 v = PyLong_FromLong((long)value);
|
Chris@134
|
89 #else
|
Chris@134
|
90 v = PyInt_FromLong((long)value);
|
Chris@134
|
91 #endif
|
Chris@134
|
92 err = PyDict_SetItemString(d, name, v);
|
Chris@134
|
93 Py_XDECREF(v);
|
Chris@134
|
94 return err;
|
Chris@134
|
95 }
|
Chris@134
|
96
|
Chris@134
|
97 static int
|
Chris@134
|
98 setfloat(PyObject *d, const char *name, double value)
|
Chris@134
|
99 {
|
Chris@134
|
100 PyObject *v;
|
Chris@134
|
101 int err;
|
Chris@134
|
102 v = PyFloat_FromDouble(value);
|
Chris@134
|
103 err = PyDict_SetItemString(d, name, v);
|
Chris@134
|
104 Py_XDECREF(v);
|
Chris@134
|
105 return err;
|
Chris@134
|
106 }
|
Chris@134
|
107
|
Chris@134
|
108 static int
|
Chris@134
|
109 setstring(PyObject *d, const char *name, string value)
|
Chris@134
|
110 {
|
Chris@134
|
111 PyObject *v;
|
Chris@134
|
112 int err;
|
Chris@134
|
113 v = StringConversion().string2py(value);
|
Chris@134
|
114 err = PyDict_SetItemString(d, name, v);
|
Chris@134
|
115 Py_XDECREF(v);
|
Chris@134
|
116 return err;
|
Chris@134
|
117 }
|
Chris@134
|
118
|
Chris@31
|
119 PyObject *
|
Chris@31
|
120 PyPluginObject_From_Plugin(Plugin *plugin)
|
Chris@0
|
121 {
|
Chris@124
|
122 PyPluginObject *pd = PyObject_New(PyPluginObject, &Plugin_Type);
|
Chris@124
|
123 if (!pd) return 0;
|
Chris@124
|
124
|
Chris@21
|
125 pd->plugin = plugin;
|
Chris@21
|
126 pd->isInitialised = false;
|
Chris@21
|
127 pd->channels = 0;
|
Chris@21
|
128 pd->blockSize = 0;
|
Chris@21
|
129 pd->stepSize = 0;
|
Chris@134
|
130 pd->info = 0;
|
Chris@134
|
131 pd->parameters = 0;
|
Chris@134
|
132 pd->programs = 0;
|
Chris@34
|
133
|
Chris@112
|
134 StringConversion strconv;
|
Chris@112
|
135
|
Chris@34
|
136 PyObject *infodict = PyDict_New();
|
Chris@134
|
137 setint(infodict, "apiVersion", plugin->getVampApiVersion());
|
Chris@134
|
138 setint(infodict, "pluginVersion", plugin->getPluginVersion());
|
Chris@134
|
139 setstring(infodict, "identifier", plugin->getIdentifier());
|
Chris@134
|
140 setstring(infodict, "name", plugin->getName());
|
Chris@134
|
141 setstring(infodict, "description", plugin->getDescription());
|
Chris@134
|
142 setstring(infodict, "maker", plugin->getMaker());
|
Chris@134
|
143 setstring(infodict, "copyright", plugin->getCopyright());
|
Chris@34
|
144 pd->info = infodict;
|
Chris@34
|
145
|
Chris@82
|
146 pd->inputDomain = plugin->getInputDomain();
|
Chris@34
|
147
|
Chris@35
|
148 VectorConversion conv;
|
Chris@35
|
149
|
Chris@34
|
150 Plugin::ParameterList pl = plugin->getParameterDescriptors();
|
Chris@34
|
151 PyObject *params = PyList_New(pl.size());
|
Chris@34
|
152
|
Chris@34
|
153 for (int i = 0; i < (int)pl.size(); ++i) {
|
Chris@34
|
154 PyObject *paramdict = PyDict_New();
|
Chris@134
|
155 setstring(paramdict, "identifier", pl[i].identifier);
|
Chris@134
|
156 setstring(paramdict, "name", pl[i].name);
|
Chris@134
|
157 setstring(paramdict, "description", pl[i].description);
|
Chris@134
|
158 setstring(paramdict, "unit", pl[i].unit);
|
Chris@134
|
159 setfloat(paramdict, "minValue", pl[i].minValue);
|
Chris@134
|
160 setfloat(paramdict, "maxValue", pl[i].maxValue);
|
Chris@134
|
161 setfloat(paramdict, "defaultValue", pl[i].defaultValue);
|
Chris@34
|
162 if (pl[i].isQuantized) {
|
Chris@134
|
163 PyDict_SetItemString(paramdict, "isQuantized", Py_True);
|
Chris@134
|
164 setfloat(paramdict, "quantizeStep", pl[i].quantizeStep);
|
Chris@34
|
165 if (!pl[i].valueNames.empty()) {
|
Chris@134
|
166 PyObject *vv = conv.PyValue_From_StringVector(pl[i].valueNames);
|
Chris@134
|
167 PyDict_SetItemString(paramdict, "valueNames", vv);
|
Chris@134
|
168 Py_DECREF(vv);
|
Chris@34
|
169 }
|
Chris@34
|
170 } else {
|
Chris@134
|
171 PyDict_SetItemString(paramdict, "isQuantized", Py_False);
|
Chris@34
|
172 }
|
Chris@34
|
173
|
Chris@34
|
174 PyList_SET_ITEM(params, i, paramdict);
|
Chris@34
|
175 }
|
Chris@34
|
176
|
Chris@34
|
177 pd->parameters = params;
|
Chris@39
|
178
|
Chris@39
|
179 Plugin::ProgramList prl = plugin->getPrograms();
|
Chris@39
|
180 PyObject *progs = PyList_New(prl.size());
|
Chris@39
|
181
|
Chris@39
|
182 for (int i = 0; i < (int)prl.size(); ++i) {
|
Chris@112
|
183 PyList_SET_ITEM(progs, i, strconv.string2py(prl[i]));
|
Chris@39
|
184 }
|
Chris@39
|
185
|
Chris@39
|
186 pd->programs = progs;
|
Chris@37
|
187
|
Chris@37
|
188 return (PyObject *)pd;
|
Chris@37
|
189 }
|
Chris@35
|
190
|
Chris@37
|
191 static void
|
Chris@37
|
192 PyPluginObject_dealloc(PyPluginObject *self)
|
Chris@37
|
193 {
|
Chris@115
|
194 // cerr << "PyPluginObject_dealloc: plugin object " << self << ", plugin " << self->plugin << endl;
|
Chris@115
|
195
|
Chris@37
|
196 delete self->plugin;
|
Chris@134
|
197 Py_XDECREF(self->info);
|
Chris@134
|
198 Py_XDECREF(self->parameters);
|
Chris@134
|
199 Py_XDECREF(self->programs);
|
Chris@37
|
200 PyObject_Del(self);
|
Chris@37
|
201 }
|
Chris@37
|
202
|
Chris@37
|
203 static PyObject *
|
Chris@87
|
204 convertOutput(const Plugin::OutputDescriptor &desc, int ix)
|
Chris@86
|
205 {
|
Chris@93
|
206 VectorConversion conv;
|
Chris@112
|
207 StringConversion strconv;
|
Chris@93
|
208
|
Chris@86
|
209 PyObject *outdict = PyDict_New();
|
Chris@134
|
210 setstring(outdict, "identifier", desc.identifier);
|
Chris@134
|
211 setstring(outdict, "name", desc.name);
|
Chris@134
|
212 setstring(outdict, "description", desc.description);
|
Chris@134
|
213 setstring(outdict, "unit", desc.unit);
|
Chris@93
|
214 if (desc.hasFixedBinCount) {
|
Chris@134
|
215 PyDict_SetItemString(outdict, "hasFixedBinCount", Py_True);
|
Chris@134
|
216 setint(outdict, "binCount", desc.binCount);
|
Chris@93
|
217 if (!desc.binNames.empty()) {
|
Chris@134
|
218 PyObject *vv = conv.PyValue_From_StringVector(desc.binNames);
|
Chris@134
|
219 PyDict_SetItemString(outdict, "binNames", vv);
|
Chris@134
|
220 Py_DECREF(vv);
|
Chris@93
|
221 }
|
Chris@134
|
222 } else {
|
Chris@134
|
223 PyDict_SetItemString(outdict, "hasFixedBinCount", Py_False);
|
Chris@93
|
224 }
|
Chris@93
|
225 if (!desc.hasFixedBinCount ||
|
Chris@93
|
226 (desc.hasFixedBinCount && (desc.binCount > 0))) {
|
Chris@86
|
227 if (desc.hasKnownExtents) {
|
Chris@134
|
228 PyDict_SetItemString(outdict, "hasKnownExtents", Py_True);
|
Chris@134
|
229 setfloat(outdict, "minValue", desc.minValue);
|
Chris@134
|
230 setfloat(outdict, "maxValue", desc.maxValue);
|
Chris@86
|
231 } else {
|
Chris@134
|
232 PyDict_SetItemString(outdict, "hasKnownExtents", Py_False);
|
Chris@86
|
233 }
|
Chris@86
|
234 if (desc.isQuantized) {
|
Chris@134
|
235 PyDict_SetItemString(outdict, "isQuantized", Py_True);
|
Chris@134
|
236 setfloat(outdict, "quantizeStep", desc.quantizeStep);
|
Chris@86
|
237 } else {
|
Chris@134
|
238 PyDict_SetItemString(outdict, "isQuantized", Py_False);
|
Chris@86
|
239 }
|
Chris@86
|
240 }
|
Chris@134
|
241 setint(outdict, "sampleType", (int)desc.sampleType);
|
Chris@134
|
242 setfloat(outdict, "sampleRate", desc.sampleRate);
|
Chris@86
|
243 PyDict_SetItemString
|
Chris@109
|
244 (outdict, "hasDuration", desc.hasDuration ? Py_True : Py_False);
|
Chris@134
|
245 setint(outdict, "output_index", ix);
|
Chris@86
|
246 return outdict;
|
Chris@86
|
247 }
|
Chris@86
|
248
|
Chris@86
|
249 static PyObject *
|
Chris@86
|
250 get_output(PyObject *self, PyObject *args)
|
Chris@86
|
251 {
|
Chris@86
|
252 PyPluginObject *pd = getPluginObject(self);
|
Chris@86
|
253 if (!pd) return 0;
|
Chris@86
|
254
|
Chris@112
|
255 ssize_t n = -1;
|
Chris@86
|
256 PyObject *pyId = 0;
|
Chris@86
|
257
|
Chris@86
|
258 if (!PyArg_ParseTuple(args, "n", &n) &&
|
Chris@112
|
259 !PyArg_ParseTuple(args,
|
Chris@112
|
260 #if (PY_MAJOR_VERSION >= 3)
|
Chris@112
|
261 "U",
|
Chris@112
|
262 #else
|
Chris@112
|
263 "S",
|
Chris@112
|
264 #endif
|
Chris@112
|
265 &pyId)) {
|
Chris@86
|
266 PyErr_SetString(PyExc_TypeError,
|
Chris@86
|
267 "get_output takes either output id (string) or output index (int) argument");
|
Chris@86
|
268 return 0;
|
Chris@86
|
269 }
|
Chris@86
|
270
|
Chris@87
|
271 PyErr_Clear();
|
Chris@87
|
272
|
Chris@86
|
273 Plugin::OutputList ol = pd->plugin->getOutputDescriptors();
|
Chris@86
|
274
|
Chris@112
|
275 StringConversion strconv;
|
Chris@112
|
276
|
Chris@86
|
277 if (pyId) {
|
Chris@112
|
278 string id = strconv.py2string(pyId);
|
Chris@86
|
279 for (int i = 0; i < int(ol.size()); ++i) {
|
Chris@86
|
280 if (ol[i].identifier == id) {
|
Chris@87
|
281 return convertOutput(ol[i], i);
|
Chris@86
|
282 }
|
Chris@86
|
283 }
|
Chris@86
|
284 } else {
|
Chris@86
|
285 if (n >= 0 && n < int(ol.size())) {
|
Chris@87
|
286 return convertOutput(ol[n], n);
|
Chris@86
|
287 }
|
Chris@86
|
288 }
|
Chris@86
|
289
|
Chris@102
|
290 PyErr_SetString(PyExc_Exception,
|
Chris@86
|
291 "unknown output id or output index out of range");
|
Chris@86
|
292 return 0;
|
Chris@86
|
293 }
|
Chris@86
|
294
|
Chris@86
|
295 static PyObject *
|
Chris@80
|
296 get_outputs(PyObject *self, PyObject *args)
|
Chris@37
|
297 {
|
Chris@37
|
298 PyPluginObject *pd = getPluginObject(self);
|
Chris@37
|
299 if (!pd) return 0;
|
Chris@37
|
300 Plugin::OutputList ol = pd->plugin->getOutputDescriptors();
|
Chris@35
|
301 PyObject *outputs = PyList_New(ol.size());
|
Chris@35
|
302
|
Chris@35
|
303 for (int i = 0; i < (int)ol.size(); ++i) {
|
Chris@87
|
304 PyObject *outdict = convertOutput(ol[i], i);
|
Chris@35
|
305 PyList_SET_ITEM(outputs, i, outdict);
|
Chris@35
|
306 }
|
Chris@35
|
307
|
Chris@37
|
308 return outputs;
|
Chris@33
|
309 }
|
Chris@33
|
310
|
Chris@0
|
311 static PyObject *
|
Chris@39
|
312 initialise(PyObject *self, PyObject *args)
|
Chris@0
|
313 {
|
Chris@112
|
314 ssize_t channels, blockSize, stepSize;
|
Chris@0
|
315
|
Chris@23
|
316 if (!PyArg_ParseTuple (args, "nnn",
|
Chris@112
|
317 &channels,
|
Chris@112
|
318 &stepSize,
|
Chris@112
|
319 &blockSize)) {
|
Chris@39
|
320 PyErr_SetString(PyExc_TypeError,
|
Chris@39
|
321 "initialise() takes channel count, step size, and block size arguments");
|
Chris@39
|
322 return 0;
|
Chris@0
|
323 }
|
Chris@0
|
324
|
Chris@23
|
325 PyPluginObject *pd = getPluginObject(self);
|
Chris@16
|
326 if (!pd) return 0;
|
Chris@0
|
327
|
Chris@16
|
328 pd->channels = channels;
|
Chris@16
|
329 pd->stepSize = stepSize;
|
Chris@16
|
330 pd->blockSize = blockSize;
|
Chris@0
|
331
|
Chris@16
|
332 if (!pd->plugin->initialise(channels, stepSize, blockSize)) {
|
Chris@39
|
333 cerr << "Failed to initialise native plugin adapter with channels = " << channels << ", stepSize = " << stepSize << ", blockSize = " << blockSize << endl;
|
Chris@39
|
334 PyErr_SetString(PyExc_TypeError,
|
Chris@39
|
335 "Plugin initialization failed");
|
Chris@39
|
336 return 0;
|
Chris@6
|
337 }
|
Chris@0
|
338
|
Chris@16
|
339 pd->isInitialised = true;
|
luis@7
|
340
|
Chris@134
|
341 Py_RETURN_TRUE;
|
Chris@0
|
342 }
|
Chris@0
|
343
|
Chris@0
|
344 static PyObject *
|
Chris@39
|
345 reset(PyObject *self, PyObject *)
|
Chris@18
|
346 {
|
Chris@23
|
347 PyPluginObject *pd = getPluginObject(self);
|
Chris@18
|
348 if (!pd) return 0;
|
Chris@18
|
349
|
Chris@134
|
350 if (!pd->isInitialised || !pd->plugin) {
|
Chris@102
|
351 PyErr_SetString(PyExc_Exception,
|
Chris@18
|
352 "Plugin has not been initialised");
|
Chris@18
|
353 return 0;
|
Chris@18
|
354 }
|
Chris@18
|
355
|
Chris@18
|
356 pd->plugin->reset();
|
Chris@134
|
357 Py_RETURN_TRUE;
|
Chris@18
|
358 }
|
Chris@18
|
359
|
Chris@49
|
360 static bool
|
Chris@49
|
361 hasParameter(PyPluginObject *pd, string id)
|
Chris@49
|
362 {
|
Chris@49
|
363 PluginBase::ParameterList pl = pd->plugin->getParameterDescriptors();
|
Chris@49
|
364 for (int i = 0; i < (int)pl.size(); ++i) {
|
Chris@49
|
365 if (pl[i].identifier == id) {
|
Chris@49
|
366 return true;
|
Chris@49
|
367 }
|
Chris@49
|
368 }
|
Chris@49
|
369 return false;
|
Chris@49
|
370 }
|
Chris@49
|
371
|
Chris@18
|
372 static PyObject *
|
Chris@80
|
373 get_parameter_value(PyObject *self, PyObject *args)
|
Chris@20
|
374 {
|
Chris@20
|
375 PyObject *pyParam;
|
Chris@20
|
376
|
Chris@112
|
377 if (!PyArg_ParseTuple(args,
|
Chris@112
|
378 #if (PY_MAJOR_VERSION >= 3)
|
Chris@112
|
379 "U",
|
Chris@112
|
380 #else
|
Chris@112
|
381 "S",
|
Chris@112
|
382 #endif
|
Chris@112
|
383 &pyParam)) {
|
Chris@39
|
384 PyErr_SetString(PyExc_TypeError,
|
Chris@80
|
385 "get_parameter_value() takes parameter id (string) argument");
|
Chris@39
|
386 return 0; }
|
Chris@20
|
387
|
Chris@23
|
388 PyPluginObject *pd = getPluginObject(self);
|
Chris@20
|
389 if (!pd) return 0;
|
Chris@20
|
390
|
Chris@112
|
391 StringConversion strconv;
|
Chris@112
|
392
|
Chris@112
|
393 string param = strconv.py2string(pyParam);
|
Chris@49
|
394
|
Chris@49
|
395 if (!hasParameter(pd, param)) {
|
Chris@102
|
396 PyErr_SetString(PyExc_Exception,
|
Chris@49
|
397 (string("Unknown parameter id \"") + param + "\"").c_str());
|
Chris@49
|
398 return 0;
|
Chris@49
|
399 }
|
Chris@49
|
400
|
Chris@49
|
401 float value = pd->plugin->getParameter(param);
|
Chris@20
|
402 return PyFloat_FromDouble(double(value));
|
Chris@20
|
403 }
|
Chris@20
|
404
|
Chris@20
|
405 static PyObject *
|
Chris@80
|
406 set_parameter_value(PyObject *self, PyObject *args)
|
Chris@20
|
407 {
|
Chris@20
|
408 PyObject *pyParam;
|
Chris@20
|
409 float value;
|
Chris@20
|
410
|
Chris@112
|
411 if (!PyArg_ParseTuple(args,
|
Chris@112
|
412 #if (PY_MAJOR_VERSION >= 3)
|
Chris@112
|
413 "Uf",
|
Chris@112
|
414 #else
|
Chris@112
|
415 "Sf",
|
Chris@112
|
416 #endif
|
Chris@112
|
417 &pyParam, &value)) {
|
Chris@39
|
418 PyErr_SetString(PyExc_TypeError,
|
Chris@80
|
419 "set_parameter_value() takes parameter id (string), and value (float) arguments");
|
Chris@39
|
420 return 0; }
|
Chris@20
|
421
|
Chris@23
|
422 PyPluginObject *pd = getPluginObject(self);
|
Chris@20
|
423 if (!pd) return 0;
|
Chris@20
|
424
|
Chris@112
|
425 StringConversion strconv;
|
Chris@112
|
426
|
Chris@112
|
427 string param = strconv.py2string(pyParam);
|
Chris@49
|
428
|
Chris@49
|
429 if (!hasParameter(pd, param)) {
|
Chris@102
|
430 PyErr_SetString(PyExc_Exception,
|
Chris@49
|
431 (string("Unknown parameter id \"") + param + "\"").c_str());
|
Chris@49
|
432 return 0;
|
Chris@49
|
433 }
|
Chris@49
|
434
|
Chris@49
|
435 pd->plugin->setParameter(param, value);
|
Chris@134
|
436 Py_RETURN_TRUE;
|
Chris@20
|
437 }
|
Chris@20
|
438
|
Chris@39
|
439 static PyObject *
|
Chris@80
|
440 set_parameter_values(PyObject *self, PyObject *args)
|
Chris@48
|
441 {
|
Chris@48
|
442 PyObject *dict;
|
Chris@48
|
443
|
Chris@48
|
444 if (!PyArg_ParseTuple(args, "O", &dict)) {
|
Chris@48
|
445 PyErr_SetString(PyExc_TypeError,
|
Chris@80
|
446 "set_parameter_values() takes dict argument");
|
Chris@134
|
447 return 0;
|
Chris@134
|
448 }
|
Chris@48
|
449
|
Chris@48
|
450 if (!PyDict_Check(dict)) {
|
Chris@48
|
451 PyErr_SetString(PyExc_TypeError,
|
Chris@80
|
452 "set_parameter_values() takes dict argument");
|
Chris@134
|
453 return 0;
|
Chris@134
|
454 }
|
Chris@48
|
455
|
Chris@48
|
456 PyPluginObject *pd = getPluginObject(self);
|
Chris@48
|
457 if (!pd) return 0;
|
Chris@48
|
458
|
Chris@49
|
459 PluginBase::ParameterList pl = pd->plugin->getParameterDescriptors();
|
Chris@49
|
460 set<string> paramIds;
|
Chris@49
|
461 for (int i = 0; i < (int)pl.size(); ++i) {
|
Chris@49
|
462 paramIds.insert(pl[i].identifier);
|
Chris@49
|
463 }
|
Chris@49
|
464
|
Chris@48
|
465 Py_ssize_t pos = 0;
|
Chris@48
|
466 PyObject *key, *value;
|
Chris@48
|
467 while (PyDict_Next(dict, &pos, &key, &value)) {
|
Chris@102
|
468 #if PY_MAJOR_VERSION >= 3
|
Chris@102
|
469 if (!key || !PyUnicode_CheckExact(key)) {
|
Chris@102
|
470 #else
|
Chris@48
|
471 if (!key || !PyString_CheckExact(key)) {
|
Chris@102
|
472 #endif
|
Chris@48
|
473 PyErr_SetString(PyExc_TypeError,
|
Chris@48
|
474 "Parameter dict keys must all have string type");
|
Chris@48
|
475 return 0;
|
Chris@48
|
476 }
|
Chris@48
|
477 if (!value || !FloatConversion::check(value)) {
|
Chris@48
|
478 PyErr_SetString(PyExc_TypeError,
|
Chris@48
|
479 "Parameter dict values must be convertible to float");
|
Chris@48
|
480 return 0;
|
Chris@48
|
481 }
|
Chris@112
|
482 StringConversion strconv;
|
Chris@112
|
483 string param = strconv.py2string(key);
|
Chris@49
|
484 if (paramIds.find(param) == paramIds.end()) {
|
Chris@102
|
485 PyErr_SetString(PyExc_Exception,
|
Chris@49
|
486 (string("Unknown parameter id \"") + param + "\"").c_str());
|
Chris@49
|
487 return 0;
|
Chris@49
|
488 }
|
Chris@49
|
489 pd->plugin->setParameter(param, FloatConversion::convert(value));
|
Chris@48
|
490 }
|
Chris@134
|
491
|
Chris@134
|
492 Py_RETURN_TRUE;
|
Chris@48
|
493 }
|
Chris@48
|
494
|
Chris@48
|
495 static PyObject *
|
Chris@80
|
496 select_program(PyObject *self, PyObject *args)
|
Chris@39
|
497 {
|
Chris@39
|
498 PyObject *pyParam;
|
Chris@39
|
499
|
Chris@112
|
500 if (!PyArg_ParseTuple(args,
|
Chris@112
|
501 #if (PY_MAJOR_VERSION >= 3)
|
Chris@112
|
502 "U",
|
Chris@112
|
503 #else
|
Chris@112
|
504 "S",
|
Chris@112
|
505 #endif
|
Chris@112
|
506 &pyParam)) {
|
Chris@39
|
507 PyErr_SetString(PyExc_TypeError,
|
Chris@80
|
508 "select_program() takes parameter id (string) argument");
|
Chris@134
|
509 return 0;
|
Chris@134
|
510 }
|
Chris@39
|
511
|
Chris@39
|
512 PyPluginObject *pd = getPluginObject(self);
|
Chris@39
|
513 if (!pd) return 0;
|
Chris@39
|
514
|
Chris@112
|
515 StringConversion strconv;
|
Chris@112
|
516
|
Chris@112
|
517 pd->plugin->selectProgram(strconv.py2string(pyParam));
|
Chris@134
|
518 Py_RETURN_TRUE;
|
Chris@39
|
519 }
|
Chris@39
|
520
|
Chris@35
|
521 static
|
Chris@35
|
522 PyObject *
|
Chris@35
|
523 convertFeatureSet(const Plugin::FeatureSet &fs)
|
Chris@35
|
524 {
|
Chris@35
|
525 VectorConversion conv;
|
Chris@35
|
526
|
Chris@35
|
527 PyObject *pyFs = PyDict_New();
|
Chris@35
|
528
|
Chris@35
|
529 for (Plugin::FeatureSet::const_iterator fsi = fs.begin();
|
Chris@35
|
530 fsi != fs.end(); ++fsi) {
|
Chris@35
|
531
|
Chris@35
|
532 int fno = fsi->first;
|
Chris@35
|
533 const Plugin::FeatureList &fl = fsi->second;
|
Chris@35
|
534
|
Chris@35
|
535 if (!fl.empty()) {
|
Chris@35
|
536
|
Chris@35
|
537 PyObject *pyFl = PyList_New(fl.size());
|
Chris@35
|
538
|
Chris@35
|
539 for (int fli = 0; fli < (int)fl.size(); ++fli) {
|
Chris@35
|
540
|
Chris@35
|
541 const Plugin::Feature &f = fl[fli];
|
Chris@35
|
542 PyObject *pyF = PyDict_New();
|
Chris@35
|
543
|
Chris@35
|
544 if (f.hasTimestamp) {
|
Chris@134
|
545 PyObject *rt = PyRealTime_FromRealTime(f.timestamp);
|
Chris@134
|
546 PyDict_SetItemString(pyF, "timestamp", rt);
|
Chris@134
|
547 Py_DECREF(rt);
|
Chris@35
|
548 }
|
Chris@35
|
549 if (f.hasDuration) {
|
Chris@134
|
550 PyObject *rt = PyRealTime_FromRealTime(f.duration);
|
Chris@134
|
551 PyDict_SetItemString(pyF, "duration", rt);
|
Chris@134
|
552 Py_DECREF(rt);
|
Chris@35
|
553 }
|
Chris@35
|
554
|
Chris@112
|
555 StringConversion strconv;
|
Chris@134
|
556
|
Chris@134
|
557 setstring(pyF, "label", f.label);
|
Chris@35
|
558
|
Chris@35
|
559 if (!f.values.empty()) {
|
Chris@134
|
560 PyObject *vv = conv.PyArray_From_FloatVector(f.values);
|
Chris@134
|
561 PyDict_SetItemString(pyF, "values", vv);
|
Chris@134
|
562 Py_DECREF(vv);
|
Chris@35
|
563 }
|
Chris@35
|
564
|
Chris@35
|
565 PyList_SET_ITEM(pyFl, fli, pyF);
|
Chris@35
|
566 }
|
Chris@35
|
567
|
Chris@102
|
568 PyObject *pyN = PyLong_FromLong(fno);
|
Chris@35
|
569 PyDict_SetItem(pyFs, pyN, pyFl);
|
Chris@134
|
570 Py_DECREF(pyN);
|
Chris@134
|
571 Py_DECREF(pyFl);
|
Chris@35
|
572 }
|
Chris@35
|
573 }
|
Chris@35
|
574
|
Chris@35
|
575 return pyFs;
|
Chris@35
|
576 }
|
Chris@35
|
577
|
Chris@40
|
578 static vector<vector<float> >
|
Chris@40
|
579 convertPluginInput(PyObject *pyBuffer, int channels, int blockSize)
|
Chris@40
|
580 {
|
Chris@40
|
581 vector<vector<float> > data;
|
Chris@40
|
582
|
Chris@40
|
583 VectorConversion conv;
|
Chris@40
|
584
|
Chris@40
|
585 if (PyArray_CheckExact(pyBuffer)) {
|
Chris@40
|
586
|
Chris@40
|
587 data = conv.Py2DArray_To_FloatVector(pyBuffer);
|
Chris@40
|
588
|
Chris@40
|
589 if (conv.error) {
|
Chris@40
|
590 PyErr_SetString(PyExc_TypeError, conv.getError().str().c_str());
|
Chris@40
|
591 return data;
|
Chris@40
|
592 }
|
Chris@40
|
593
|
Chris@41
|
594 if ((int)data.size() != channels) {
|
Chris@41
|
595 // cerr << "Wrong number of channels: got " << data.size() << ", expected " << channels << endl;
|
Chris@41
|
596 PyErr_SetString(PyExc_TypeError, "Wrong number of channels");
|
Chris@41
|
597 return vector<vector<float> >();
|
Chris@41
|
598 }
|
Chris@41
|
599
|
Chris@40
|
600 } else {
|
Chris@40
|
601
|
Chris@40
|
602 if (!PyList_Check(pyBuffer)) {
|
Chris@43
|
603 PyErr_SetString(PyExc_TypeError, "List of NumPy arrays or lists of numbers required for process input");
|
Chris@40
|
604 return data;
|
Chris@40
|
605 }
|
Chris@43
|
606
|
Chris@40
|
607 if (PyList_GET_SIZE(pyBuffer) != channels) {
|
Chris@41
|
608 // cerr << "Wrong number of channels: got " << PyList_GET_SIZE(pyBuffer) << ", expected " << channels << endl;
|
Chris@40
|
609 PyErr_SetString(PyExc_TypeError, "Wrong number of channels");
|
Chris@40
|
610 return data;
|
Chris@40
|
611 }
|
Chris@40
|
612
|
Chris@40
|
613 for (int c = 0; c < channels; ++c) {
|
Chris@40
|
614 PyObject *cbuf = PyList_GET_ITEM(pyBuffer, c);
|
Chris@40
|
615 data.push_back(conv.PyValue_To_FloatVector(cbuf));
|
Chris@43
|
616 if (conv.error) {
|
Chris@43
|
617 PyErr_SetString(PyExc_TypeError, conv.getError().str().c_str());
|
Chris@43
|
618 return vector<vector<float> >();
|
Chris@43
|
619 }
|
Chris@40
|
620 }
|
Chris@41
|
621 }
|
Chris@40
|
622
|
Chris@41
|
623 for (int c = 0; c < channels; ++c) {
|
Chris@41
|
624 if ((int)data[c].size() != blockSize) {
|
Chris@41
|
625 // cerr << "Wrong number of samples on channel " << c << ": expected " << blockSize << " (plugin's block size), got " << data[c].size() << endl;
|
Chris@46
|
626 PyErr_SetString(PyExc_TypeError, "Wrong number of samples for process block");
|
Chris@41
|
627 return vector<vector<float> >();
|
Chris@40
|
628 }
|
Chris@40
|
629 }
|
Chris@40
|
630
|
Chris@40
|
631 return data;
|
Chris@40
|
632 }
|
Chris@40
|
633
|
Chris@20
|
634 static PyObject *
|
Chris@80
|
635 process_block(PyObject *self, PyObject *args)
|
Chris@0
|
636 {
|
Chris@0
|
637 PyObject *pyBuffer;
|
Chris@0
|
638 PyObject *pyRealTime;
|
Chris@0
|
639
|
Chris@23
|
640 if (!PyArg_ParseTuple(args, "OO",
|
Chris@39
|
641 &pyBuffer, // Audio data
|
Chris@39
|
642 &pyRealTime)) { // TimeStamp
|
Chris@39
|
643 PyErr_SetString(PyExc_TypeError,
|
Chris@80
|
644 "process_block() takes buffer (2D array or list of arrays, one row per channel) and timestamp (RealTime) arguments");
|
Chris@39
|
645 return 0; }
|
Chris@0
|
646
|
Chris@0
|
647 if (!PyRealTime_Check(pyRealTime)) {
|
Chris@40
|
648 PyErr_SetString(PyExc_TypeError, "Valid timestamp required.");
|
Chris@39
|
649 return 0; }
|
Chris@0
|
650
|
Chris@23
|
651 PyPluginObject *pd = getPluginObject(self);
|
Chris@16
|
652 if (!pd) return 0;
|
Chris@0
|
653
|
Chris@0
|
654 if (!pd->isInitialised) {
|
Chris@102
|
655 PyErr_SetString(PyExc_Exception,
|
Chris@39
|
656 "Plugin has not been initialised.");
|
Chris@39
|
657 return 0;
|
Chris@16
|
658 }
|
Chris@0
|
659
|
Chris@40
|
660 int channels = pd->channels;
|
Chris@40
|
661 vector<vector<float> > data =
|
Chris@40
|
662 convertPluginInput(pyBuffer, channels, pd->blockSize);
|
Chris@40
|
663 if (data.empty()) return 0;
|
Chris@0
|
664
|
Chris@4
|
665 float **inbuf = new float *[channels];
|
Chris@4
|
666 for (int c = 0; c < channels; ++c) {
|
Chris@12
|
667 inbuf[c] = &data[c][0];
|
Chris@4
|
668 }
|
Chris@12
|
669 RealTime timeStamp = *PyRealTime_AsRealTime(pyRealTime);
|
Chris@18
|
670 Plugin::FeatureSet fs = pd->plugin->process(inbuf, timeStamp);
|
Chris@4
|
671 delete[] inbuf;
|
Chris@0
|
672
|
Chris@35
|
673 return convertFeatureSet(fs);
|
Chris@35
|
674 }
|
Chris@0
|
675
|
Chris@35
|
676 static PyObject *
|
Chris@80
|
677 get_remaining_features(PyObject *self, PyObject *)
|
Chris@35
|
678 {
|
Chris@35
|
679 PyPluginObject *pd = getPluginObject(self);
|
Chris@35
|
680 if (!pd) return 0;
|
Chris@18
|
681
|
Chris@35
|
682 if (!pd->isInitialised) {
|
Chris@102
|
683 PyErr_SetString(PyExc_Exception,
|
Chris@39
|
684 "Plugin has not been initialised.");
|
Chris@39
|
685 return 0;
|
Chris@35
|
686 }
|
Chris@18
|
687
|
Chris@35
|
688 Plugin::FeatureSet fs = pd->plugin->getRemainingFeatures();
|
Chris@18
|
689
|
Chris@35
|
690 return convertFeatureSet(fs);
|
Chris@0
|
691 }
|
Chris@0
|
692
|
Chris@23
|
693 static PyObject *
|
Chris@80
|
694 get_preferred_block_size(PyObject *self, PyObject *)
|
Chris@37
|
695 {
|
Chris@37
|
696 PyPluginObject *pd = getPluginObject(self);
|
Chris@37
|
697 if (!pd) return 0;
|
Chris@102
|
698 return PyLong_FromLong(pd->plugin->getPreferredBlockSize());
|
Chris@37
|
699 }
|
Chris@37
|
700
|
Chris@37
|
701 static PyObject *
|
Chris@80
|
702 get_preferred_step_size(PyObject *self, PyObject *)
|
Chris@37
|
703 {
|
Chris@37
|
704 PyPluginObject *pd = getPluginObject(self);
|
Chris@37
|
705 if (!pd) return 0;
|
Chris@102
|
706 return PyLong_FromLong(pd->plugin->getPreferredStepSize());
|
Chris@37
|
707 }
|
Chris@37
|
708
|
Chris@37
|
709 static PyObject *
|
Chris@80
|
710 get_min_channel_count(PyObject *self, PyObject *)
|
Chris@37
|
711 {
|
Chris@37
|
712 PyPluginObject *pd = getPluginObject(self);
|
Chris@37
|
713 if (!pd) return 0;
|
Chris@102
|
714 return PyLong_FromLong(pd->plugin->getMinChannelCount());
|
Chris@37
|
715 }
|
Chris@37
|
716
|
Chris@37
|
717 static PyObject *
|
Chris@80
|
718 get_max_channel_count(PyObject *self, PyObject *)
|
Chris@37
|
719 {
|
Chris@37
|
720 PyPluginObject *pd = getPluginObject(self);
|
Chris@37
|
721 if (!pd) return 0;
|
Chris@102
|
722 return PyLong_FromLong(pd->plugin->getMaxChannelCount());
|
Chris@37
|
723 }
|
Chris@37
|
724
|
Chris@37
|
725 static PyObject *
|
Chris@39
|
726 unload(PyObject *self, PyObject *)
|
Chris@23
|
727 {
|
Chris@23
|
728 PyPluginObject *pd = getPluginObject(self);
|
Chris@23
|
729 if (!pd) return 0;
|
Chris@23
|
730
|
Chris@115
|
731 // cerr << "unload: unloading plugin object " << pd << ", plugin " << pd->plugin << endl;
|
Chris@115
|
732
|
Chris@23
|
733 delete pd->plugin;
|
Chris@32
|
734 pd->plugin = 0; // This is checked by getPluginObject, so we avoid
|
Chris@32
|
735 // blowing up if called repeatedly
|
Chris@23
|
736
|
Chris@134
|
737 Py_RETURN_TRUE;
|
Chris@23
|
738 }
|
Chris@23
|
739
|
Chris@33
|
740 static PyMemberDef PyPluginObject_members[] =
|
Chris@33
|
741 {
|
Chris@34
|
742 {(char *)"info", T_OBJECT, offsetof(PyPluginObject, info), READONLY,
|
Chris@39
|
743 (char *)"info -> A read-only dictionary of plugin metadata."},
|
Chris@34
|
744
|
Chris@110
|
745 {(char *)"inputDomain", T_INT, offsetof(PyPluginObject, inputDomain), READONLY,
|
Chris@110
|
746 (char *)"inputDomain -> The format of input audio required by the plugin, either vampyhost.TIME_DOMAIN or vampyhost.FREQUENCY_DOMAIN."},
|
Chris@34
|
747
|
Chris@34
|
748 {(char *)"parameters", T_OBJECT, offsetof(PyPluginObject, parameters), READONLY,
|
Chris@39
|
749 (char *)"parameters -> A list of metadata dictionaries describing the plugin's configurable parameters."},
|
Chris@39
|
750
|
Chris@39
|
751 {(char *)"programs", T_OBJECT, offsetof(PyPluginObject, programs), READONLY,
|
Chris@39
|
752 (char *)"programs -> A list of the programs available for this plugin, if any."},
|
Chris@33
|
753
|
Chris@33
|
754 {0, 0}
|
Chris@33
|
755 };
|
Chris@33
|
756
|
Chris@21
|
757 static PyMethodDef PyPluginObject_methods[] =
|
Chris@21
|
758 {
|
Chris@80
|
759 {"get_outputs", get_outputs, METH_NOARGS,
|
Chris@80
|
760 "get_outputs() -> Obtain the output descriptors for all of the plugin's outputs."},
|
Chris@37
|
761
|
Chris@86
|
762 {"get_output", get_output, METH_VARARGS,
|
Chris@86
|
763 "get_output(out) -> Obtain the output descriptor for a single output, by either id (string) or index (int)."},
|
Chris@86
|
764
|
Chris@80
|
765 {"get_parameter_value", get_parameter_value, METH_VARARGS,
|
Chris@80
|
766 "get_parameter_value(identifier) -> Return the value of the parameter with the given identifier."},
|
Chris@23
|
767
|
Chris@80
|
768 {"set_parameter_value", set_parameter_value, METH_VARARGS,
|
Chris@80
|
769 "set_parameter_value(identifier, value) -> Set the parameter with the given identifier to the given value."},
|
Chris@37
|
770
|
Chris@80
|
771 {"set_parameter_values", set_parameter_values, METH_VARARGS,
|
Chris@80
|
772 "set_parameter_values(dict) -> Set multiple parameters to values corresponding to the key/value pairs in the dict. Any parameters not mentioned in the dict are unchanged."},
|
Chris@48
|
773
|
Chris@80
|
774 {"select_program", select_program, METH_VARARGS,
|
Chris@80
|
775 "select_program(name) -> Select the processing program with the given name."},
|
Chris@39
|
776
|
Chris@80
|
777 {"get_preferred_block_size", get_preferred_block_size, METH_VARARGS,
|
Chris@80
|
778 "get_preferred_block_size() -> Return the plugin's preferred processing block size, or 0 if the plugin accepts any block size."},
|
Chris@37
|
779
|
Chris@80
|
780 {"get_preferred_step_size", get_preferred_step_size, METH_VARARGS,
|
Chris@80
|
781 "get_preferred_step_size() -> Return the plugin's preferred processing step size, or 0 if the plugin allows the host to select. If this is 0, the host should normally choose the same step as block size for time-domain plugins, or half the block size for frequency-domain plugins."},
|
Chris@37
|
782
|
Chris@80
|
783 {"get_min_channel_count", get_min_channel_count, METH_VARARGS,
|
Chris@80
|
784 "get_min_channel_count() -> Return the minimum number of channels of audio data the plugin accepts as input."},
|
Chris@37
|
785
|
Chris@80
|
786 {"get_max_channel_count", get_max_channel_count, METH_VARARGS,
|
Chris@80
|
787 "get_max_channel_count() -> Return the maximum number of channels of audio data the plugin accepts as input."},
|
Chris@33
|
788
|
Chris@39
|
789 {"initialise", initialise, METH_VARARGS,
|
Chris@80
|
790 "initialise(channels, stepSize, blockSize) -> Initialise the plugin for the given number of channels and processing frame sizes. This must be called before process_block() can be used."},
|
Chris@23
|
791
|
Chris@39
|
792 {"reset", reset, METH_NOARGS,
|
Chris@39
|
793 "reset() -> Reset the plugin after processing, to prepare for another processing run with the same parameters."},
|
Chris@23
|
794
|
Chris@80
|
795 {"process_block", process_block, METH_VARARGS,
|
Chris@80
|
796 "process_block(block, timestamp) -> Provide one processing frame to the plugin, with its timestamp, and obtain any features that were extracted immediately from this frame."},
|
Chris@23
|
797
|
Chris@80
|
798 {"get_remaining_features", get_remaining_features, METH_NOARGS,
|
Chris@80
|
799 "get_remaining_features() -> Obtain any features extracted at the end of processing."},
|
Chris@35
|
800
|
Chris@39
|
801 {"unload", unload, METH_NOARGS,
|
Chris@39
|
802 "unload() -> Dispose of the plugin. You cannot use the plugin object again after calling this. Note that unloading also happens automatically when the plugin object's reference count reaches zero; this function is only necessary if you wish to ensure the native part of the plugin is disposed of before then."},
|
Chris@23
|
803
|
Chris@21
|
804 {0, 0}
|
Chris@21
|
805 };
|
Chris@21
|
806
|
Chris@21
|
807 /* Doc:: 10.3 Type Objects */ /* static */
|
Chris@21
|
808 PyTypeObject Plugin_Type =
|
Chris@21
|
809 {
|
Chris@112
|
810 PyVarObject_HEAD_INIT(NULL, 0)
|
Chris@39
|
811 "vampyhost.Plugin", /*tp_name*/
|
Chris@39
|
812 sizeof(PyPluginObject), /*tp_basicsize*/
|
Chris@39
|
813 0, /*tp_itemsize*/
|
Chris@21
|
814 (destructor)PyPluginObject_dealloc, /*tp_dealloc*/
|
Chris@39
|
815 0, /*tp_print*/
|
Chris@39
|
816 0, /*tp_getattr*/
|
Chris@39
|
817 0, /*tp_setattr*/
|
Chris@39
|
818 0, /*tp_compare*/
|
Chris@39
|
819 0, /*tp_repr*/
|
Chris@39
|
820 0, /*tp_as_number*/
|
Chris@39
|
821 0, /*tp_as_sequence*/
|
Chris@39
|
822 0, /*tp_as_mapping*/
|
Chris@39
|
823 0, /*tp_hash*/
|
Chris@39
|
824 0, /*tp_call*/
|
Chris@39
|
825 0, /*tp_str*/
|
Chris@39
|
826 PyObject_GenericGetAttr, /*tp_getattro*/
|
Chris@39
|
827 PyObject_GenericSetAttr, /*tp_setattro*/
|
Chris@39
|
828 0, /*tp_as_buffer*/
|
Chris@39
|
829 Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
Chris@40
|
830 "Plugin object, providing a low-level API for running a Vamp plugin.", /*tp_doc*/
|
Chris@39
|
831 0, /*tp_traverse*/
|
Chris@39
|
832 0, /*tp_clear*/
|
Chris@39
|
833 0, /*tp_richcompare*/
|
Chris@39
|
834 0, /*tp_weaklistoffset*/
|
Chris@39
|
835 0, /*tp_iter*/
|
Chris@39
|
836 0, /*tp_iternext*/
|
Chris@39
|
837 PyPluginObject_methods, /*tp_methods*/
|
Chris@39
|
838 PyPluginObject_members, /*tp_members*/
|
Chris@39
|
839 0, /*tp_getset*/
|
Chris@39
|
840 0, /*tp_base*/
|
Chris@39
|
841 0, /*tp_dict*/
|
Chris@39
|
842 0, /*tp_descr_get*/
|
Chris@39
|
843 0, /*tp_descr_set*/
|
Chris@39
|
844 0, /*tp_dictoffset*/
|
Chris@39
|
845 0, /*tp_init*/
|
Chris@124
|
846 0, /*tp_alloc*/
|
Chris@39
|
847 0, /*tp_new*/
|
Chris@124
|
848 0, /*tp_free*/
|
Chris@39
|
849 0, /*tp_is_gc*/
|
Chris@21
|
850 };
|
Chris@0
|
851
|