comparison PyPlugin.h @ 18:e9cf443b18f5

* Add duration support (Vamp 2.0)
author cannam
date Fri, 10 Jul 2009 15:14:24 +0000
parents a4c955e9a70b
children 1ae350e97f93
comparison
equal deleted inserted replaced
17:5b8167619b76 18:e9cf443b18f5
1 /* -*- c-basic-offset: 8 indent-tabs-mode: t -*- */
1 /* 2 /*
2 Vamp 3 Vamp
3 4
4 An API for audio analysis and feature extraction plugins. 5 An API for audio analysis and feature extraction plugins.
5 6
43 #include <Python.h> 44 #include <Python.h>
44 45
45 #include "Mutex.h" 46 #include "Mutex.h"
46 47
47 //fields in OutputDescriptor 48 //fields in OutputDescriptor
49 namespace o {
48 enum eOutDescriptors { 50 enum eOutDescriptors {
49 not_found, 51 not_found,
50 identifier, 52 identifier,
51 name, 53 name,
52 description, 54 description,
59 maxValue, 61 maxValue,
60 isQuantized, 62 isQuantized,
61 quantizeStep, 63 quantizeStep,
62 sampleType, 64 sampleType,
63 sampleRate, 65 sampleRate,
66 hasDuration,
64 endNode 67 endNode
65 }; 68 };
69 }
66 70
67 namespace p { 71 namespace p {
68 enum eParmDescriptors { 72 enum eParmDescriptors {
69 not_found, 73 not_found,
70 identifier, 74 identifier,
86 90
87 enum eFeatureFields { 91 enum eFeatureFields {
88 unknown, 92 unknown,
89 hasTimestamp, 93 hasTimestamp,
90 timeStamp, 94 timeStamp,
95 hasDuration,
96 duration,
91 values, 97 values,
92 label 98 label
93 }; 99 };
94 100
95 enum eProcessType { 101 enum eProcessType {
99 }; 105 };
100 106
101 class PyPlugin : public Vamp::Plugin 107 class PyPlugin : public Vamp::Plugin
102 { 108 {
103 public: 109 public:
104 PyPlugin(std::string plugin,float inputSampleRate, PyObject *pyInstance); 110 PyPlugin(std::string plugin,float inputSampleRate, PyObject *pyInstance);
105 virtual ~PyPlugin(); 111 virtual ~PyPlugin();
106 112
107 bool initialise(size_t channels, size_t stepSize, size_t blockSize); 113 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
108 void reset(); 114 void reset();
109 115
110 InputDomain getInputDomain() const; 116 InputDomain getInputDomain() const;
111 size_t getPreferredBlockSize() const; 117 size_t getPreferredBlockSize() const;
112 size_t getPreferredStepSize() const; 118 size_t getPreferredStepSize() const;
113 size_t getMinChannelCount() const; 119 size_t getMinChannelCount() const;
114 size_t getMaxChannelCount() const; 120 size_t getMaxChannelCount() const;
115 121
116 std::string getIdentifier() const; 122 std::string getIdentifier() const;
117 std::string getName() const; 123 std::string getName() const;
118 std::string getDescription() const; 124 std::string getDescription() const;
119 std::string getMaker() const; 125 std::string getMaker() const;
120 int getPluginVersion() const; 126 int getPluginVersion() const;
121 std::string getCopyright() const; 127 std::string getCopyright() const;
122 128
123 OutputList getOutputDescriptors() const; 129 OutputList getOutputDescriptors() const;
124 ParameterList getParameterDescriptors() const; 130 ParameterList getParameterDescriptors() const;
125 float getParameter(std::string paramid) const; 131 float getParameter(std::string paramid) const;
126 void setParameter(std::string paramid, float newval); 132 void setParameter(std::string paramid, float newval);
127 133
128 FeatureSet process(const float *const *inputBuffers, 134 FeatureSet process(const float *const *inputBuffers,
129 Vamp::RealTime timestamp); 135 Vamp::RealTime timestamp);
130 136
131 FeatureSet getRemainingFeatures(); 137 FeatureSet getRemainingFeatures();
132 138
133 protected: 139 protected:
134 PyObject *m_pyInstance; 140 PyObject *m_pyInstance;
135 size_t m_stepSize; 141 size_t m_stepSize;
136 size_t m_blockSize; 142 size_t m_blockSize;
137 size_t m_channels; 143 size_t m_channels;
138 std::string m_plugin; 144 std::string m_plugin;
139 std::string m_class; 145 std::string m_class;
140 std::string m_path; 146 std::string m_path;
141 int m_processType; 147 int m_processType;
142 PyObject *m_pyProcess; 148 PyObject *m_pyProcess;