qm-dsp  1.8
GetKeyMode.h
Go to the documentation of this file.
00001 /*
00002     Copyright (c) 2005 Centre for Digital Music ( C4DM )
00003                        Queen Mary Univesrity of London
00004 
00005     This program is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU General Public License as
00007     published by the Free Software Foundation; either version 2 of the
00008     License, or (at your option) any later version.  See the file
00009     COPYING included with this distribution for more information.
00010  */
00011 
00012 #ifndef GETKEYMODE_H
00013 #define GETKEYMODE_H
00014 
00015 
00016 #include "dsp/rateconversion/Decimator.h"
00017 #include "dsp/chromagram/Chromagram.h"
00018 
00019 
00020 class GetKeyMode  
00021 {
00022 public:
00023         GetKeyMode( int sampleRate, float tuningFrequency,
00024                     double hpcpAverage, double medianAverage );
00025 
00026         virtual ~GetKeyMode();
00027 
00028         int process( double* PCMData );
00029 
00030         double krumCorr( double* pData1, double* pData2, unsigned int length );
00031 
00032         unsigned int getBlockSize() { return m_ChromaFrameSize*m_DecimationFactor; }
00033         unsigned int getHopSize() { return m_ChromaHopSize*m_DecimationFactor; }
00034 
00035         double* getChroma() { return m_ChrPointer; }
00036         unsigned int getChromaSize() { return m_BPO; }
00037 
00038         double* getMeanHPCP() { return m_MeanHPCP; }
00039 
00040         double *getKeyStrengths() { return m_keyStrengths; }
00041 
00042         bool isModeMinor( int key ); 
00043 
00044 protected:
00045 
00046         double m_hpcpAverage;
00047         double m_medianAverage;
00048         unsigned int m_DecimationFactor;
00049 
00050         //Decimator (fixed)
00051         Decimator* m_Decimator;
00052 
00053         //chroma configuration
00054         ChromaConfig m_ChromaConfig;
00055 
00056         //Chromagram object
00057         Chromagram* m_Chroma;
00058 
00059         //Chromagram output pointer
00060         double* m_ChrPointer;
00061 
00062         //Framesize
00063         unsigned int m_ChromaFrameSize;
00064         //Hop
00065         unsigned int m_ChromaHopSize;
00066         //Bins per octave
00067         unsigned int m_BPO;
00068 
00069 
00070         unsigned int m_ChromaBuffersize;
00071         unsigned int m_MedianWinsize;
00072         
00073         unsigned int m_bufferindex;
00074         unsigned int m_ChromaBufferFilling;
00075         unsigned int m_MedianBufferFilling;
00076         
00077 
00078         double* m_DecimatedBuffer;
00079         double* m_ChromaBuffer;
00080         double* m_MeanHPCP;
00081 
00082         double* m_MajCorr;
00083         double* m_MinCorr;
00084         double* m_Keys;
00085         int* m_MedianFilterBuffer;
00086         int* m_SortedBuffer;
00087 
00088         double *m_keyStrengths;
00089 };
00090 
00091 #endif // !defined GETKEYMODE_H