CLAM-Development  1.4.0
SMSGenderChange.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 _SMSGenderChange_
24 #define _SMSGenderChange_
25 
26 #include "InPort.hxx"
27 #include "OutPort.hxx"
28 #include "InControl.hxx"
29 #include "FrameTransformation.hxx"
30 #include "SMSPitchShift.hxx"
32 #include "SpectralPeakArray.hxx"
34 
35 namespace CLAM{
36 
37 
39  {
40 
41  const char *GetClassName() const {return "SMSGenderChange";}
42 
45  InPort<Fundamental> mInFund;
46  OutPort<Fundamental> mOutFund;
47  InPort<Spectrum> mInSpectrum;
48  OutPort<Spectrum> mOutSpectrum;
49 
50  FloatInControl mControl;
51  public:
52 
54  :
55  mInPeaks("In SpectralPeaks", this),
56  mOutPeaks("Out SpectralPeaks", this),
57  mInFund("In Fundamental", this),
58  mOutFund("Out Fundamental", this),
59  mInSpectrum("In Spectrum", this),
60  mOutSpectrum("Out Spectrum", this),
61  mControl("Control", this)
62  {
64  }
65 
67 
68  bool ConcreteConfigure( const ProcessingConfig& config )
69  {
70  mControl.SetBounds(0,1);
71  mControl.DoControl(0);
72  return true;
73  }
74 
75  bool Do()
76  {
77  bool result = Do(mInPeaks.GetData(),
78  mInFund.GetData(),
79  mInSpectrum.GetData(),
80  mOutPeaks.GetData(),
81  mOutFund.GetData(),
82  mOutSpectrum.GetData()
83  );
84 
85  mInPeaks.Consume();
86  mInFund.Consume();
87  mInSpectrum.Consume();
88  mOutPeaks.Produce();
89  mOutFund.Produce();
90  mOutSpectrum.Produce();
91  return result;
92  }
93 
94  bool Do(const Frame& in, Frame& out);
95 
96  bool Do(const SpectralPeakArray& inPeaks,
97  const Fundamental& inFund,
98  const Spectrum& inSpectrum,
99  SpectralPeakArray& outPeaks,
100  Fundamental& outFund,
101  Spectrum& outSpectrum);
102 
103  private:
104 
105  SMSPitchShift mPitchShift;
106  SMSSpectralShapeShift mSpectralShapeShift;
107  };
108 } //namespace CLAM
109 
110 #endif // _SMSGenderChange_
111