comparison vampyhost.cpp @ 47:1cb0ed230b71

Add plugin loader adapter flags
author Chris Cannam
date Tue, 13 Jan 2015 11:38:29 +0000
parents f12b59c022a5
children
comparison
equal deleted inserted replaced
46:f12b59c022a5 47:1cb0ed230b71
151 string pluginKey = toPluginKey(pyPluginKey); 151 string pluginKey = toPluginKey(pyPluginKey);
152 if (pluginKey == "") return 0; 152 if (pluginKey == "") return 0;
153 153
154 PluginLoader *loader = PluginLoader::getInstance(); 154 PluginLoader *loader = PluginLoader::getInstance();
155 155
156 Plugin *plugin = loader->loadPlugin 156 Plugin *plugin = loader->loadPlugin(pluginKey, 48000, 0);
157 (pluginKey, 48000, PluginLoader::ADAPT_ALL_SAFE);
158 if (!plugin) { 157 if (!plugin) {
159 string pyerr("Failed to load plugin: "); pyerr += pluginKey; 158 string pyerr("Failed to load plugin: "); pyerr += pluginKey;
160 PyErr_SetString(PyExc_TypeError,pyerr.c_str()); 159 PyErr_SetString(PyExc_TypeError,pyerr.c_str());
161 return 0; 160 return 0;
162 } 161 }
177 static PyObject * 176 static PyObject *
178 loadPlugin(PyObject *self, PyObject *args) 177 loadPlugin(PyObject *self, PyObject *args)
179 { 178 {
180 PyObject *pyPluginKey; 179 PyObject *pyPluginKey;
181 float inputSampleRate; 180 float inputSampleRate;
182 181 int adapterFlags;
183 if (!PyArg_ParseTuple(args, "Sf", 182
183 if (!PyArg_ParseTuple(args, "Sfn",
184 &pyPluginKey, 184 &pyPluginKey,
185 &inputSampleRate)) { 185 &inputSampleRate,
186 PyErr_SetString(PyExc_TypeError, 186 &adapterFlags)) {
187 "loadPlugin() takes plugin key (string) and sample rate (float) arguments"); 187 PyErr_SetString(PyExc_TypeError,
188 return 0; } 188 "loadPlugin() takes plugin key (string), sample rate (float), and adapter flags (int) arguments");
189 189 return 0; }
190 string pluginKey = toPluginKey(pyPluginKey); 190
191 if (pluginKey == "") return 0; 191 string pluginKey = toPluginKey(pyPluginKey);
192 192 if (pluginKey == "") return 0;
193 PluginLoader *loader = PluginLoader::getInstance(); 193
194 194 PluginLoader *loader = PluginLoader::getInstance();
195 Plugin *plugin = loader->loadPlugin(pluginKey, inputSampleRate, 195
196 PluginLoader::ADAPT_ALL_SAFE); 196 Plugin *plugin = loader->loadPlugin(pluginKey,
197 inputSampleRate,
198 adapterFlags);
197 if (!plugin) { 199 if (!plugin) {
198 string pyerr("Failed to load plugin: "); pyerr += pluginKey; 200 string pyerr("Failed to load plugin: "); pyerr += pluginKey;
199 PyErr_SetString(PyExc_TypeError,pyerr.c_str()); 201 PyErr_SetString(PyExc_TypeError,pyerr.c_str());
200 return 0; 202 return 0;
201 } 203 }
276 setint(dict, "VariableSampleRate", 278 setint(dict, "VariableSampleRate",
277 Plugin::OutputDescriptor::VariableSampleRate) < 0 || 279 Plugin::OutputDescriptor::VariableSampleRate) < 0 ||
278 setint(dict, "TimeDomain", 280 setint(dict, "TimeDomain",
279 Plugin::TimeDomain) < 0 || 281 Plugin::TimeDomain) < 0 ||
280 setint(dict, "FrequencyDomain", 282 setint(dict, "FrequencyDomain",
281 Plugin::FrequencyDomain) < 0) { 283 Plugin::FrequencyDomain) < 0 ||
284 setint(dict, "AdaptNone",
285 0) < 0 ||
286 setint(dict, "AdaptChannelCount",
287 PluginLoader::ADAPT_CHANNEL_COUNT) < 0 ||
288 setint(dict, "AdaptBufferSize",
289 PluginLoader::ADAPT_BUFFER_SIZE) < 0 ||
290 setint(dict, "AdaptAllSafe",
291 PluginLoader::ADAPT_ALL_SAFE) < 0 ||
292 setint(dict, "AdaptAll",
293 PluginLoader::ADAPT_ALL) < 0) {
282 cerr << "ERROR: initvampyhost: Failed to add enums to module dictionary" << endl; 294 cerr << "ERROR: initvampyhost: Failed to add enums to module dictionary" << endl;
283 return; 295 return;
284 } 296 }
285 } 297 }