eb7c89e50c8ae187ad82a9e3849a4866a5dfc632
[vamp-aubio-plugins.git] / plugins / Silence.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 _SILENCE_PLUGIN_H_
18 #define _SILENCE_PLUGIN_H_
19
20 #include <vamp-sdk/Plugin.h>
21 #include <aubio/aubio.h>
22
23 class Silence : public Vamp::Plugin
24 {
25 public:
26     Silence(float inputSampleRate, unsigned int apiVersion);
27     virtual ~Silence();
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 getIdentifier() const;
35     std::string getName() const;
36     std::string getDescription() const;
37     std::string getMaker() const;
38     int getPluginVersion() const;
39     std::string getCopyright() const;
40
41     ParameterList getParameterDescriptors() const;
42     float getParameter(std::string) const;
43     void setParameter(std::string, float);
44
45     size_t getPreferredStepSize() const;
46     size_t getPreferredBlockSize() const;
47
48     OutputList getOutputDescriptors() const;
49
50     FeatureSet process(const float *const *inputBuffers,
51                        Vamp::RealTime timestamp);
52
53     FeatureSet getRemainingFeatures();
54
55 protected:
56     unsigned int m_apiVersion;
57     fvec_t *m_ibuf;
58     fvec_t *m_pbuf;
59     smpl_t **m_tmpptrs;
60     float m_threshold;
61     size_t m_stepSize;
62     size_t m_blockSize;
63     size_t m_channelCount;
64     bool m_prevSilent;
65     bool m_first;
66     Vamp::RealTime m_lastChange;
67     Vamp::RealTime m_lastTimestamp;
68 };
69
70
71 #endif