cannam@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
cannam@0
|
2
|
cannam@0
|
3 /*
|
cannam@0
|
4 Vamp feature extraction plugins using Jamie Bullock's
|
cannam@0
|
5 libxtract audio feature extraction library.
|
cannam@0
|
6
|
cannam@0
|
7 Centre for Digital Music, Queen Mary, University of London.
|
cannam@0
|
8 This file copyright 2006 Queen Mary, University of London.
|
cannam@0
|
9
|
cannam@0
|
10 This program is free software; you can redistribute it and/or
|
cannam@0
|
11 modify it under the terms of the GNU General Public License as
|
cannam@0
|
12 published by the Free Software Foundation; either version 2 of the
|
cannam@0
|
13 License, or (at your option) any later version. See the file
|
cannam@0
|
14 COPYING included with this distribution for more information.
|
cannam@0
|
15 */
|
cannam@0
|
16
|
cannam@0
|
17 #ifndef _XTRACT_PLUGIN_H_
|
cannam@0
|
18 #define _XTRACT_PLUGIN_H_
|
cannam@0
|
19
|
cannam@0
|
20 #include <vamp-sdk/Plugin.h>
|
cannam@1
|
21 #include <xtract/libxtract.h>
|
cannam@0
|
22
|
cannam@0
|
23 class XTractPlugin : public Vamp::Plugin
|
cannam@0
|
24 {
|
cannam@0
|
25 public:
|
cannam@0
|
26 XTractPlugin(unsigned int xtFeature, float inputSampleRate);
|
cannam@0
|
27 virtual ~XTractPlugin();
|
cannam@0
|
28
|
cannam@0
|
29 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
|
cannam@0
|
30 void reset();
|
cannam@0
|
31
|
cannam@0
|
32 InputDomain getInputDomain() const;
|
cannam@0
|
33
|
cannam@2
|
34 std::string getIdentifier() const;
|
cannam@0
|
35 std::string getName() const;
|
cannam@0
|
36 std::string getDescription() const;
|
cannam@0
|
37 std::string getMaker() const;
|
cannam@0
|
38 int getPluginVersion() const;
|
cannam@0
|
39 std::string getCopyright() const;
|
cannam@0
|
40
|
cannam@0
|
41 ParameterList getParameterDescriptors() const;
|
cannam@0
|
42 float getParameter(std::string) const;
|
cannam@0
|
43 void setParameter(std::string, float);
|
cannam@0
|
44
|
cannam@0
|
45 size_t getMinChannelCount() const;
|
cannam@0
|
46 size_t getMaxChannelCount() const;
|
cannam@0
|
47
|
cannam@0
|
48 size_t getPreferredStepSize() const;
|
cannam@0
|
49 size_t getPreferredBlockSize() const;
|
cannam@0
|
50
|
cannam@0
|
51 OutputList getOutputDescriptors() const;
|
cannam@0
|
52
|
cannam@0
|
53 FeatureSet process(const float *const *inputBuffers,
|
cannam@0
|
54 Vamp::RealTime timestamp);
|
cannam@0
|
55
|
cannam@0
|
56 FeatureSet getRemainingFeatures();
|
cannam@0
|
57
|
cannam@0
|
58 protected:
|
cannam@0
|
59 bool needPeakThreshold() const;
|
cannam@1
|
60 bool needHarmonicThreshold() const;
|
cannam@1
|
61 bool needRolloffThreshold() const;
|
cannam@0
|
62
|
cannam@0
|
63 mutable OutputList m_outputDescriptors;
|
cannam@0
|
64 void setupOutputDescriptors() const;
|
cannam@0
|
65
|
Chris@34
|
66 bool processSPF0(const double *data);
|
cannam@0
|
67
|
cannam@0
|
68 const unsigned int m_xtFeature;
|
cannam@0
|
69 size_t m_channels;
|
cannam@0
|
70 size_t m_stepSize;
|
cannam@0
|
71 size_t m_blockSize;
|
cannam@0
|
72
|
Chris@34
|
73 double *m_resultBuffer;
|
cannam@0
|
74
|
Chris@34
|
75 double m_peakThreshold;
|
Chris@34
|
76 double m_rolloffThreshold;
|
Chris@34
|
77 double m_harmonicThreshold;
|
cannam@0
|
78
|
Chris@34
|
79 double m_minFreq;
|
Chris@34
|
80 double m_maxFreq;
|
cannam@0
|
81
|
cannam@9
|
82 int m_coeffCount;
|
cannam@9
|
83 int m_highestCoef;
|
cannam@9
|
84 int m_lowestCoef;
|
Chris@34
|
85 double **m_mfccFilters;
|
cannam@0
|
86 int m_mfccStyle;
|
cannam@0
|
87
|
cannam@14
|
88 int m_spectrumType;
|
cannam@14
|
89 int m_dc;
|
cannam@14
|
90 int m_normalise;
|
cannam@14
|
91
|
cannam@0
|
92 int *m_barkBandLimits;
|
cannam@0
|
93
|
cannam@1
|
94 static xtract_function_descriptor_t *m_xtDescriptors;
|
cannam@1
|
95 static int m_xtDescRefCount;
|
cannam@1
|
96 xtract_function_descriptor_t *xtDescriptor() {
|
cannam@1
|
97 return &m_xtDescriptors[m_xtFeature];
|
cannam@1
|
98 }
|
cannam@1
|
99 const xtract_function_descriptor_t *xtDescriptor() const {
|
cannam@1
|
100 return &m_xtDescriptors[m_xtFeature];
|
cannam@1
|
101 }
|
cannam@1
|
102
|
cannam@0
|
103 size_t m_outputBinCount;
|
cannam@0
|
104 bool m_initialised;
|
cannam@9
|
105 static bool m_anyInitialised;
|
cannam@0
|
106 };
|
cannam@0
|
107
|
cannam@0
|
108
|
cannam@0
|
109 #endif
|