scripts/get_aubio.sh: use get_waf.sh, add windows options
[vamp-aubio-plugins.git] / plugins / Notes.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2
3 /*
4     Vamp feature extraction plugins using Paul Brossier's Aubio library.
5
6     Centre for Digital Music, Queen Mary, University of London.
7     This file copyright 2006 Chris Cannam.
8     
9     This file is part of vamp-aubio-plugins.
10
11     vamp-aubio is free software: you can redistribute it and/or modify
12     it under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
15
16     vamp-aubio is distributed in the hope that it will be useful,
17     but WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19     GNU General Public License for more details.
20
21     You should have received a copy of the GNU General Public License
22     along with aubio.  If not, see <http://www.gnu.org/licenses/>.
23
24 */
25
26 #ifndef _NOTES_PLUGIN_H_
27 #define _NOTES_PLUGIN_H_
28
29 #include <vamp-sdk/Plugin.h>
30 #include <aubio/aubio.h>
31
32 #include <deque>
33
34 #include "Types.h"
35
36 class Notes : public Vamp::Plugin
37 {
38 public:
39     Notes(float inputSampleRate);
40     virtual ~Notes();
41
42     bool initialise(size_t channels, size_t stepSize, size_t blockSize);
43     void reset();
44
45     InputDomain getInputDomain() const { return TimeDomain; }
46
47     std::string getIdentifier() const;
48     std::string getName() const;
49     std::string getDescription() const;
50     std::string getMaker() const;
51     int getPluginVersion() const;
52     std::string getCopyright() const;
53
54     ParameterList getParameterDescriptors() const;
55     float getParameter(std::string) const;
56     void setParameter(std::string, float);
57
58     size_t getPreferredStepSize() const;
59     size_t getPreferredBlockSize() const;
60
61     OutputList getOutputDescriptors() const;
62
63     FeatureSet process(const float *const *inputBuffers,
64                        Vamp::RealTime timestamp);
65
66     FeatureSet getRemainingFeatures();
67
68 protected:
69     fvec_t *m_ibuf;
70     fvec_t *m_onset;
71     fvec_t *m_pitch;
72     aubio_onset_t *m_onsetdet;
73     OnsetType m_onsettype;
74     aubio_pitch_t *m_pitchdet;
75     PitchType m_pitchtype;
76     float m_threshold;
77     float m_silence;
78     float m_minioi;
79     size_t m_median;
80     size_t m_stepSize;
81     size_t m_blockSize;
82     int m_minpitch;
83     int m_maxpitch;
84     bool m_wrapRange;
85     bool m_avoidLeaps;
86     std::deque<float> m_notebuf;
87     size_t m_count;
88     Vamp::RealTime m_delay;
89     Vamp::RealTime m_currentOnset;
90     Vamp::RealTime m_lastTimeStamp;
91     float m_currentLevel;
92     bool m_haveCurrent;
93     int m_prevPitch;
94
95     void pushNote(FeatureSet &, const Vamp::RealTime &);
96 };
97
98
99 #endif