Start overhaul for (current git, presumably later v0.4.0) aubio API
[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 #include "Types.h"
24
25 class Tempo : public Vamp::Plugin
26 {
27 public:
28     Tempo(float inputSampleRate);
29     virtual ~Tempo();
30
31     bool initialise(size_t channels, size_t stepSize, size_t blockSize);
32     void reset();
33
34     InputDomain getInputDomain() const { return TimeDomain; }
35
36     std::string getIdentifier() const;
37     std::string getName() const;
38     std::string getDescription() const;
39     std::string getMaker() const;
40     int getPluginVersion() const;
41     std::string getCopyright() const;
42
43     ParameterList getParameterDescriptors() const;
44     float getParameter(std::string) const;
45     void setParameter(std::string, float);
46
47     size_t getPreferredStepSize() const;
48     size_t getPreferredBlockSize() const;
49
50     OutputList getOutputDescriptors() const;
51
52     FeatureSet process(const float *const *inputBuffers, Vamp::RealTime timestamp);
53
54     FeatureSet getRemainingFeatures();
55
56 protected:
57     fvec_t *m_ibuf;
58     cvec_t *m_fftgrain;
59     fvec_t *m_onset;
60     aubio_pvoc_t *m_pv;
61     aubio_peakpicker_t *m_peakpick;
62     aubio_onset_t *m_onsetdet;
63     OnsetType m_onsettype;
64     aubio_tempo_t *m_tempo;
65     fvec_t *m_dfframe;
66     fvec_t *m_btout;
67     uint_t m_winlen;
68     sint_t m_btstep;
69     sint_t m_btcounter;
70     float m_threshold;
71     float m_silence;
72     size_t m_stepSize;
73     size_t m_blockSize;
74     size_t m_channelCount;
75     Vamp::RealTime m_delay;
76     Vamp::RealTime m_lastBeat;
77 };
78
79
80 #endif