SpectralDelay.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SpectralDelay_
00025 #define _SpectralDelay_
00026
00027 #include "InPort.hxx"
00028 #include "OutPort.hxx"
00029 #include "InControl.hxx"
00030 #include "Frame.hxx"
00031 #include "FrameTransformation.hxx"
00032 #include "FrameTransformationConfig.hxx"
00033 #include "TokenDelay.hxx"
00034
00035 namespace CLAM{
00036
00037 class SpectralDelay: public FrameTransformationTmpl<Spectrum>
00038 {
00039 InPort<Spectrum> mIn;
00040 OutPort<Spectrum> mOut;
00041
00042 FloatInControl mLowCutoffFreqCtl;
00043 FloatInControl mHighCutoffFreqCtl;
00044 FloatInControl mLowDelayCtl;
00045 FloatInControl mMidDelayCtl;
00046 FloatInControl mHighDelayCtl;
00047 public:
00048 const char* GetClassName() const
00049 {
00050 return "SpectralDelay";
00051 }
00052
00053 SpectralDelay()
00054 :
00055 mIn("In Spectrum", this),
00056 mOut("Out Spectrum", this) ,
00057 mLowCutoffFreqCtl("LowCutoff", this),
00058 mHighCutoffFreqCtl("HighCutoff", this),
00059 mLowDelayCtl("LowDelay", this),
00060 mMidDelayCtl("MidDelay", this),
00061 mHighDelayCtl("HighDelay", this)
00062 {
00063 Configure( FrameTransformationConfig() );
00064 TokenDelayConfig cfg;
00065 cfg.SetDelay(0);
00066 cfg.SetMaxDelay(100);
00067 mLFDelay.Configure(cfg);
00068 mMFDelay.Configure(cfg);
00069 mHFDelay.Configure(cfg);
00070 }
00071
00072 ~SpectralDelay() {}
00073
00074 bool ConcreteConfigure( const ProcessingConfig& config )
00075 {
00076 mLowCutoffFreqCtl.SetBounds(0,1000000);
00077 mLowCutoffFreqCtl.DoControl(1000);
00078
00079 mHighCutoffFreqCtl.SetBounds(0,1000000);
00080 mHighCutoffFreqCtl.DoControl(5000);
00081
00082 mLowDelayCtl.SetBounds(0,100);
00083 mLowDelayCtl.DoControl(0);
00084
00085 mMidDelayCtl.SetBounds(0,100);
00086 mMidDelayCtl.DoControl(0);
00087
00088 mHighDelayCtl.SetBounds(0,100);
00089 mHighDelayCtl.DoControl(0);
00090 return true;
00091 }
00092
00093 bool Do(const Frame& in, Frame& out)
00094 {
00095 return Do(in.GetSpectrum(),
00096 out.GetSpectrum());
00097 }
00098
00099 bool Do(const Spectrum& in, Spectrum& out);
00100
00101 bool Do()
00102 {
00103 bool result = Do(mIn.GetData(), mOut.GetData());
00104 mIn.Consume();
00105 mOut.Produce();
00106 return result;
00107 }
00108 private:
00109 TokenDelay<Spectrum> mLFDelay;
00110 TokenDelay<Spectrum> mMFDelay;
00111 TokenDelay<Spectrum> mHFDelay;
00112
00113 Spectrum mLFSpectrum;
00114 Spectrum mMFSpectrum;
00115 Spectrum mHFSpectrum;
00116
00117 TSize mFrameSize;
00118 };
00119 };
00120
00121 #endif // _SpectralDelay_