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