comparison PyPlugin.h @ 6:e1b508f2f914

Added support to memory buffers to be used with NumPy (and some rationalisation of code)
author fazekasgy
date Wed, 19 Mar 2008 16:02:29 +0000
parents 134313c59d82
children a4c955e9a70b
comparison
equal deleted inserted replaced
5:6ed5ebd38fde 6:e1b508f2f914
90 timeStamp, 90 timeStamp,
91 values, 91 values,
92 label 92 label
93 }; 93 };
94 94
95 enum eProcessType {
96 not_implemented,
97 legacyProcess,
98 numpyProcess
99 };
95 100
96 class PyPlugin : public Vamp::Plugin 101 class PyPlugin : public Vamp::Plugin
97 { 102 {
98 public: 103 public:
99 PyPlugin(std::string plugin,float inputSampleRate, PyObject *pyInstance); 104 PyPlugin(std::string plugin,float inputSampleRate, PyObject *pyInstance);
100 virtual ~PyPlugin(); 105 virtual ~PyPlugin();
101 106
102 bool initialise(size_t channels, size_t stepSize, size_t blockSize); 107 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
103 void reset(); 108 void reset();
104 //virtuals: 109
105 InputDomain getInputDomain() const; 110 InputDomain getInputDomain() const;
106 size_t getPreferredBlockSize() const; 111 size_t getPreferredBlockSize() const;
107 size_t getPreferredStepSize() const; 112 size_t getPreferredStepSize() const;
108 size_t getMinChannelCount() const; 113 size_t getMinChannelCount() const;
109 size_t getMaxChannelCount() const; 114 size_t getMaxChannelCount() const;
126 FeatureSet getRemainingFeatures(); 131 FeatureSet getRemainingFeatures();
127 132
128 protected: 133 protected:
129 PyObject *m_pyInstance; 134 PyObject *m_pyInstance;
130 size_t m_stepSize; 135 size_t m_stepSize;
131 float m_previousSample; 136 size_t m_blockSize;
137 size_t m_channels;
132 std::string m_plugin; 138 std::string m_plugin;
133 std::string m_class; 139 std::string m_class;
134 std::string m_path; 140 std::string m_path;
141 int m_processType;
142 PyObject *m_pyProcess;
143 InputDomain m_inputDomain;
144
145 bool initMaps() const;
146 std::vector<std::string> PyList_To_StringVector (PyObject *inputList) const;
147 std::vector<float> PyList_As_FloatVector (PyObject *inputList) const;
135 148
136 static Mutex m_pythonInterpreterMutex; 149 static Mutex m_pythonInterpreterMutex;
137 }; 150 };
138 151
139 152