annotate PyFeature.h @ 106:76badb3a0bb3 vampy-2.1

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