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@49
|
53 std::string getIdentifier() const;
|
cannam@35
|
54 std::string getName() const;
|
cannam@35
|
55 std::string getDescription() const;
|
cannam@35
|
56 std::string getMaker() const;
|
cannam@35
|
57 int getPluginVersion() const;
|
cannam@35
|
58 std::string getCopyright() const;
|
cannam@35
|
59
|
cannam@35
|
60 size_t getPreferredStepSize() const;
|
cannam@35
|
61 size_t getPreferredBlockSize() const;
|
cannam@35
|
62
|
cannam@35
|
63 ParameterList getParameterDescriptors() const;
|
cannam@49
|
64 float getParameter(std::string id) const;
|
cannam@49
|
65 void setParameter(std::string id, float value);
|
cannam@35
|
66
|
cannam@35
|
67 OutputList getOutputDescriptors() const;
|
cannam@35
|
68
|
cannam@47
|
69 FeatureSet process(const float *const *inputBuffers,
|
cannam@47
|
70 Vamp::RealTime timestamp);
|
cannam@35
|
71
|
cannam@35
|
72 FeatureSet getRemainingFeatures();
|
cannam@35
|
73
|
cannam@35
|
74 protected:
|
cannam@35
|
75 size_t m_stepSize;
|
cannam@35
|
76 size_t m_blockSize;
|
cannam@35
|
77
|
cannam@35
|
78 float m_threshold;
|
cannam@35
|
79 float m_sensitivity;
|
cannam@35
|
80 float *m_priorMagnitudes;
|
cannam@35
|
81 float m_dfMinus1;
|
cannam@35
|
82 float m_dfMinus2;
|
cannam@35
|
83 };
|
cannam@35
|
84
|
cannam@35
|
85
|
cannam@35
|
86 #endif
|