NOOP, remove trailing tabs/whitespace.
[ardour.git] / libs / audiographer / audiographer / general / normalizer.h
1 #ifndef AUDIOGRAPHER_NORMALIZER_H
2 #define AUDIOGRAPHER_NORMALIZER_H
3
4 #include "audiographer/visibility.h"
5 #include "audiographer/sink.h"
6 #include "audiographer/routines.h"
7 #include "audiographer/utils/listed_source.h"
8
9 namespace AudioGrapher
10 {
11
12 /// A class for normalizing to a specified target in dB
13 class LIBAUDIOGRAPHER_API Normalizer
14   : public ListedSource<float>
15   , public Sink<float>
16   , public Throwing<>
17 {
18 public:
19         /// Constructs a normalizer with a specific target in dB \n RT safe
20         Normalizer (float target_dB);
21         ~Normalizer();
22
23         /// Sets the peak found in the material to be normalized \see PeakReader \n RT safe
24         void set_peak (float peak);
25
26         /** Allocates a buffer for using with const ProcessContexts
27           * This function does not need to be called if
28           * non-const ProcessContexts are given to \a process() .
29           * \n Not RT safe
30           */
31         void alloc_buffer(framecnt_t frames);
32
33         /// Process a const ProcessContext \see alloc_buffer() \n RT safe
34         void process (ProcessContext<float> const & c);
35
36         /// Process a non-const ProcsesContext in-place \n RT safe
37         void process (ProcessContext<float> & c);
38
39 private:
40         bool      enabled;
41         float     target;
42         float     gain;
43
44         float *   buffer;
45         framecnt_t buffer_size;
46 };
47
48
49 } // namespace
50
51 #endif // AUDIOGRAPHER_NORMALIZER_H