TonalAnalysis.hxx
Go to the documentation of this file.00001
00002 #ifndef TonalAnalysis_hxx
00003 #define TonalAnalysis_hxx
00004
00005 #include "DataTypes.hxx"
00006 #include "DiscontinuousSegmentation.hxx"
00007 #include "OutPort.hxx"
00008 #include "AudioInPort.hxx"
00009 #include "Processing.hxx"
00010 #include "Audio.hxx"
00011 #include "ProcessingConfig.hxx"
00012 #include <string>
00013
00014 namespace Simac { class ChordExtractor; }
00015
00016 namespace CLAM
00017 {
00018
00019 class TonalAnalysisConfig : public ProcessingConfig
00020 {
00021 public:
00022 DYNAMIC_TYPE_USING_INTERFACE (TonalAnalysisConfig, 5, ProcessingConfig);
00023 DYN_ATTRIBUTE (0, public, double, FilterInertia);
00024 DYN_ATTRIBUTE (1, public, bool, TunningEnabled);
00025 DYN_ATTRIBUTE (2, public, bool, PeakWindowingEnabled);
00026 DYN_ATTRIBUTE (3, public, double, HopRatio);
00027 DYN_ATTRIBUTE (4, public, unsigned, SegmentationMethod);
00028 protected:
00029 void DefaultInit(void);
00030 };
00031
00032 class TonalAnalysis : public Processing
00033 {
00034 private:
00035
00036 TonalAnalysisConfig _config;
00037 AudioInPort _input;
00038 OutPort<std::vector<CLAM::TData> > _pcp;
00039 OutPort<std::vector<CLAM::TData> > _chordCorrelation;
00040 OutPort<DiscontinuousSegmentation> _segmentation;
00041 OutPort<std::vector<std::pair<CLAM::TData, CLAM::TData> > > _chromaPeaks;
00042 OutPort<std::pair<CLAM::TData, CLAM::TData> > _tunning;
00043
00044 public:
00045 TonalAnalysis( const TonalAnalysisConfig & config = TonalAnalysisConfig() );
00046
00047 bool Do();
00048 virtual ~TonalAnalysis();
00049 const char * GetClassName() const {return "TonalAnalysis";}
00050
00051 inline const ProcessingConfig &GetConfig() const { return _config;}
00052 bool ConcreteConfigure(const ProcessingConfig& c);
00053 bool ConcreteStart();
00054 bool ConcreteStop();
00055 private:
00056 Simac::ChordExtractor * _implementation;
00057 std::vector<float> _floatBuffer;
00058 CLAM::TData _currentTime;
00059
00060 };
00061
00062 }
00063
00064 #endif
00065
00066
00067