comparison dsp/onsets/DetectionFunction.h @ 499:af5b7ef02aa7

Style fixes: avoid unsigned, fix formatting
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 03 Jun 2019 14:20:39 +0100
parents 701233f8ed41
children
comparison
equal deleted inserted replaced
498:8b92623e81c9 499:af5b7ef02aa7
26 #define DF_PHASEDEV (3) 26 #define DF_PHASEDEV (3)
27 #define DF_COMPLEXSD (4) 27 #define DF_COMPLEXSD (4)
28 #define DF_BROADBAND (5) 28 #define DF_BROADBAND (5)
29 29
30 struct DFConfig{ 30 struct DFConfig{
31 unsigned int stepSize; // DF step in samples 31 int stepSize; // DF step in samples
32 unsigned int frameLength; // DF analysis window - usually 2*step. Must be even! 32 int frameLength; // DF analysis window - usually 2*step. Must be even!
33 int DFType; // type of detection function ( see defines ) 33 int DFType; // type of detection function ( see defines )
34 double dbRise; // only used for broadband df (and required for it) 34 double dbRise; // only used for broadband df (and required for it)
35 bool adaptiveWhitening; // perform adaptive whitening 35 bool adaptiveWhitening; // perform adaptive whitening
36 double whiteningRelaxCoeff; // if < 0, a sensible default will be used 36 double whiteningRelaxCoeff; // if < 0, a sensible default will be used
37 double whiteningFloor; // if < 0, a sensible default will be used 37 double whiteningFloor; // if < 0, a sensible default will be used
39 39
40 class DetectionFunction 40 class DetectionFunction
41 { 41 {
42 public: 42 public:
43 double* getSpectrumMagnitude(); 43 double* getSpectrumMagnitude();
44 DetectionFunction( DFConfig Config ); 44 DetectionFunction( DFConfig config );
45 virtual ~DetectionFunction(); 45 virtual ~DetectionFunction();
46 46
47 /** 47 /**
48 * Process a single time-domain frame of audio, provided as 48 * Process a single time-domain frame of audio, provided as
49 * frameLength samples. 49 * frameLength samples.
58 58
59 private: 59 private:
60 void whiten(); 60 void whiten();
61 double runDF(); 61 double runDF();
62 62
63 double HFC( unsigned int length, double* src); 63 double HFC(int length, double* src);
64 double specDiff( unsigned int length, double* src); 64 double specDiff(int length, double* src);
65 double phaseDev(unsigned int length, double *srcPhase); 65 double phaseDev(int length, double *srcPhase);
66 double complexSD(unsigned int length, double *srcMagnitude, double *srcPhase); 66 double complexSD(int length, double *srcMagnitude, double *srcPhase);
67 double broadband(unsigned int length, double *srcMagnitude); 67 double broadband(int length, double *srcMagnitude);
68 68
69 private: 69 private:
70 void initialise( DFConfig Config ); 70 void initialise( DFConfig Config );
71 void deInitialise(); 71 void deInitialise();
72 72
73 int m_DFType; 73 int m_DFType;
74 unsigned int m_dataLength; 74 int m_dataLength;
75 unsigned int m_halfLength; 75 int m_halfLength;
76 unsigned int m_stepSize; 76 int m_stepSize;
77 double m_dbRise; 77 double m_dbRise;
78 bool m_whiten; 78 bool m_whiten;
79 double m_whitenRelaxCoeff; 79 double m_whitenRelaxCoeff;
80 double m_whitenFloor; 80 double m_whitenFloor;
81 81