cannam@35: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ cannam@35: cannam@35: /* cannam@35: Vamp cannam@35: cannam@35: An API for audio analysis and feature extraction plugins. cannam@35: cannam@35: Centre for Digital Music, Queen Mary, University of London. cannam@35: Copyright 2006 Chris Cannam. cannam@35: cannam@35: Permission is hereby granted, free of charge, to any person cannam@35: obtaining a copy of this software and associated documentation cannam@35: files (the "Software"), to deal in the Software without cannam@35: restriction, including without limitation the rights to use, copy, cannam@35: modify, merge, publish, distribute, sublicense, and/or sell copies cannam@35: of the Software, and to permit persons to whom the Software is cannam@35: furnished to do so, subject to the following conditions: cannam@35: cannam@35: The above copyright notice and this permission notice shall be cannam@35: included in all copies or substantial portions of the Software. cannam@35: cannam@35: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, cannam@35: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF cannam@35: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND cannam@35: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR cannam@35: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF cannam@35: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION cannam@35: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cannam@35: cannam@35: Except as contained in this notice, the names of the Centre for cannam@35: Digital Music; Queen Mary, University of London; and Chris Cannam cannam@35: shall not be used in advertising or otherwise to promote the sale, cannam@35: use or other dealings in this Software without prior written cannam@35: authorization. cannam@35: */ cannam@35: cannam@35: #ifndef _PERCUSSION_ONSET_DETECTOR_PLUGIN_H_ cannam@35: #define _PERCUSSION_ONSET_DETECTOR_PLUGIN_H_ cannam@35: cannam@59: #include "vamp-sdk/Plugin.h" cannam@35: cannam@54: /** cannam@54: * Example plugin that detects percussive events. cannam@54: */ cannam@54: cannam@35: class PercussionOnsetDetector : public Vamp::Plugin cannam@35: { cannam@35: public: cannam@35: PercussionOnsetDetector(float inputSampleRate); cannam@35: virtual ~PercussionOnsetDetector(); cannam@35: cannam@35: bool initialise(size_t channels, size_t stepSize, size_t blockSize); cannam@35: void reset(); cannam@35: cannam@35: InputDomain getInputDomain() const { return FrequencyDomain; } cannam@35: cannam@49: std::string getIdentifier() const; cannam@35: std::string getName() const; cannam@35: std::string getDescription() const; cannam@35: std::string getMaker() const; cannam@35: int getPluginVersion() const; cannam@35: std::string getCopyright() const; cannam@35: cannam@35: size_t getPreferredStepSize() const; cannam@35: size_t getPreferredBlockSize() const; cannam@35: cannam@35: ParameterList getParameterDescriptors() const; cannam@49: float getParameter(std::string id) const; cannam@49: void setParameter(std::string id, float value); cannam@35: cannam@35: OutputList getOutputDescriptors() const; cannam@35: cannam@47: FeatureSet process(const float *const *inputBuffers, cannam@47: Vamp::RealTime timestamp); cannam@35: cannam@35: FeatureSet getRemainingFeatures(); cannam@35: cannam@35: protected: cannam@35: size_t m_stepSize; cannam@35: size_t m_blockSize; cannam@35: cannam@35: float m_threshold; cannam@35: float m_sensitivity; cannam@35: float *m_priorMagnitudes; cannam@35: float m_dfMinus1; cannam@35: float m_dfMinus2; cannam@35: }; cannam@35: cannam@35: cannam@35: #endif