r4125: Auto commit for Debian build
[wdq2wav.git] / wdq2wav.cpp
index 81c52a4539c3b0411fd75979fec9fb20255f35e9..510294b9d48406d6ee0f14ba5e8e8c28ef72de9f 100644 (file)
@@ -8,7 +8,7 @@
 **
 **  Copyright (c) 2003 Kevin Rosenberg
 **
-**  $Id: wdq2wav.cpp,v 1.21 2003/02/25 18:14:10 kevin Exp $
+**  $Id: wdq2wav.cpp,v 1.25 2003/02/25 18:24:48 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -26,7 +26,7 @@
 
 #include <wdq2wav.h>
 
-const char* g_szIdStr = "$Id: wdq2wav.cpp,v 1.21 2003/02/25 18:14:10 kevin Exp $";
+const char* g_szIdStr = "$Id: wdq2wav.cpp,v 1.25 2003/02/25 18:24:48 kevin Exp $";
 
 bool g_quiet = false;
 bool g_verbose = false;
@@ -439,8 +439,6 @@ bool get_float8 (int fd, double& f)
   return true;
 }
 
-inline T nearest (double x)
-{ return (x > 0 ? static_cast<T>(x+0.5) : static_cast<T>(x-0.5)); }
 
 bool
 WindaqChannel::read_channel_data ()
@@ -511,8 +509,11 @@ WindaqChannel::read_channel_data ()
   m_min_scaled_data = (m_slope * data_min) + m_intercept;
 
   if (g_demean) {
-    double dmean = total_data / static_cast<double> wdq.m_nSamples;
+    double dmean = total_data / static_cast<double>(r_wdq.m_nSamples);
     int mean = nearest<int>(dmean);
+    std::cout << "Removing mean: " << (dmean * m_slope) + m_intercept <<
+      " " << m_units << std::endl;
+    
     for (i = 0; i < r_wdq.m_nSamples; i++)
       m_data[i] -= mean;
   }