Mercurial > hg > vampy
comparison PyFeature.h @ 37:27bab3a16c9a vampy2final
new branch Vampy2final
author | fazekasgy |
---|---|
date | Mon, 05 Oct 2009 11:28:00 +0000 |
parents | |
children | f5c028376bf9 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 37:27bab3a16c9a |
---|---|
1 /* | |
2 | |
3 * Vampy : This plugin is a wrapper around the Vamp plugin API. | |
4 * It allows for writing Vamp plugins in Python. | |
5 | |
6 * Centre for Digital Music, Queen Mary University of London. | |
7 * Copyright (C) 2008-2009 Gyorgy Fazekas, QMUL. (See Vamp sources | |
8 * for licence information.) | |
9 | |
10 */ | |
11 | |
12 /* | |
13 NOTES: There are two ways to implement the Vamp::Feature wrapper. | |
14 1) We could keep a Vamp::Feature in the object and | |
15 convert the values on the fly as they are inserted. | |
16 However, this requires a way to convert back to Python for | |
17 this object to be fully usable in python code. These conversions | |
18 are otherwise unnecessary. | |
19 | |
20 2) Keep the python attribute objects in a dict as it is normally | |
21 done in python classes, and convert when the object is returned. | |
22 This way the object is usable by the interpreter until it is returned | |
23 to the C++ plugin wrapper. | |
24 This is different form the Vampy:PyRealTime implementation where the | |
25 two-way conversion makes more sense (in fact required). Note: For | |
26 a host implementation option 1) will be required. | |
27 | |
28 */ | |
29 | |
30 #ifndef _PYFEATURE_H_ | |
31 #define _PYFEATURE_H_ | |
32 | |
33 #include "vamp-sdk/Plugin.h" | |
34 // #include "PyTypeInterface.h" | |
35 | |
36 | |
37 typedef struct { | |
38 PyObject_HEAD | |
39 PyObject *dict; | |
40 // Vamp::Plugin::Feature *feature; | |
41 /// pointer to type interface required: PyTypeInterface ti; | |
42 } FeatureObject; | |
43 | |
44 PyAPI_DATA(PyTypeObject) Feature_Type; | |
45 | |
46 #define PyFeature_CheckExact(v) ((v)->ob_type == &Feature_Type) | |
47 #define PyFeature_Check(v) PyObject_TypeCheck(v, &Feature_Type) | |
48 | |
49 ///fast macro version as per API convention | |
50 #define PyFeature_AS_DICT(v) ((const FeatureObject* const) (v))->dict | |
51 // #define PyFeature_AS_FEATURE(v) ((const FeatureObject* const) (v))->feature | |
52 | |
53 | |
54 /* PyFeature C++ API */ | |
55 | |
56 /* Not required here: | |
57 we will never have to pass a feature back from the wrapper */ | |
58 // PyAPI_FUNC(PyObject *) | |
59 // PyFeature_FromFeature(Vamp::Plugin::Feature&); | |
60 | |
61 // PyAPI_FUNC(const Vamp::Plugin::Feature*) | |
62 // PyFeature_AsFeature (PyObject *self); | |
63 | |
64 | |
65 | |
66 #endif |