Chris@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@0
|
3 #ifndef FLATTENDYNAMICS_LADSPA_H
|
Chris@0
|
4 #define FLATTENDYNAMICS_LADSPA_H
|
Chris@0
|
5
|
Chris@0
|
6 #include <ladspa.h>
|
Chris@0
|
7
|
Chris@0
|
8 class FlattenDynamics
|
Chris@0
|
9 {
|
Chris@0
|
10 public:
|
Chris@0
|
11 static const LADSPA_Descriptor *getDescriptor(unsigned long index);
|
Chris@0
|
12
|
Chris@0
|
13 private:
|
Chris@0
|
14 FlattenDynamics(int sampleRate);
|
Chris@0
|
15 ~FlattenDynamics();
|
Chris@0
|
16
|
Chris@0
|
17 enum {
|
Chris@1
|
18 AudioInputPort = 0,
|
Chris@1
|
19 AudioOutputPort = 1,
|
Chris@1
|
20 GainOutputPort = 2,
|
Chris@1
|
21 PortCount = 3,
|
Chris@0
|
22 };
|
Chris@0
|
23
|
Chris@0
|
24 static const char *const portNames[PortCount];
|
Chris@0
|
25 static const LADSPA_PortDescriptor ports[PortCount];
|
Chris@0
|
26 static const LADSPA_PortRangeHint hints[PortCount];
|
Chris@0
|
27 static const LADSPA_Properties properties;
|
Chris@0
|
28 static const LADSPA_Descriptor ladspaDescriptor;
|
Chris@0
|
29
|
Chris@0
|
30 static LADSPA_Handle instantiate(const LADSPA_Descriptor *, unsigned long);
|
Chris@0
|
31 static void connectPort(LADSPA_Handle, unsigned long, LADSPA_Data *);
|
Chris@0
|
32 static void activate(LADSPA_Handle);
|
Chris@0
|
33 static void run(LADSPA_Handle, unsigned long);
|
Chris@0
|
34 static void deactivate(LADSPA_Handle);
|
Chris@0
|
35 static void cleanup(LADSPA_Handle);
|
Chris@0
|
36
|
Chris@0
|
37 void reset();
|
Chris@0
|
38 void runImpl(unsigned long);
|
Chris@1
|
39 float process(float);
|
Chris@1
|
40 void updateRMS(float);
|
Chris@0
|
41 void updateParameters();
|
Chris@0
|
42
|
Chris@0
|
43 int m_sampleRate;
|
Chris@0
|
44 float *m_input;
|
Chris@0
|
45 float *m_output;
|
Chris@1
|
46 float *m_pgain;
|
Chris@1
|
47
|
Chris@1
|
48 float *m_history;
|
Chris@1
|
49 int m_histlen;
|
Chris@1
|
50 int m_histwrite;
|
Chris@1
|
51 int m_histread;
|
Chris@1
|
52
|
Chris@7
|
53 double m_sumOfSquaresLongTerm;
|
Chris@7
|
54 double m_sumOfSquaresShortTerm;
|
Chris@7
|
55
|
Chris@7
|
56 float m_rmsLongTerm;
|
Chris@7
|
57 float m_rmsShortTerm;
|
Chris@7
|
58
|
Chris@7
|
59 float m_maxRmsLongTerm;
|
Chris@8
|
60 float m_maxRmsShortTerm;
|
Chris@7
|
61
|
Chris@1
|
62 float m_gain;
|
Chris@0
|
63 };
|
Chris@0
|
64
|
Chris@0
|
65 #endif
|