Chris@7: /* Chris@7: CHP Chris@7: Copyright (c) 2014 Queen Mary, University of London Chris@7: Chris@7: Permission is hereby granted, free of charge, to any person Chris@7: obtaining a copy of this software and associated documentation Chris@7: files (the "Software"), to deal in the Software without Chris@7: restriction, including without limitation the rights to use, copy, Chris@7: modify, merge, publish, distribute, sublicense, and/or sell copies Chris@7: of the Software, and to permit persons to whom the Software is Chris@7: furnished to do so, subject to the following conditions: Chris@7: Chris@7: The above copyright notice and this permission notice shall be Chris@7: included in all copies or substantial portions of the Software. Chris@7: Chris@7: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Chris@7: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Chris@7: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND Chris@7: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY Chris@7: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF Chris@7: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION Chris@7: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Chris@7: */ Chris@7: Chris@0: #ifndef CONSTRAINEDHARMONICPEAK_H Chris@0: #define CONSTRAINEDHARMONICPEAK_H Chris@0: Chris@0: #include Chris@0: Chris@0: using std::string; Chris@0: Chris@0: class ConstrainedHarmonicPeak : public Vamp::Plugin Chris@0: { Chris@0: public: Chris@0: ConstrainedHarmonicPeak(float inputSampleRate); Chris@0: virtual ~ConstrainedHarmonicPeak(); Chris@0: Chris@0: string getIdentifier() const; Chris@0: string getName() const; Chris@0: string getDescription() const; Chris@0: string getMaker() const; Chris@0: int getPluginVersion() const; Chris@0: string getCopyright() const; Chris@0: Chris@0: InputDomain getInputDomain() const; Chris@0: size_t getPreferredBlockSize() const; Chris@0: size_t getPreferredStepSize() const; Chris@0: size_t getMinChannelCount() const; Chris@0: size_t getMaxChannelCount() const; Chris@0: Chris@0: ParameterList getParameterDescriptors() const; Chris@0: float getParameter(string identifier) const; Chris@0: void setParameter(string identifier, float value); Chris@0: Chris@0: ProgramList getPrograms() const; Chris@0: string getCurrentProgram() const; Chris@0: void selectProgram(string name); Chris@0: Chris@0: OutputList getOutputDescriptors() const; Chris@0: Chris@0: bool initialise(size_t channels, size_t stepSize, size_t blockSize); Chris@0: void reset(); Chris@0: Chris@0: FeatureSet process(const float *const *inputBuffers, Chris@0: Vamp::RealTime timestamp); Chris@0: Chris@0: FeatureSet getRemainingFeatures(); Chris@0: Chris@0: protected: Chris@4: int m_fftSize; Chris@0: float m_minFreq; Chris@0: float m_maxFreq; Chris@1: int m_harmonics; Chris@1: Chris@1: static double findInterpolatedPeak(const double *in, int peakbin, int bins); Chris@0: }; Chris@0: Chris@0: Chris@0: Chris@0: #endif