CLAM-Development  1.4.0
SMSPitchDiscretization.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3  * UNIVERSITAT POMPEU FABRA
4  *
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 
23 #ifndef _SMSPitchDiscretization_
24 #define _SMSPitchDiscretization_
25 
26 #include "InPort.hxx"
27 #include "OutPort.hxx"
28 #include "SMSPitchShift.hxx"
29 #include "SpectrumAdder2.hxx"
30 #include "FrameTransformation.hxx"
32 
33 
34 namespace CLAM{
35 
36 
38  {
40  InPort<Fundamental> mInFund;
41  InPort<Spectrum> mInSpectrum;
43  OutPort<Fundamental> mOutFund;
44  OutPort<Spectrum> mOutSpectrum;
45 
46  SMSPitchShift mPitchShift;
47 
48  public:
49 
51  :
52  mInPeaks("In SpectralPeaks", this),
53  mInFund("In Fundamental", this),
54  mInSpectrum("In Spectrum", this),
55  mOutPeaks("Out SpectralPeaks", this),
56  mOutFund("Out Fundamental", this),
57  mOutSpectrum("Out Spectrum", this)
58  {
60  }
61 
63 
64  bool Do()
65  {
66  bool result = Do(mInPeaks.GetData(),
67  mInFund.GetData(),
68  mInSpectrum.GetData(),
69  mOutPeaks.GetData(),
70  mOutFund.GetData(),
71  mOutSpectrum.GetData()
72  );
73 
74  mInPeaks.Consume();
75  mOutPeaks.Produce();
76  mInFund.Consume();
77  mOutFund.Produce();
78  mInSpectrum.Consume();
79  mOutSpectrum.Produce();
80 
81  return result;
82  }
83 
84  bool Do(const Frame& in, Frame& out);
85 
86  bool Do(const SpectralPeakArray& inPeaks,
87  const Fundamental& inFund,
88  const Spectrum& inSpectrum,
89  SpectralPeakArray& outPeaks,
90  Fundamental& outFund,
91  Spectrum& outSpectrum
92  );
93 
94  private:
95  const char *GetClassName() const {return "SMSPitchDiscretization";}
96 
97  };
98 } //namespace CLAM
99 
100 #endif // _SMSPitchDiscretization_
101