bbc-vamp-plugins
1.0
|
00001 00018 #ifndef _ENERGY_H_ 00019 #define _ENERGY_H_ 00020 00021 #include <cmath> 00022 #include <vector> 00023 #include <algorithm> 00024 #include <vamp-sdk/Plugin.h> 00025 00026 using std::string; 00027 using std::vector; 00028 00075 class Energy : public Vamp::Plugin 00076 { 00077 public: 00079 Energy(float inputSampleRate); 00080 virtual ~Energy(); 00081 string getIdentifier() const; 00082 string getName() const; 00083 string getDescription() const; 00084 string getMaker() const; 00085 int getPluginVersion() const; 00086 string getCopyright() const; 00087 InputDomain getInputDomain() const; 00088 size_t getPreferredBlockSize() const; 00089 size_t getPreferredStepSize() const; 00090 size_t getMinChannelCount() const; 00091 size_t getMaxChannelCount() const; 00092 ParameterList getParameterDescriptors() const; 00093 float getParameter(string identifier) const; 00094 void setParameter(string identifier, 00095 float value); 00096 ProgramList getPrograms() const; 00097 string getCurrentProgram() const; 00098 void selectProgram(string name); 00099 OutputList getOutputDescriptors() const; 00100 bool initialise(size_t channels, 00101 size_t stepSize, 00102 size_t blockSize); 00103 void reset(); 00104 FeatureSet process(const float *const *inputBuffers, 00105 Vamp::RealTime timestamp); 00106 FeatureSet getRemainingFeatures(); 00108 00109 protected: 00111 int m_blockSize, m_stepSize; 00113 00114 float sampleRate; 00115 bool useRoot; 00116 float threshRatio; 00117 vector<float> rmsEnergy; 00118 float prevRMS; 00119 float avgWindowLength; 00120 float avgPercentile; 00121 float dipThresh; 00122 }; 00123 00124 00125 00126 #endif