c@41
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
c@41
|
2
|
c@41
|
3 /*
|
c@41
|
4 * SimilarityPlugin.h
|
c@41
|
5 *
|
c@41
|
6 * Copyright 2008 Centre for Digital Music, Queen Mary, University of London.
|
c@41
|
7 * All rights reserved.
|
c@41
|
8 */
|
c@41
|
9
|
c@41
|
10 #ifndef _SIMILARITY_PLUGIN_H_
|
c@41
|
11 #define _SIMILARITY_PLUGIN_H_
|
c@41
|
12
|
c@41
|
13 #include <vamp-sdk/Plugin.h>
|
c@41
|
14 #include <vamp-sdk/RealTime.h>
|
c@41
|
15
|
c@41
|
16 class MFCC;
|
c@42
|
17 class Chromagram;
|
c@41
|
18 class Decimator;
|
c@41
|
19
|
c@41
|
20 class SimilarityPlugin : public Vamp::Plugin
|
c@41
|
21 {
|
c@41
|
22 public:
|
c@41
|
23 SimilarityPlugin(float inputSampleRate);
|
c@41
|
24 virtual ~SimilarityPlugin();
|
c@41
|
25
|
c@41
|
26 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
|
c@41
|
27 void reset();
|
c@41
|
28
|
c@41
|
29 std::string getIdentifier() const;
|
c@41
|
30 std::string getName() const;
|
c@41
|
31 std::string getDescription() const;
|
c@41
|
32 std::string getMaker() const;
|
c@41
|
33 int getPluginVersion() const;
|
c@41
|
34 std::string getCopyright() const;
|
c@41
|
35
|
c@41
|
36 size_t getPreferredStepSize() const;
|
c@41
|
37 size_t getPreferredBlockSize() const;
|
c@41
|
38 InputDomain getInputDomain() const { return TimeDomain; }
|
c@41
|
39
|
c@41
|
40 size_t getMinChannelCount() const;
|
c@41
|
41 size_t getMaxChannelCount() const;
|
c@41
|
42
|
c@41
|
43 SimilarityPlugin::ParameterList getParameterDescriptors() const;
|
c@41
|
44 float getParameter(std::string param) const;
|
c@41
|
45 void setParameter(std::string param, float value);
|
c@41
|
46
|
c@41
|
47 OutputList getOutputDescriptors() const;
|
c@41
|
48
|
c@41
|
49 FeatureSet process(const float *const *inputBuffers, Vamp::RealTime timestamp);
|
c@41
|
50
|
c@41
|
51 FeatureSet getRemainingFeatures();
|
c@41
|
52
|
c@41
|
53 protected:
|
c@41
|
54 int getDecimationFactor() const;
|
c@41
|
55
|
c@42
|
56 enum Type {
|
c@42
|
57 TypeMFCC,
|
c@42
|
58 TypeChroma
|
c@42
|
59 };
|
c@42
|
60
|
c@42
|
61 void calculateBlockSize() const;
|
c@42
|
62
|
c@42
|
63 Type m_type;
|
c@41
|
64 MFCC *m_mfcc;
|
c@42
|
65 Chromagram *m_chromagram;
|
c@41
|
66 Decimator *m_decimator;
|
c@42
|
67 int m_featureColumnSize;
|
c@42
|
68 mutable size_t m_blockSize;
|
c@42
|
69 size_t m_fftSize;
|
c@41
|
70 int m_channels;
|
c@41
|
71
|
c@42
|
72 typedef std::vector<double> FeatureColumn;
|
c@42
|
73 typedef std::vector<FeatureColumn> FeatureMatrix;
|
c@42
|
74 typedef std::vector<FeatureMatrix> FeatureMatrixSet;
|
c@41
|
75
|
c@42
|
76 FeatureMatrixSet m_values;
|
c@41
|
77 };
|
c@41
|
78
|
c@41
|
79 #endif
|
c@41
|
80
|