Switch to side-by-side view

--- a/src/alsadirect.cpp
+++ b/src/alsadirect.cpp
@@ -209,7 +209,7 @@
             sum += buf[i];
         }
     }
-    float operator()(float ns) {
+    double operator()(double ns) {
         buf[idx++] = ns;
         sum += ns;
         if (idx == FNS)
@@ -217,9 +217,9 @@
         sum -= buf[idx];
         return sum/FNS;
     }
-    float old;
-    float buf[FNS];
-    float sum;
+    double old;
+    double buf[FNS];
+    double sum;
     int idx;
 };
 
@@ -236,7 +236,7 @@
 
     qinit = false;
 
-    float samplerate_ratio = 1.0;
+    double samplerate_ratio = 1.0;
     Filter filter;
 
     int src_error = 0;
@@ -291,15 +291,19 @@
         // present hack sort of works but could probably benefit from
         // a more scientific approach
 
-        // Qsize in songcast buffers. This is the variable to control
+        // Qsize in frames. This is the variable to control
         double qs;
 
         if (qinit) {
-            qs = alsaqueue.qsize() + alsadelay() / bufframes;
+            qs = alsaqueue.qsize() * bufframes + alsadelay();
             // Error term
-            double et =  ((qstarg - qs) / qstarg);
-
-            // Integral. Not used, made it worse each time I tried
+            double qstargframes = qstarg * bufframes;
+            double et =  ((qstargframes - qs) / qstargframes);
+
+            // Integral. Not used, made it worse each time I tried.
+            // This is probably because our command is actually the
+            // derivative of the error? I should try a derivative term
+            // instead?
             // it += et;
 
             // Error correction coef
@@ -397,7 +401,7 @@
                 LOGDEB("audioEater:alsa: " 
                        " qstarg " << qstarg <<
                        " iqsz " << alsaqueue.qsize() <<
-                       " qsize " << int(qs) << 
+                       " qsize " << int(qs/bufframes) << 
                        " ratio " << samplerate_ratio <<
                        " in " << src_data.input_frames << 
                        " consumed " << src_data.input_frames_used <<