Merge branch 'windows' of git.ardour.org:ardour/ardour into windows
[ardour.git] / libs / qm-dsp / dsp / keydetection / GetKeyMode.h
1 /*\r
2  * Author: c.landone \r
3  * Description:\r
4  *\r
5  * Syntax: C++\r
6  *\r
7  * Copyright (c) 2005 Centre for Digital Music ( C4DM )\r
8  *                    Queen Mary Univesrity of London\r
9  *\r
10  *\r
11  * This program is not free software; you cannot redistribute it \r
12  * without the explicit authorization from the centre for digital music,\r
13  * queen mary university of london \r
14  *\r
15  */\r
16 \r
17 #ifndef GETKEYMODE_H\r
18 #define GETKEYMODE_H\r
19 \r
20 \r
21 #include "dsp/rateconversion/Decimator.h"\r
22 #include "dsp/chromagram/Chromagram.h"\r
23 \r
24 \r
25 class GetKeyMode  \r
26 {\r
27 public:\r
28         GetKeyMode( int sampleRate, float tuningFrequency,\r
29                     double hpcpAverage, double medianAverage );\r
30 \r
31         virtual ~GetKeyMode();\r
32 \r
33         int process( double* PCMData );\r
34 \r
35         double krumCorr( double* pData1, double* pData2, unsigned int length );\r
36 \r
37         unsigned int getBlockSize() { return m_ChromaFrameSize*m_DecimationFactor; }\r
38         unsigned int getHopSize() { return m_ChromaHopSize*m_DecimationFactor; }\r
39 \r
40         double* getChroma() { return m_ChrPointer; }\r
41         unsigned int getChromaSize() { return m_BPO; }\r
42 \r
43         double* getMeanHPCP() { return m_MeanHPCP; }\r
44 \r
45         double *getKeyStrengths() { return m_keyStrengths; }\r
46 \r
47         bool isModeMinor( int key ); \r
48 \r
49 protected:\r
50 \r
51         double m_hpcpAverage;\r
52         double m_medianAverage;\r
53         unsigned int m_DecimationFactor;\r
54 \r
55         //Decimator (fixed)\r
56         Decimator* m_Decimator;\r
57 \r
58         //chroma configuration\r
59         ChromaConfig m_ChromaConfig;\r
60 \r
61         //Chromagram object\r
62         Chromagram* m_Chroma;\r
63 \r
64         //Chromagram output pointer\r
65         double* m_ChrPointer;\r
66 \r
67         //Framesize\r
68         unsigned int m_ChromaFrameSize;\r
69         //Hop\r
70         unsigned int m_ChromaHopSize;\r
71         //Bins per octave\r
72         unsigned int m_BPO;\r
73 \r
74 \r
75         unsigned int m_ChromaBuffersize;\r
76         unsigned int m_MedianWinsize;\r
77         \r
78         unsigned int m_bufferindex;\r
79         unsigned int m_ChromaBufferFilling;\r
80         unsigned int m_MedianBufferFilling;\r
81         \r
82 \r
83         double* m_DecimatedBuffer;\r
84         double* m_ChromaBuffer;\r
85         double* m_MeanHPCP;\r
86 \r
87         double* m_MajCorr;\r
88         double* m_MinCorr;\r
89         double* m_Keys;\r
90         int* m_MedianFilterBuffer;\r
91         int* m_SortedBuffer;\r
92 \r
93         double *m_keyStrengths;\r
94 };\r
95 \r
96 #endif // !defined GETKEYMODE_H\r