changeset 6:aacfd14a0ae2

Various further fixes. Now we core dump instead of throwing an exception in the test program. Hurrah
author Chris Cannam
date Mon, 18 Feb 2013 16:18:22 +0000
parents 8a534e43eb22
children d29c25695f5e
files vampyhost.cpp vampyhost_test.py
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/vampyhost.cpp	Thu Jan 31 17:54:46 2013 +0000
+++ b/vampyhost.cpp	Mon Feb 18 16:18:22 2013 +0000
@@ -306,7 +306,8 @@
     PluginLoader *loader = PluginLoader::getInstance();
 	
     //load plugin
-    Plugin *plugin = loader->loadPlugin (pluginKey, inputSampleRate);
+    Plugin *plugin = loader->loadPlugin (pluginKey, inputSampleRate, 
+                                         PluginLoader::ADAPT_ALL_SAFE);
     if (!plugin) { 		
 	string pyerr("Failed to load plugin: "); pyerr += pluginKey;
 	PyErr_SetString(PyExc_TypeError,pyerr.c_str()); 
@@ -398,9 +399,11 @@
     plugDesc->blockSize = blockSize;
 
     if (!plugin->initialise(channels, stepSize, blockSize)) {
+        std::cerr << "Failed to initialise native plugin adapter with channels = " << channels << ", stepSize = " << stepSize << ", blockSize = " << blockSize << " and ADAPT_ALL_SAFE set" << std::endl;
 	PyErr_SetString(PyExc_TypeError,
 			"Plugin initialization failed.");
-	return NULL; }
+	return NULL;
+    }
 
     plugDesc->identifier = 
 	plugDesc->key.substr(plugDesc->key.rfind(':')+1);
@@ -520,6 +523,7 @@
     }
 
     if (PyList_GET_SIZE(pyBuffer) != channels) {
+        std::cerr << "Wrong number of channels: got " << PyList_GET_SIZE(pyBuffer) << ", expected " << channels << std::endl;
 	PyErr_SetString(PyExc_TypeError, "Wrong number of channels");
         return NULL;
     }
--- a/vampyhost_test.py	Thu Jan 31 17:54:46 2013 +0000
+++ b/vampyhost_test.py	Mon Feb 18 16:18:22 2013 +0000
@@ -33,8 +33,6 @@
 channels = audio.size
 print "channels: ",channels
 
-#!!! continue with this lark
-
 rt=realtime(4,70)
 
 #test RealTime Object
@@ -65,14 +63,21 @@
 print "\n\nPlugin handle: ",handle
 
 print "Output list of: ",pluginKey,"\n",vh.getOutputList(handle)
+print "Have ", len(audio), " channels in audio"
 
 #initialise: pluginhandle, channels, stepSize, blockSize
-vh.initialise(handle,1,1024,1024)
+if vh.initialise(handle,len(audio),1024,1024):
+	print "Initialise succeeded"
+else:
+	print "Initialise failed!"
+	exit(1)
+
+#!!! continue with this lark
 
 rt=frame2RealTime(100000,22050)
 print type(rt)
 
-out=vh.process(handle,audio,rt)
+out=vh.process(handle,list(audio),rt) ##!!! cast to list should not be necessary
 output = vh.getOutput(handle,1);
 
 print type(output)