annotate examples/PercussionOnsetDetector.h @ 449:b89653767a60 vampipe

Add forgotten file...
author Chris Cannam
date Mon, 22 Aug 2016 10:14:49 +0100
parents 9d3272c7db60
children
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@64 40 #include "vamp-sdk/Plugin.h"
cannam@35 41
cannam@54 42 /**
cannam@54 43 * Example plugin that detects percussive events.
cannam@54 44 */
cannam@54 45
cannam@35 46 class PercussionOnsetDetector : public Vamp::Plugin
cannam@35 47 {
cannam@35 48 public:
cannam@35 49 PercussionOnsetDetector(float inputSampleRate);
cannam@35 50 virtual ~PercussionOnsetDetector();
cannam@35 51
cannam@35 52 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
cannam@35 53 void reset();
cannam@35 54
cannam@35 55 InputDomain getInputDomain() const { return FrequencyDomain; }
cannam@35 56
cannam@49 57 std::string getIdentifier() const;
cannam@35 58 std::string getName() const;
cannam@35 59 std::string getDescription() const;
cannam@35 60 std::string getMaker() const;
cannam@35 61 int getPluginVersion() const;
cannam@35 62 std::string getCopyright() const;
cannam@35 63
cannam@35 64 size_t getPreferredStepSize() const;
cannam@35 65 size_t getPreferredBlockSize() const;
cannam@35 66
cannam@35 67 ParameterList getParameterDescriptors() const;
cannam@49 68 float getParameter(std::string id) const;
cannam@49 69 void setParameter(std::string id, float value);
cannam@35 70
cannam@35 71 OutputList getOutputDescriptors() const;
cannam@35 72
cannam@47 73 FeatureSet process(const float *const *inputBuffers,
cannam@47 74 Vamp::RealTime timestamp);
cannam@35 75
cannam@35 76 FeatureSet getRemainingFeatures();
cannam@35 77
cannam@35 78 protected:
cannam@35 79 size_t m_stepSize;
cannam@35 80 size_t m_blockSize;
cannam@35 81
cannam@35 82 float m_threshold;
cannam@35 83 float m_sensitivity;
cannam@35 84 float *m_priorMagnitudes;
cannam@35 85 float m_dfMinus1;
cannam@35 86 float m_dfMinus2;
cannam@35 87 };
cannam@35 88
cannam@35 89
cannam@35 90 #endif