c@232
|
1 /*
|
c@378
|
2 Copyright (c) 2005 Centre for Digital Music ( C4DM )
|
c@378
|
3 Queen Mary Univesrity of London
|
c@378
|
4
|
c@378
|
5 This program is free software; you can redistribute it and/or
|
c@378
|
6 modify it under the terms of the GNU General Public License as
|
c@378
|
7 published by the Free Software Foundation; either version 2 of the
|
c@378
|
8 License, or (at your option) any later version. See the file
|
c@378
|
9 COPYING included with this distribution for more information.
|
c@232
|
10 */
|
c@232
|
11
|
c@265
|
12 #ifndef GETKEYMODE_H
|
c@232
|
13 #define GETKEYMODE_H
|
c@232
|
14
|
c@232
|
15
|
c@232
|
16 #include "dsp/rateconversion/Decimator.h"
|
c@232
|
17 #include "dsp/chromagram/Chromagram.h"
|
c@232
|
18
|
c@232
|
19
|
c@232
|
20 class GetKeyMode
|
c@232
|
21 {
|
c@232
|
22 public:
|
c@234
|
23 GetKeyMode( int sampleRate, float tuningFrequency,
|
c@234
|
24 double hpcpAverage, double medianAverage );
|
c@232
|
25
|
c@232
|
26 virtual ~GetKeyMode();
|
c@232
|
27
|
c@232
|
28 int process( double* PCMData );
|
c@232
|
29
|
c@232
|
30 double krumCorr( double* pData1, double* pData2, unsigned int length );
|
c@232
|
31
|
c@232
|
32 unsigned int getBlockSize() { return m_ChromaFrameSize*m_DecimationFactor; }
|
c@232
|
33 unsigned int getHopSize() { return m_ChromaHopSize*m_DecimationFactor; }
|
c@232
|
34
|
c@232
|
35 double* getChroma() { return m_ChrPointer; }
|
daschuer@458
|
36 unsigned int getChromaSize();
|
c@232
|
37
|
c@232
|
38 double* getMeanHPCP() { return m_MeanHPCP; }
|
c@232
|
39
|
daschuer@459
|
40 double* getKeyStrengths();
|
c@265
|
41
|
c@268
|
42 bool isModeMinor( int key );
|
c@232
|
43
|
c@232
|
44 protected:
|
c@232
|
45
|
c@232
|
46 double m_hpcpAverage;
|
c@232
|
47 double m_medianAverage;
|
c@232
|
48 unsigned int m_DecimationFactor;
|
c@232
|
49
|
c@232
|
50 //Decimator (fixed)
|
c@232
|
51 Decimator* m_Decimator;
|
c@232
|
52
|
c@232
|
53 //chroma configuration
|
c@234
|
54 ChromaConfig m_ChromaConfig;
|
c@232
|
55
|
c@232
|
56 //Chromagram object
|
c@232
|
57 Chromagram* m_Chroma;
|
c@232
|
58
|
c@232
|
59 //Chromagram output pointer
|
c@232
|
60 double* m_ChrPointer;
|
c@232
|
61
|
c@232
|
62 //Framesize
|
c@232
|
63 unsigned int m_ChromaFrameSize;
|
c@232
|
64 //Hop
|
c@232
|
65 unsigned int m_ChromaHopSize;
|
c@232
|
66
|
c@232
|
67
|
c@232
|
68 unsigned int m_ChromaBuffersize;
|
c@232
|
69 unsigned int m_MedianWinsize;
|
c@232
|
70
|
c@232
|
71 unsigned int m_bufferindex;
|
c@232
|
72 unsigned int m_ChromaBufferFilling;
|
c@232
|
73 unsigned int m_MedianBufferFilling;
|
c@232
|
74
|
c@232
|
75
|
c@232
|
76 double* m_DecimatedBuffer;
|
c@232
|
77 double* m_ChromaBuffer;
|
c@232
|
78 double* m_MeanHPCP;
|
c@232
|
79
|
c@232
|
80 double* m_MajCorr;
|
c@232
|
81 double* m_MinCorr;
|
c@232
|
82 double* m_Keys;
|
c@232
|
83 int* m_MedianFilterBuffer;
|
c@232
|
84 int* m_SortedBuffer;
|
c@265
|
85
|
c@265
|
86 double *m_keyStrengths;
|
c@232
|
87 };
|
c@232
|
88
|
c@232
|
89 #endif // !defined GETKEYMODE_H
|