Ardour  9.0-pre0-582-g084a23a80d
loudness_reader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef AUDIOGRAPHER_LOUDNESS_READER_H
20 #define AUDIOGRAPHER_LOUDNESS_READER_H
21 
22 #include <vector>
23 
24 #include <vamp-hostsdk/PluginLoader.h>
25 
27 #include "audiographer/sink.h"
28 #include "audiographer/routines.h"
30 
31 namespace AudioGrapher
32 {
33 
34 class LIBAUDIOGRAPHER_API LoudnessReader : public ListedSource<float>, public Sink<float>
35 {
36  public:
37  LoudnessReader (float sample_rate, unsigned int channels, samplecnt_t bufsize);
39 
40  void reset ();
41 
42  float calc_peak (float target_lufs = -23, float target_dbtp = -1) const;
43  bool get_loudness (float* integrated, float* short_term = NULL, float* momentary = NULL) const;
44 
45  virtual void process (ProcessContext<float> const & c);
46 
48 
49  protected:
50  Vamp::Plugin* _ebur_plugin;
51  std::vector<Vamp::Plugin*> _dbtp_plugins;
52 
53  float _sample_rate;
54  unsigned int _channels;
57  float* _bufs[2];
58 };
59 
60 } // namespace
61 
62 
63 #endif // AUDIOGRAPHER_LOUDNESS_READER_H
An generic Source that uses a std::list for managing outputs.
Definition: listed_source.h:17
virtual void process(ProcessContext< float > const &c)
LoudnessReader(float sample_rate, unsigned int channels, samplecnt_t bufsize)
std::vector< Vamp::Plugin * > _dbtp_plugins
float calc_peak(float target_lufs=-23, float target_dbtp=-1) const
bool get_loudness(float *integrated, float *short_term=NULL, float *momentary=NULL) const