diff modules-and-plug-ins/python-module/btrack_python_module.cpp @ 54:9699024bb3d0

Before this commit, the OnsetDetectionFunction class used double precision, and the BTrack class used floats. I have now made BTrack use double precision also. This works fine and the only cost of doing this is that we have to perform one array copy into floating point format so that sample rate conversion (which has to be in floating point format) can take place.
author Adam Stark <adamstark@users.noreply.github.com>
date Wed, 22 Jan 2014 02:49:29 +0000
parents 45231107c9d6
children 450c53430540
line wrap: on
line diff
--- a/modules-and-plug-ins/python-module/btrack_python_module.cpp	Wed Jan 22 01:34:04 2014 +0000
+++ b/modules-and-plug-ins/python-module/btrack_python_module.cpp	Wed Jan 22 02:49:29 2014 +0000
@@ -156,7 +156,8 @@
     double df[numframes];
     double beats[5000];
     int beatnum = 0;
-    float df_val;
+
+    double df_val;
     
     ///////////////////////////////////////////
 	//////// Begin Processing Loop ////////////
@@ -171,7 +172,7 @@
 		
 		df[i] = onset.getDFsample(buffer);
         
-        df_val = (float) (df[i] + 0.0001);
+        df_val = df[i] + 0.0001;
                 
 		b.process(df_val);				// process df sample in beat tracker
 		
@@ -270,14 +271,14 @@
     
     double beats[5000];
     int beatnum = 0;
-    float df_val;
+    double df_val;
     
     ///////////////////////////////////////////
 	//////// Begin Processing Loop ////////////
 	
 	for (long i=0;i < numframes;i++)
 	{		
-        df_val = (float) (data[i] + 0.0001);
+        df_val = data[i] + 0.0001;
         
 		b.process(df_val);				// process df sample in beat tracker