globally remove all trailing whitespace from ardour code base.
[ardour.git] / libs / qm-dsp / dsp / onsets / PeakPicking.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2
3 /*
4     QM DSP Library
5
6     Centre for Digital Music, Queen Mary, University of London.
7     This file 2005-2006 Christian Landone.
8
9     This program is free software; you can redistribute it and/or
10     modify it under the terms of the GNU General Public License as
11     published by the Free Software Foundation; either version 2 of the
12     License, or (at your option) any later version.  See the file
13     COPYING included with this distribution for more information.
14 */
15
16 // PeakPicking.h: interface for the PeakPicking class.
17 //
18 //////////////////////////////////////////////////////////////////////
19
20 #ifndef PEAKPICKING_H
21 #define PEAKPICKING_H
22
23 #include "maths/MathUtilities.h"
24 #include "maths/MathAliases.h"
25 #include "dsp/signalconditioning/DFProcess.h"
26
27
28 struct PPWinThresh
29 {
30     unsigned int pre;
31     unsigned int  post;
32 };
33
34 struct QFitThresh
35 {
36     double a;
37     double b;
38     double c;
39 };
40
41 struct PPickParams
42 {
43     unsigned int length; //Detection FunctionLength
44     double tau; // time resolution of the detection function:
45     unsigned int alpha; //alpha-norm parameter
46     double cutoff;//low-pass Filter cutoff freq
47     unsigned int LPOrd; // low-pass Filter order
48     double* LPACoeffs; //low pass Filter den coefficients
49     double* LPBCoeffs; //low pass Filter num coefficients
50     PPWinThresh WinT;//window size in frames for adaptive thresholding [pre post]:
51     QFitThresh QuadThresh;
52 };
53
54 class PeakPicking
55 {
56 public:
57     PeakPicking( PPickParams Config );
58     virtual ~PeakPicking();
59         
60     void process( double* src, unsigned int len, vector<int> &onsets  );
61
62
63 private:
64     void initialise( PPickParams Config  );
65     void deInitialise();
66     int  quadEval( vector<double> &src, vector<int> &idx );
67         
68     DFProcConfig m_DFProcessingParams;
69
70     unsigned int m_DFLength ;
71     double Qfilta ;
72     double Qfiltb;
73     double Qfiltc;
74
75
76     double* m_workBuffer;
77         
78     DFProcess*  m_DFSmoothing;
79 };
80
81 #endif