annotate examples/PercussionOnsetDetector.h @ 35:154f86cb8c99

* Add an implementation of Dan Barry's percussion onset detector
author cannam
date Wed, 20 Sep 2006 13:51:22 +0000
parents
children be8fdfe25693
rev   line source
cannam@35 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@35 2
cannam@35 3 /*
cannam@35 4 Vamp
cannam@35 5
cannam@35 6 An API for audio analysis and feature extraction plugins.
cannam@35 7
cannam@35 8 Centre for Digital Music, Queen Mary, University of London.
cannam@35 9 Copyright 2006 Chris Cannam.
cannam@35 10
cannam@35 11 Permission is hereby granted, free of charge, to any person
cannam@35 12 obtaining a copy of this software and associated documentation
cannam@35 13 files (the "Software"), to deal in the Software without
cannam@35 14 restriction, including without limitation the rights to use, copy,
cannam@35 15 modify, merge, publish, distribute, sublicense, and/or sell copies
cannam@35 16 of the Software, and to permit persons to whom the Software is
cannam@35 17 furnished to do so, subject to the following conditions:
cannam@35 18
cannam@35 19 The above copyright notice and this permission notice shall be
cannam@35 20 included in all copies or substantial portions of the Software.
cannam@35 21
cannam@35 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
cannam@35 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
cannam@35 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
cannam@35 25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
cannam@35 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
cannam@35 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
cannam@35 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
cannam@35 29
cannam@35 30 Except as contained in this notice, the names of the Centre for
cannam@35 31 Digital Music; Queen Mary, University of London; and Chris Cannam
cannam@35 32 shall not be used in advertising or otherwise to promote the sale,
cannam@35 33 use or other dealings in this Software without prior written
cannam@35 34 authorization.
cannam@35 35 */
cannam@35 36
cannam@35 37 #ifndef _PERCUSSION_ONSET_DETECTOR_PLUGIN_H_
cannam@35 38 #define _PERCUSSION_ONSET_DETECTOR_PLUGIN_H_
cannam@35 39
cannam@35 40 #include "Plugin.h"
cannam@35 41
cannam@35 42 class PercussionOnsetDetector : public Vamp::Plugin
cannam@35 43 {
cannam@35 44 public:
cannam@35 45 PercussionOnsetDetector(float inputSampleRate);
cannam@35 46 virtual ~PercussionOnsetDetector();
cannam@35 47
cannam@35 48 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
cannam@35 49 void reset();
cannam@35 50
cannam@35 51 InputDomain getInputDomain() const { return FrequencyDomain; }
cannam@35 52
cannam@35 53 std::string getName() const;
cannam@35 54 std::string getDescription() const;
cannam@35 55 std::string getMaker() const;
cannam@35 56 int getPluginVersion() const;
cannam@35 57 std::string getCopyright() const;
cannam@35 58
cannam@35 59 size_t getPreferredStepSize() const;
cannam@35 60 size_t getPreferredBlockSize() const;
cannam@35 61
cannam@35 62 ParameterList getParameterDescriptors() const;
cannam@35 63 float getParameter(std::string name) const;
cannam@35 64 void setParameter(std::string name, float value);
cannam@35 65
cannam@35 66 OutputList getOutputDescriptors() const;
cannam@35 67
cannam@35 68 FeatureSet process(float **inputBuffers, Vamp::RealTime timestamp);
cannam@35 69
cannam@35 70 FeatureSet getRemainingFeatures();
cannam@35 71
cannam@35 72 protected:
cannam@35 73 size_t m_stepSize;
cannam@35 74 size_t m_blockSize;
cannam@35 75
cannam@35 76 float m_threshold;
cannam@35 77 float m_sensitivity;
cannam@35 78 float *m_priorMagnitudes;
cannam@35 79 float m_dfMinus1;
cannam@35 80 float m_dfMinus2;
cannam@35 81 };
cannam@35 82
cannam@35 83
cannam@35 84 #endif