CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Processing
Transformations
Spectral
Peakalizer.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 _Peakalizer_
25
#define _Peakalizer_
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{
35
36
class
Peakalizer
:
public
FrameTransformationTmpl
<Spectrum>
37
{
38
InPort<Spectrum>
mIn;
39
OutPort<Spectrum>
mOut;
40
41
FloatInControl
mThresholdCtl;
42
FloatInControl
mBandWidthCtl;
43
public
:
44
const
char
*
GetClassName
()
const
45
{
46
return
"Peakalizer"
;
47
}
48
49
Peakalizer
()
50
:
51
mIn(
"In Spectrum"
, this),
52
mOut(
"Out Spectrum"
, this),
53
mThresholdCtl(
"Threshold"
, this),
54
mBandWidthCtl(
"Bandwidth"
, this)
55
{
56
Configure
(
FrameTransformationConfig
() );
57
}
58
59
~Peakalizer
() {}
60
61
virtual
bool
InitControls
()
62
{
63
mThresholdCtl.
DoControl
(-60);
64
mBandWidthCtl.
DoControl
(500);
65
66
return
true
;
67
}
68
69
bool
Do
(
const
Frame
& in,
Frame
& out)
70
{
71
return
Do
(in.GetSpectrum(),
72
out.GetSpectrum());
73
}
74
75
bool
Do
(
const
Spectrum
& in,
Spectrum
& out);
76
77
bool
Do
()
78
{
79
bool
result =
Do
(mIn.
GetData
(), mOut.
GetData
());
80
mIn.
Consume
();
81
mOut.
Produce
();
82
return
result;
83
}
84
private
:
85
DataArray
mMag;
86
};
87
};
//namespace CLAM
88
89
#endif // _Peakalizer_
Generated by
1.8.1