# HG changeset patch # User Chris Cannam # Date 1421149109 0 # Node ID 1cb0ed230b7111db301e217bbb101ef8739b6da0 # Parent f12b59c022a5896c78e4f8eeb7829a5d1f01549d Add plugin loader adapter flags diff -r f12b59c022a5 -r 1cb0ed230b71 PyPluginObject.cpp --- 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)) { diff -r f12b59c022a5 -r 1cb0ed230b71 vampyhost.cpp --- 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; }