diff examples/ZeroCrossing.cpp @ 190:1982246a3902

* Provide PluginWrapper method for getting hold of a nested wrapper directly (a bit gross, but useful) * Use the above to enable the simple host to adjust timestamps appropriately when printing out results from input domain adapter wrapped plugins
author cannam
date Wed, 17 Sep 2008 13:16:09 +0000
parents aa64a46320d4
children
line wrap: on
line diff
--- a/examples/ZeroCrossing.cpp	Wed Sep 17 11:00:51 2008 +0000
+++ b/examples/ZeroCrossing.cpp	Wed Sep 17 13:16:09 2008 +0000
@@ -41,6 +41,7 @@
 using std::cerr;
 using std::endl;
 
+#include <cmath>
 
 ZeroCrossing::ZeroCrossing(float inputSampleRate) :
     Plugin(inputSampleRate),
@@ -137,6 +138,8 @@
     return list;
 }
 
+//static int scount = 0;
+
 ZeroCrossing::FeatureSet
 ZeroCrossing::process(const float *const *inputBuffers,
                       Vamp::RealTime timestamp)
@@ -148,11 +151,15 @@
 	return FeatureSet();
     }
 
+//    std::cerr << "ZeroCrossing::process: count = " << scount++ << ", timestamp = " << timestamp << ", rms = ";
+
     float prev = m_previousSample;
     size_t count = 0;
 
     FeatureSet returnFeatures;
 
+//    double acc = 0.0;
+
     for (size_t i = 0; i < m_stepSize; ++i) {
 
 	float sample = inputBuffers[0][i];
@@ -173,9 +180,14 @@
 	    returnFeatures[1].push_back(feature);
 	}
 
+//        acc += sample * sample;
+
 	prev = sample;
     }
 
+//    acc /= m_stepSize;
+//    std::cerr << sqrt(acc) << std::endl;
+
     m_previousSample = prev;
 
     Feature feature;