changeset 47:1cb0ed230b71

Add plugin loader adapter flags
author Chris Cannam
date Tue, 13 Jan 2015 11:38:29 +0000
parents f12b59c022a5
children 0e0e18629917
files PyPluginObject.cpp vampyhost.cpp
diffstat 2 files changed, 21 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/PyPluginObject.cpp	Wed Dec 03 18:22:28 2014 +0000
+++ b/PyPluginObject.cpp	Tue Jan 13 11:38:29 2015 +0000
@@ -440,7 +440,7 @@
                           &pyBuffer,                    // Audio data
                           &pyRealTime)) {               // TimeStamp
         PyErr_SetString(PyExc_TypeError,
-                        "process() takes plugin handle (object), buffer (2D array or list of arrays, one row per channel) and timestamp (RealTime) arguments");
+                        "process() takes buffer (2D array or list of arrays, one row per channel) and timestamp (RealTime) arguments");
         return 0; }
 
     if (!PyRealTime_Check(pyRealTime)) {
--- a/vampyhost.cpp	Wed Dec 03 18:22:28 2014 +0000
+++ b/vampyhost.cpp	Tue Jan 13 11:38:29 2015 +0000
@@ -153,8 +153,7 @@
 
     PluginLoader *loader = PluginLoader::getInstance();
 
-    Plugin *plugin = loader->loadPlugin
-        (pluginKey, 48000, PluginLoader::ADAPT_ALL_SAFE);
+    Plugin *plugin = loader->loadPlugin(pluginKey, 48000, 0);
     if (!plugin) {
         string pyerr("Failed to load plugin: "); pyerr += pluginKey;
         PyErr_SetString(PyExc_TypeError,pyerr.c_str());
@@ -179,12 +178,14 @@
 {
     PyObject *pyPluginKey;
     float inputSampleRate;
+    int adapterFlags;
 
-    if (!PyArg_ParseTuple(args, "Sf",
+    if (!PyArg_ParseTuple(args, "Sfn",
                           &pyPluginKey,
-                          &inputSampleRate)) {
+                          &inputSampleRate,
+                          &adapterFlags)) {
         PyErr_SetString(PyExc_TypeError,
-                        "loadPlugin() takes plugin key (string) and sample rate (float) arguments");
+                        "loadPlugin() takes plugin key (string), sample rate (float), and adapter flags (int) arguments");
         return 0; }
 
     string pluginKey = toPluginKey(pyPluginKey);
@@ -192,8 +193,9 @@
 
     PluginLoader *loader = PluginLoader::getInstance();
 
-    Plugin *plugin = loader->loadPlugin(pluginKey, inputSampleRate,
-                                        PluginLoader::ADAPT_ALL_SAFE);
+    Plugin *plugin = loader->loadPlugin(pluginKey,
+                                        inputSampleRate,
+                                        adapterFlags);
     if (!plugin) {
         string pyerr("Failed to load plugin: "); pyerr += pluginKey;
         PyErr_SetString(PyExc_TypeError,pyerr.c_str());
@@ -278,7 +280,17 @@
         setint(dict, "TimeDomain",
                Plugin::TimeDomain) < 0 ||
         setint(dict, "FrequencyDomain",
-               Plugin::FrequencyDomain) < 0) {
+               Plugin::FrequencyDomain) < 0 ||
+        setint(dict, "AdaptNone",
+               0) < 0 ||
+        setint(dict, "AdaptChannelCount",
+               PluginLoader::ADAPT_CHANNEL_COUNT) < 0 ||
+        setint(dict, "AdaptBufferSize",
+               PluginLoader::ADAPT_BUFFER_SIZE) < 0 ||
+        setint(dict, "AdaptAllSafe",
+               PluginLoader::ADAPT_ALL_SAFE) < 0 ||
+        setint(dict, "AdaptAll",
+               PluginLoader::ADAPT_ALL) < 0) {
         cerr << "ERROR: initvampyhost: Failed to add enums to module dictionary" << endl;
         return;
     }