diff PyPlugin.h @ 24:7d28bed0864e

* Rearrange Python plugin construction. Formerly, the PyPluginAdapter has retained a single plugin instance pointer for each plugin found, and its createPlugin method has simply returned a new PyPlugin object wrapping the same instance pointer. This has a couple of negative consequences: - Because construction of the actual Python instance occurred before the wrapper was constructed, it was not possible to pass arguments (i.e. the sample rate) from the wrapper constructor to the Python plugin instance constructor -- they had to be passed later, to initialise, disadvantaging those plugins that would like to use the sample rate for parameter & step/block size calculations etc - Because there was only a single Python plugin instance, it was not possible to run more than one instance at once with any isolation This rework instead stores the Python class pointer (rather than instance pointer) in the PyPluginAdapter, and each PyPlugin wrapper instance creates its own Python plugin instance. What could possibly go wrong?
author cannam
date Mon, 17 Aug 2009 15:22:06 +0000
parents 1ae350e97f93
children 4f1894c7591b
line wrap: on
line diff
--- a/PyPlugin.h	Thu Jul 16 13:19:20 2009 +0000
+++ b/PyPlugin.h	Mon Aug 17 15:22:06 2009 +0000
@@ -108,7 +108,7 @@
 class PyPlugin : public Vamp::Plugin
 {
 public:
-	PyPlugin(std::string plugin,float inputSampleRate, PyObject *pyInstance);
+	PyPlugin(std::string plugin,float inputSampleRate, PyObject *pyClass);
 	virtual ~PyPlugin();
 
 	bool initialise(size_t channels, size_t stepSize, size_t blockSize);
@@ -138,6 +138,7 @@
 	FeatureSet getRemainingFeatures();
 
 protected:
+	PyObject *m_pyClass;
 	PyObject *m_pyInstance;
 	size_t m_stepSize;
 	size_t m_blockSize;