use new action map API instead of ActionManager::get_action
[ardour.git] / libs / vamp-plugins / TonalChangeDetect.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2
3 /*
4     QM Vamp Plugin Set
5
6     Centre for Digital Music, Queen Mary, University of London.
7
8     This program is free software; you can redistribute it and/or
9     modify it under the terms of the GNU General Public License as
10     published by the Free Software Foundation; either version 2 of the
11     License, or (at your option) any later version.  See the file
12     COPYING included with this distribution for more information.
13 */
14
15 #ifndef _TONALCHANGEDETECT_
16 #define _TONALCHANGEDETECT_
17
18 #include <vamp-sdk/Plugin.h>
19
20 #include <dsp/chromagram/Chromagram.h>
21 #include <dsp/tonal/TonalEstimator.h>
22 #include <dsp/tonal/TCSgram.h>
23
24 #include <queue>
25 #include <vector>
26 #include <valarray>
27
28 class TonalChangeDetect : public Vamp::Plugin
29 {
30 public:
31         TonalChangeDetect(float fInputSampleRate);
32         virtual ~TonalChangeDetect();
33
34     bool initialise(size_t channels, size_t stepSize, size_t blockSize);
35     void reset();
36
37     InputDomain getInputDomain() const { return TimeDomain; }
38
39     std::string getIdentifier() const;
40     std::string getName() const;
41     std::string getDescription() const;
42     std::string getMaker() const;
43     int getPluginVersion() const;
44     std::string getCopyright() const;
45
46     ParameterList getParameterDescriptors() const;
47     float getParameter(std::string) const;
48     void setParameter(std::string, float);
49
50
51     size_t getPreferredStepSize() const;
52     size_t getPreferredBlockSize() const;
53
54     OutputList getOutputDescriptors() const;
55
56     FeatureSet process(const float *const *inputBuffers,
57                        Vamp::RealTime timestamp);
58
59     FeatureSet getRemainingFeatures();
60         
61 private:
62     void setupConfig();
63
64     ChromaConfig m_config;
65     Chromagram *m_chromagram;
66     TonalEstimator m_TonalEstimator;
67     mutable size_t m_step;
68     mutable size_t m_block;
69     size_t m_stepDelay;
70     std::queue<ChromaVector> m_pending;
71     ChromaVector m_vaCurrentVector;
72     TCSGram m_TCSGram;
73         
74     int m_iSmoothingWidth;  // smoothing window size
75     int m_minMIDIPitch;     // chromagram parameters
76     int m_maxMIDIPitch;
77     float m_tuningFrequency;
78
79     Vamp::RealTime m_origin;
80     bool m_haveOrigin;
81 };
82
83
84 #endif // _TONALCHANGEDETECT_