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