CLAM-Development  1.4.0
SpectralLimiter.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 _SpectralLimiter_
25 #define _SpectralLimiter_
26 
27 #include "InPort.hxx"
28 #include "OutPort.hxx"
29 #include "Frame.hxx"
30 #include "FrameTransformation.hxx"
32 
33 namespace CLAM{
34 
35  class SpectralLimiter: public FrameTransformationTmpl<Spectrum>
36  {
37  InPort<Spectrum> mIn;
38  OutPort<Spectrum> mOut;
39 
40  public:
41  const char* GetClassName() const
42  {
43  return "SpectralLimiter";
44  }
45 
47  :
48  mIn("In Spectrum", this),
49  mOut("Out Spectrum", this)
50  {
52  }
53 
55 
56  bool Do(const Frame& in, Frame& out)
57  {
58  return Do(in.GetSpectrum(),
59  out.GetSpectrum());
60  }
61 
62  bool Do(const Spectrum& in, Spectrum& out);
63 
64  bool Do()
65  {
66  bool result = Do(mIn.GetData(), mOut.GetData());
67  mIn.Consume();
68  mOut.Produce();
69  return result;
70  }
71  };
72 };//namespace CLAM
73 
74 #endif // _SpectralLimiter_