changeset 9:703f52bf8a2e lf-numpy-arrays

Printing a few results
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 14 Mar 2013 16:52:44 +0000
parents db72f98403b4
children 8306b7fdd2d0
files vampyhost.cpp vampyhost_test.py
diffstat 2 files changed, 32 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/vampyhost.cpp	Thu Mar 14 11:37:07 2013 +0000
+++ b/vampyhost.cpp	Thu Mar 14 16:52:44 2013 +0000
@@ -569,19 +569,37 @@
     cout << "[Host] Called plugin->process" << endl;
 
     /* TODO:  DO SOMETHONG WITH THE FEATURE SET HERE */
-/// convert to appropriate python objects, reuse types and conversion utilities from Vampy ...
+    /// convert to appropriate python objects, reuse types and conversion utilities from Vampy ...
 
+    // Loop FeatureLists
+    for(int i = 0; i < pd->output.size(); i++ ){
+        cout << "FeatureList #" << i << " has size " << pd->output[i].size() << endl;
+
+        // loop Features
+        for(int j = 0; j < pd->output[i].size(); j++ ){
+            cout << "Feature #" << j << endl;
+            cout << "   Label: " << pd->output[i][j].label << endl;
+            cout << "   hasTimestamp? " << pd->output[i][j].hasTimestamp << endl;
+            cout << "   hasDuration? " << pd->output[i][j].hasDuration << endl;
+            cout << "   values.size " << pd->output[i][j].values.size() << endl;
+            cout << "   values[0] " << pd->output[i][j].values[0] << endl;
+        }
+    }
+
+    size_t outLength = pd->output[0].size();
+    Plugin::FeatureList features = pd->output[0];
+
+    // New PyList for the featurelist
+    PyObject *pyFeatureList = PyList_New(outLength);
+
+    cout << "Survived" << endl;
 
     for (int c = 0; c < channels; ++c){
 	delete[] inbuf[c];
     }
     delete[] inbuf;
 
-
-
-
-
-    return NULL; //!!! Need to return actual features!
+    return pyFeatureList; //!!! Need to return actual features!
 }
 
 /* GET / SET OUTPUT */
--- a/vampyhost_test.py	Thu Mar 14 11:37:07 2013 +0000
+++ b/vampyhost_test.py	Thu Mar 14 16:52:44 2013 +0000
@@ -81,8 +81,15 @@
 
 print "Gonna send", len(audio)
 
+
 out = vh.process(handle, audio, rt)
-print "OKEYDOKEY: Processed"
+
+print "Processed correctly"
+
+print type(out)
+
+
+#######
 
 output = vh.getOutput(handle, 1)