Ardour
9.0-pre0-582-g084a23a80d
private/limiter/limiter.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2010-2018 Fons Adriaensen <fons@linuxaudio.org>
3
* Copyright (C) 2021 Robin Gareus <robin@gareus.org>
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef _PEAKLIM_H
20
#define _PEAKLIM_H
21
22
#include <stdint.h>
23
24
namespace
AudioGrapherDSP
{
25
26
class
Limiter
27
{
28
public
:
29
Limiter
();
30
~Limiter
();
31
32
void
init
(
float
fsamp,
int
nchan);
33
void
fini
();
34
35
void
set_inpgain
(
float
);
36
void
set_threshold
(
float
);
37
void
set_release
(
float
);
38
void
set_truepeak
(
bool
);
39
40
int
41
get_latency
()
const
42
{
43
return
_delay
;
44
}
45
46
void
47
get_stats
(
float
* peak,
float
* gmax,
float
* gmin)
48
{
49
*peak =
_peak
;
50
*gmax =
_gmax
;
51
*gmin =
_gmin
;
52
_rstat
=
true
;
53
}
54
55
void
process
(
int
nsamp,
float
const
* inp,
float
* out);
56
57
private
:
58
class
Histmin
59
{
60
public
:
61
void
init
(
int
hlen);
62
float
write
(
float
v);
63
float
vmin
() {
return
_vmin
; }
64
65
private
:
66
enum
{
67
SIZE
= 32,
68
MASK
=
SIZE
- 1
69
};
70
71
int
_hlen
;
72
int
_hold
;
73
int
_wind
;
74
float
_vmin
;
75
float
_hist
[
SIZE
];
76
};
77
78
class
Upsampler
79
{
80
public
:
81
Upsampler
();
82
~Upsampler
();
83
84
void
init
(
int
nchan);
85
void
fini
();
86
87
int
88
get_latency
()
const
89
{
90
return
23;
91
}
92
93
float
process_one
(
int
chn,
float
const
x);
94
95
private
:
96
int
_nchan
;
97
float
**
_z
;
98
};
99
100
float
_fsamp
;
101
int
_nchan
;
102
bool
_truepeak
;
103
104
float
**
_dly_buf
;
105
float
*
_zlf
;
106
107
int
_delay
;
108
int
_dly_mask
;
109
int
_dly_ridx
;
110
int
_div1
,
_div2
;
111
int
_c1
,
_c2
;
112
float
_g0
,
_g1
,
_dg
;
113
float
_gt
,
_m1
,
_m2
;
114
float
_w1
,
_w2
,
_w3
,
_wlf
;
115
float
_z1
,
_z2
,
_z3
;
116
117
bool
_rstat
;
118
float
_peak
;
119
float
_gmax
;
120
float
_gmin
;
121
122
Upsampler
_upsampler
;
123
Histmin
_hist1
;
124
Histmin
_hist2
;
125
};
126
127
}
128
#endif
AudioGrapherDSP::Limiter::Histmin
Definition:
private/limiter/limiter.h:59
AudioGrapherDSP::Limiter::Histmin::vmin
float vmin()
Definition:
private/limiter/limiter.h:63
AudioGrapherDSP::Limiter::Histmin::_hold
int _hold
Definition:
private/limiter/limiter.h:72
AudioGrapherDSP::Limiter::Histmin::_hlen
int _hlen
Definition:
private/limiter/limiter.h:71
AudioGrapherDSP::Limiter::Histmin::SIZE
@ SIZE
Definition:
private/limiter/limiter.h:67
AudioGrapherDSP::Limiter::Histmin::MASK
@ MASK
Definition:
private/limiter/limiter.h:68
AudioGrapherDSP::Limiter::Histmin::_vmin
float _vmin
Definition:
private/limiter/limiter.h:74
AudioGrapherDSP::Limiter::Histmin::init
void init(int hlen)
AudioGrapherDSP::Limiter::Histmin::write
float write(float v)
AudioGrapherDSP::Limiter::Histmin::_wind
int _wind
Definition:
private/limiter/limiter.h:73
AudioGrapherDSP::Limiter::Histmin::_hist
float _hist[SIZE]
Definition:
private/limiter/limiter.h:75
AudioGrapherDSP::Limiter::Upsampler
Definition:
private/limiter/limiter.h:79
AudioGrapherDSP::Limiter::Upsampler::_z
float ** _z
Definition:
private/limiter/limiter.h:97
AudioGrapherDSP::Limiter::Upsampler::Upsampler
Upsampler()
AudioGrapherDSP::Limiter::Upsampler::~Upsampler
~Upsampler()
AudioGrapherDSP::Limiter::Upsampler::get_latency
int get_latency() const
Definition:
private/limiter/limiter.h:88
AudioGrapherDSP::Limiter::Upsampler::process_one
float process_one(int chn, float const x)
AudioGrapherDSP::Limiter::Upsampler::init
void init(int nchan)
AudioGrapherDSP::Limiter::Upsampler::_nchan
int _nchan
Definition:
private/limiter/limiter.h:96
AudioGrapherDSP::Limiter::Upsampler::fini
void fini()
AudioGrapherDSP::Limiter
Definition:
private/limiter/limiter.h:27
AudioGrapherDSP::Limiter::get_latency
int get_latency() const
Definition:
private/limiter/limiter.h:41
AudioGrapherDSP::Limiter::_w1
float _w1
Definition:
private/limiter/limiter.h:114
AudioGrapherDSP::Limiter::_upsampler
Upsampler _upsampler
Definition:
private/limiter/limiter.h:122
AudioGrapherDSP::Limiter::init
void init(float fsamp, int nchan)
AudioGrapherDSP::Limiter::_z3
float _z3
Definition:
private/limiter/limiter.h:115
AudioGrapherDSP::Limiter::_div2
int _div2
Definition:
private/limiter/limiter.h:110
AudioGrapherDSP::Limiter::set_release
void set_release(float)
AudioGrapherDSP::Limiter::_c2
int _c2
Definition:
private/limiter/limiter.h:111
AudioGrapherDSP::Limiter::_nchan
int _nchan
Definition:
private/limiter/limiter.h:101
AudioGrapherDSP::Limiter::_wlf
float _wlf
Definition:
private/limiter/limiter.h:114
AudioGrapherDSP::Limiter::_z2
float _z2
Definition:
private/limiter/limiter.h:115
AudioGrapherDSP::Limiter::_gt
float _gt
Definition:
private/limiter/limiter.h:113
AudioGrapherDSP::Limiter::set_truepeak
void set_truepeak(bool)
AudioGrapherDSP::Limiter::_dly_ridx
int _dly_ridx
Definition:
private/limiter/limiter.h:109
AudioGrapherDSP::Limiter::_zlf
float * _zlf
Definition:
private/limiter/limiter.h:105
AudioGrapherDSP::Limiter::_m2
float _m2
Definition:
private/limiter/limiter.h:113
AudioGrapherDSP::Limiter::_delay
int _delay
Definition:
private/limiter/limiter.h:107
AudioGrapherDSP::Limiter::_hist2
Histmin _hist2
Definition:
private/limiter/limiter.h:124
AudioGrapherDSP::Limiter::_fsamp
float _fsamp
Definition:
private/limiter/limiter.h:100
AudioGrapherDSP::Limiter::_g0
float _g0
Definition:
private/limiter/limiter.h:112
AudioGrapherDSP::Limiter::_dly_mask
int _dly_mask
Definition:
private/limiter/limiter.h:108
AudioGrapherDSP::Limiter::_g1
float _g1
Definition:
private/limiter/limiter.h:112
AudioGrapherDSP::Limiter::process
void process(int nsamp, float const *inp, float *out)
AudioGrapherDSP::Limiter::_w3
float _w3
Definition:
private/limiter/limiter.h:114
AudioGrapherDSP::Limiter::_z1
float _z1
Definition:
private/limiter/limiter.h:115
AudioGrapherDSP::Limiter::_truepeak
bool _truepeak
Definition:
private/limiter/limiter.h:102
AudioGrapherDSP::Limiter::_dly_buf
float ** _dly_buf
Definition:
private/limiter/limiter.h:104
AudioGrapherDSP::Limiter::_m1
float _m1
Definition:
private/limiter/limiter.h:113
AudioGrapherDSP::Limiter::_rstat
bool _rstat
Definition:
private/limiter/limiter.h:117
AudioGrapherDSP::Limiter::set_threshold
void set_threshold(float)
AudioGrapherDSP::Limiter::_gmax
float _gmax
Definition:
private/limiter/limiter.h:119
AudioGrapherDSP::Limiter::set_inpgain
void set_inpgain(float)
AudioGrapherDSP::Limiter::_c1
int _c1
Definition:
private/limiter/limiter.h:111
AudioGrapherDSP::Limiter::get_stats
void get_stats(float *peak, float *gmax, float *gmin)
Definition:
private/limiter/limiter.h:47
AudioGrapherDSP::Limiter::_hist1
Histmin _hist1
Definition:
private/limiter/limiter.h:123
AudioGrapherDSP::Limiter::_dg
float _dg
Definition:
private/limiter/limiter.h:112
AudioGrapherDSP::Limiter::_div1
int _div1
Definition:
private/limiter/limiter.h:110
AudioGrapherDSP::Limiter::_gmin
float _gmin
Definition:
private/limiter/limiter.h:120
AudioGrapherDSP::Limiter::fini
void fini()
AudioGrapherDSP::Limiter::~Limiter
~Limiter()
AudioGrapherDSP::Limiter::Limiter
Limiter()
AudioGrapherDSP::Limiter::_w2
float _w2
Definition:
private/limiter/limiter.h:114
AudioGrapherDSP::Limiter::_peak
float _peak
Definition:
private/limiter/limiter.h:118
AudioGrapherDSP
Definition:
private/limiter/limiter.h:24
libs
audiographer
private
limiter
limiter.h
Generated on Thu Dec 26 2024 05:38:55 for Ardour by
1.9.1