LMMS
Loading...
Searching...
No Matches
plugins
LadspaEffect
caps
Clip.h
Go to the documentation of this file.
1
/*
2
Clip.h
3
4
Copyright 2004-5 Tim Goetze <tim@quitte.de>
5
6
http://quitte.de/dsp/
7
8
oversampled hard ('diode', 'transistor', sometimes 'op-amp') clipper.
9
10
*/
11
/*
12
This program is free software; you can redistribute it and/or
13
modify it under the terms of the GNU General Public License
14
as published by the Free Software Foundation; either version 2
15
of the License, or (at your option) any later version.
16
17
This program is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
GNU General Public License for more details.
21
22
You should have received a copy of the GNU General Public License
23
along with this program; if not, write to the Free Software
24
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25
02111-1307, USA or point your web browser to http://www.gnu.org.
26
*/
27
28
#ifndef _CLIP_H_
29
#define _CLIP_H_
30
31
#include "
dsp/util.h
"
32
#include "
dsp/FIR.h
"
33
#include "
dsp/sinc.h
"
34
#include "
dsp/windows.h
"
35
36
class
Clip
37
:
public
Plugin
38
{
39
public
:
40
sample_t
gain
,
gain_db
;
41
42
sample_t
threshold
[2];
43
44
enum
{
45
OVERSAMPLE
= 8,
46
FIR_SIZE
= 64,
47
};
48
49
/* antialias filters */
50
DSP::FIRUpsampler
up
;
51
DSP::FIR
down
;
52
53
template
<sample_func_t F>
54
void
one_cycle
(
int
frames);
55
56
inline
sample_t
clip
(
sample_t
x
);
57
58
public
:
59
static
PortInfo
port_info
[];
60
61
Clip
()
62
:
up
(
FIR_SIZE
,
OVERSAMPLE
),
63
down
(
FIR_SIZE
)
64
{ }
65
66
void
init
();
67
68
void
activate
()
69
{
70
up
.reset();
71
down
.reset();
72
gain_db
= *
ports
[1];
73
gain
=
DSP::db2lin
(
gain_db
);
74
}
75
76
void
run
(
int
n
)
77
{
78
one_cycle<store_func>
(
n
);
79
}
80
81
void
run_adding
(
int
n
)
82
{
83
one_cycle<adding_func>
(
n
);
84
}
85
};
86
87
#endif
/* _CLIP_H_ */
FIR.h
util.h
sample_t
LADSPA_Data sample_t
Definition
basics.h:100
Clip::run_adding
void run_adding(int n)
Definition
Clip.h:81
Clip::clip
sample_t clip(sample_t x)
Clip::Clip
Clip()
Definition
Clip.h:61
Clip::port_info
static PortInfo port_info[]
Definition
Clip.h:59
Clip::FIR_SIZE
@ FIR_SIZE
Definition
Clip.h:46
Clip::OVERSAMPLE
@ OVERSAMPLE
Definition
Clip.h:45
Clip::down
DSP::FIR down
Definition
Clip.h:51
Clip::init
void init()
Clip::activate
void activate()
Definition
Clip.h:68
Clip::gain_db
sample_t gain_db
Definition
Clip.h:40
Clip::up
DSP::FIRUpsampler up
Definition
Clip.h:50
Clip::threshold
sample_t threshold[2]
Definition
Clip.h:42
Clip::one_cycle
void one_cycle(int frames)
Clip::gain
sample_t gain
Definition
Clip.h:40
Clip::run
void run(int n)
Definition
Clip.h:76
DSP::FIR
Definition
FIR.h:42
DSP::FIRUpsampler
Definition
FIR.h:161
Plugin
Definition
basics.h:174
Plugin::ports
sample_t ** ports
Definition
basics.h:182
x
unsigned x[BMAX+1]
Definition
inflate.c:1586
DSP::db2lin
double db2lin(double db)
Definition
util.h:62
sinc.h
PortInfo
Definition
basics.h:94
n
int n
Definition
crypt.c:458
windows.h
Generated on
for LMMS by
1.16.1