Use https for harrison channelstrip (windows-builds)
[ardour.git] / libs / qm-dsp / dsp / onsets / PeakPicking.cpp
index b46c54b6d1cfeb7bc7995c7505d71b38df0131fd..e30e71568f9981ba9e65d7427884aa5fa27982b7 100644 (file)
@@ -6,11 +6,19 @@
     Centre for Digital Music, Queen Mary, University of London.
     This file 2005-2006 Christian Landone.
 
+    Modifications:
+
+    - delta threshold
+    Description: add delta threshold used as offset in the smoothed
+    detection function
+    Author: Mathieu Barthet
+    Date: June 2010
+
     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License as
     published by the Free Software Foundation; either version 2 of the
     License, or (at your option) any later version.  See the file
-    COPYING included with this distribution for more information.
+    COPYING included with this distribution for more information.    
 */
 
 #include "PeakPicking.h"
@@ -50,7 +58,8 @@ void PeakPicking::initialise( PPickParams Config )
     m_DFProcessingParams.winPost = Config.WinT.post; 
     m_DFProcessingParams.AlphaNormParam = Config.alpha;
     m_DFProcessingParams.isMedianPositive = false;
-       
+    m_DFProcessingParams.delta = Config.delta; //add the delta threshold as an adjustable parameter
+
     m_DFSmoothing = new DFProcess( m_DFProcessingParams );
 
     m_workBuffer = new double[ m_DFLength ];
@@ -80,7 +89,7 @@ void PeakPicking::process( double* src, unsigned int len, vector<int> &onsets )
        
     quadEval( m_maxima, onsets );
 
-    for(unsigned int b = 0; b <  m_maxima.size(); b++)
+    for( int b = 0; b <  (int)m_maxima.size(); b++)
     {
        src[ b ] = m_maxima[ b ];
     }
@@ -126,6 +135,8 @@ int PeakPicking::quadEval( vector<double> &src, vector<int> &idx )
            m_maxFit.push_back(selMax);                 
        }
 
+       TPolyFit::PolyFit2(m_err, m_maxFit, m_poly);
+
        double f = m_poly[0];
        double h = m_poly[2];