Chris@7
|
1 /*
|
Chris@7
|
2 CHP
|
Chris@7
|
3 Copyright (c) 2014 Queen Mary, University of London
|
Chris@7
|
4
|
Chris@7
|
5 Permission is hereby granted, free of charge, to any person
|
Chris@7
|
6 obtaining a copy of this software and associated documentation
|
Chris@7
|
7 files (the "Software"), to deal in the Software without
|
Chris@7
|
8 restriction, including without limitation the rights to use, copy,
|
Chris@7
|
9 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@7
|
10 of the Software, and to permit persons to whom the Software is
|
Chris@7
|
11 furnished to do so, subject to the following conditions:
|
Chris@7
|
12
|
Chris@7
|
13 The above copyright notice and this permission notice shall be
|
Chris@7
|
14 included in all copies or substantial portions of the Software.
|
Chris@7
|
15
|
Chris@7
|
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@7
|
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@7
|
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@7
|
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
Chris@7
|
20 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@7
|
21 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@7
|
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@7
|
23 */
|
Chris@7
|
24
|
Chris@0
|
25 #ifndef CONSTRAINEDHARMONICPEAK_H
|
Chris@0
|
26 #define CONSTRAINEDHARMONICPEAK_H
|
Chris@0
|
27
|
Chris@0
|
28 #include <vamp-sdk/Plugin.h>
|
Chris@0
|
29
|
Chris@0
|
30 using std::string;
|
Chris@0
|
31
|
Chris@0
|
32 class ConstrainedHarmonicPeak : public Vamp::Plugin
|
Chris@0
|
33 {
|
Chris@0
|
34 public:
|
Chris@0
|
35 ConstrainedHarmonicPeak(float inputSampleRate);
|
Chris@0
|
36 virtual ~ConstrainedHarmonicPeak();
|
Chris@0
|
37
|
Chris@0
|
38 string getIdentifier() const;
|
Chris@0
|
39 string getName() const;
|
Chris@0
|
40 string getDescription() const;
|
Chris@0
|
41 string getMaker() const;
|
Chris@0
|
42 int getPluginVersion() const;
|
Chris@0
|
43 string getCopyright() const;
|
Chris@0
|
44
|
Chris@0
|
45 InputDomain getInputDomain() const;
|
Chris@0
|
46 size_t getPreferredBlockSize() const;
|
Chris@0
|
47 size_t getPreferredStepSize() const;
|
Chris@0
|
48 size_t getMinChannelCount() const;
|
Chris@0
|
49 size_t getMaxChannelCount() const;
|
Chris@0
|
50
|
Chris@0
|
51 ParameterList getParameterDescriptors() const;
|
Chris@0
|
52 float getParameter(string identifier) const;
|
Chris@0
|
53 void setParameter(string identifier, float value);
|
Chris@0
|
54
|
Chris@0
|
55 ProgramList getPrograms() const;
|
Chris@0
|
56 string getCurrentProgram() const;
|
Chris@0
|
57 void selectProgram(string name);
|
Chris@0
|
58
|
Chris@0
|
59 OutputList getOutputDescriptors() const;
|
Chris@0
|
60
|
Chris@0
|
61 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
|
Chris@0
|
62 void reset();
|
Chris@0
|
63
|
Chris@0
|
64 FeatureSet process(const float *const *inputBuffers,
|
Chris@0
|
65 Vamp::RealTime timestamp);
|
Chris@0
|
66
|
Chris@0
|
67 FeatureSet getRemainingFeatures();
|
Chris@0
|
68
|
Chris@0
|
69 protected:
|
Chris@4
|
70 int m_fftSize;
|
Chris@0
|
71 float m_minFreq;
|
Chris@0
|
72 float m_maxFreq;
|
Chris@1
|
73 int m_harmonics;
|
Chris@1
|
74
|
Chris@1
|
75 static double findInterpolatedPeak(const double *in, int peakbin, int bins);
|
Chris@0
|
76 };
|
Chris@0
|
77
|
Chris@0
|
78
|
Chris@0
|
79
|
Chris@0
|
80 #endif
|