* Add tempo tracker plugin from piem
[vamp-aubio-plugins.git] / plugins / Tempo.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 program is free software; you can redistribute it and/or
10     modify it under the terms of the GNU General Public License as
11     published by the Free Software Foundation; either version 2 of the
12     License, or (at your option) any later version.  See the file
13     COPYING included with this distribution for more information.
14
15 */
16
17 #ifndef _TEMPO_PLUGIN_H_
18 #define _TEMPO_PLUGIN_H_
19
20 #include <vamp-sdk/Plugin.h>
21 #include <aubio/aubio.h>
22
23 class Tempo : public Vamp::Plugin
24 {
25 public:
26     Tempo(float inputSampleRate);
27     virtual ~Tempo();
28
29     bool initialise(size_t channels, size_t stepSize, size_t blockSize);
30     void reset();
31
32     InputDomain getInputDomain() const { return TimeDomain; }
33
34     std::string getName() const;
35     std::string getDescription() const;
36     std::string getMaker() const;
37     int getPluginVersion() const;
38     std::string getCopyright() const;
39
40     ParameterList getParameterDescriptors() const;
41     float getParameter(std::string) const;
42     void setParameter(std::string, float);
43
44     size_t getPreferredStepSize() const;
45     size_t getPreferredBlockSize() const;
46
47     OutputList getOutputDescriptors() const;
48
49     FeatureSet process(float **inputBuffers, Vamp::RealTime timestamp);
50
51     FeatureSet getRemainingFeatures();
52
53 protected:
54     fvec_t *m_ibuf;
55     cvec_t *m_fftgrain;
56     fvec_t *m_onset;
57     aubio_pvoc_t *m_pv;
58     aubio_pickpeak_t *m_peakpick;
59     aubio_onsetdetection_t *m_onsetdet;
60     aubio_onsetdetection_type m_onsettype;
61     aubio_beattracking_t *m_beattracking;
62     fvec_t *m_dfframe;
63     fvec_t *m_btout;
64     uint_t m_winlen;
65     sint_t m_btstep;
66     sint_t m_btcounter;
67     float m_threshold;
68     float m_silence;
69     size_t m_stepSize;
70     size_t m_blockSize;
71     size_t m_channelCount;
72     Vamp::RealTime m_delay;
73     Vamp::RealTime m_lastBeat;
74 };
75
76
77 #endif