CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Processing
Transformations
Spectral
3BandCompressor.hxx
Go to the documentation of this file.
1
2
/*
3
* Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
4
* UNIVERSITAT POMPEU FABRA
5
*
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
*
21
*/
22
23
24
#ifndef _ThreeBandCompressor_
25
#define _ThreeBandCompressor_
26
27
#include "
InPort.hxx
"
28
#include "
OutPort.hxx
"
29
#include "
InControl.hxx
"
30
#include "
Frame.hxx
"
31
#include "
FrameTransformation.hxx
"
32
#include "
FrameTransformationConfig.hxx
"
33
34
namespace
CLAM{
49
class
ThreeBandCompressor
:
public
FrameTransformationTmpl
<Spectrum>
50
{
51
InPort<Spectrum>
mIn;
52
OutPort<Spectrum>
mOut;
53
54
FloatInControl
mLowCutoffFreqCtl;
55
FloatInControl
mHighCutoffFreqCtl;
56
FloatInControl
mLowThresholdCtl;
57
FloatInControl
mMidThresholdCtl;
58
FloatInControl
mHighThresholdCtl;
59
public
:
60
const
char
*
GetClassName
()
const
61
{
62
return
"ThreeBandCompressor"
;
63
}
64
65
ThreeBandCompressor
()
66
: mIn(
"In Spectrum"
, this)
67
, mOut(
"Out Spectrum"
, this)
68
, mLowCutoffFreqCtl(
"LowCutoff"
, this)
69
, mHighCutoffFreqCtl(
"HighCutoff"
, this)
70
, mLowThresholdCtl(
"LowThreshold"
, this)
71
, mMidThresholdCtl(
"MidThreshold"
, this)
72
, mHighThresholdCtl(
"HighThreshold"
, this)
73
{
74
Configure
(
FrameTransformationConfig
() );
75
mLowCutoffFreqCtl.
SetBounds
(0.,1.);
76
mHighCutoffFreqCtl.
SetBounds
(0.,1.);
77
}
78
79
~ThreeBandCompressor
() {}
80
81
virtual
bool
InitControls
()
82
{
83
mLowCutoffFreqCtl.
DoControl
(1000);
84
mHighCutoffFreqCtl.
DoControl
(5000);
85
86
mLowThresholdCtl.
DoControl
(0);
87
mMidThresholdCtl.
DoControl
(0);
88
mHighThresholdCtl.
DoControl
(0);
89
90
return
true
;
91
}
92
93
bool
Do
(
const
Frame
& in,
Frame
& out)
94
{
95
return
Do
(in.GetSpectrum(), out.GetSpectrum());
96
}
97
98
bool
Do
(
const
Spectrum
& in,
Spectrum
& out);
99
100
bool
Do
()
101
{
102
bool
result =
Do
(mIn.
GetData
(), mOut.
GetData
());
103
mIn.
Consume
();
104
mOut.
Produce
();
105
return
result;
106
}
107
};
108
}
//namespace CLAM
109
110
#endif // _ThreeBandCompressor_
Generated by
1.8.1