00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __FrameDescriptors__
00023 #define __FrameDescriptors__
00024
00025 #include "Descriptor.hxx"
00026
00027 #include "AudioDescriptors.hxx"
00028 #include "SpectralDescriptors.hxx"
00029 #include "SpectralPeakDescriptors.hxx"
00030 #include "MorphologicalFrameDescriptors.hxx"
00031
00032 namespace CLAM{
00033
00034
00035 class Frame;
00036
00037
00038
00039
00040
00041
00042
00043 class FrameDescriptors : public Descriptor
00044 {
00045 public:
00046 DYNAMIC_TYPE_USING_INTERFACE (FrameDescriptors, 10, Descriptor);
00048 DYN_ATTRIBUTE (0, public, SpectralDescriptors, SpectrumD);
00050 DYN_ATTRIBUTE (1, public, SpectralPeakDescriptors, SpectralPeakD);
00052 DYN_ATTRIBUTE (2, public, SpectralDescriptors, ResidualSpecD);
00054 DYN_ATTRIBUTE (3, public, SpectralDescriptors, SinusoidalSpecD);
00055
00056
00058 DYN_ATTRIBUTE (4, public, AudioDescriptors, AudioFrameD);
00060 DYN_ATTRIBUTE (5, public, AudioDescriptors, SinusoidalAudioFrameD);
00062 DYN_ATTRIBUTE (6, public, AudioDescriptors, ResidualAudioFrameD);
00064 DYN_ATTRIBUTE (7, public, AudioDescriptors, SynthAudioFrameD);
00065
00066
00068 DYN_ATTRIBUTE (8, public, MorphologicalFrameDescriptors, MorphologicalFrameD);
00069
00071 DYN_ATTRIBUTE (9, public, TTime, CenterTime);
00072
00073
00074 public:
00075 FrameDescriptors(Frame* pFrame);
00076 FrameDescriptors(TData initVal);
00077
00078 const Frame* GetpFrame() const;
00079 void SetpFrame(const Frame* pFrame);
00080 void Compute();
00081 void ConcreteCompute();
00082
00083 TData GetFundamental() {return mpFrame->GetFundamental().GetFreq(0);}
00084
00085 private:
00086 void DefaultInit();
00087 void CopyInit(const FrameDescriptors & copied);
00088
00089 private:
00090 const Frame* mpFrame;
00091
00092 };
00093
00094 FrameDescriptors operator * (const FrameDescriptors& a,const FrameDescriptors& b);
00095 FrameDescriptors operator + (const FrameDescriptors& a,const FrameDescriptors& b);
00096 FrameDescriptors operator * (const FrameDescriptors& a,TData mult);
00097 FrameDescriptors operator * (TData mult,const FrameDescriptors& a);
00098 FrameDescriptors operator - (const FrameDescriptors& a,const FrameDescriptors& b);
00099 FrameDescriptors operator / (const FrameDescriptors& a,TData div);
00100
00101 template<>
00102 inline FrameDescriptors CLAM_max (const FrameDescriptors& a,const FrameDescriptors& b)
00103 {
00104 FrameDescriptors tmpD(a);
00105 if(a.HasSpectralPeakD() && b.HasSpectralPeakD())
00106 {
00107 tmpD.SetSpectralPeakD(CLAM_max(a.GetSpectralPeakD(),b.GetSpectralPeakD()));
00108 }
00109 if(a.HasSpectrumD() && b.HasSpectrumD())
00110 {
00111 tmpD.SetSpectrumD(CLAM_max(a.GetSpectrumD(),b.GetSpectrumD()));
00112 }
00113 if(a.HasResidualSpecD() && b.HasResidualSpecD())
00114 {
00115 tmpD.SetResidualSpecD(CLAM_max(a.GetResidualSpecD(),b.GetResidualSpecD()));
00116 }
00117 if(a.HasSinusoidalSpecD() && b.HasSinusoidalSpecD())
00118 {
00119 tmpD.SetSinusoidalSpecD(CLAM_max(a.GetSinusoidalSpecD(),b.GetSinusoidalSpecD()));
00120 }
00121 if(a.HasAudioFrameD() && b.HasAudioFrameD())
00122 {
00123 tmpD.SetAudioFrameD(CLAM_max(a.GetAudioFrameD(),b.GetAudioFrameD()));
00124 }
00125 if(a.HasSinusoidalAudioFrameD() && b.HasSinusoidalAudioFrameD())
00126 {
00127 tmpD.SetSinusoidalAudioFrameD(CLAM_max(a.GetSinusoidalAudioFrameD(),b.GetSinusoidalAudioFrameD()));
00128 }
00129 if(a.HasResidualAudioFrameD() && b.HasResidualAudioFrameD())
00130 {
00131 tmpD.SetResidualAudioFrameD(CLAM_max(a.GetResidualAudioFrameD(),b.GetResidualAudioFrameD()));
00132 }
00133 if(a.HasSynthAudioFrameD() && b.HasSynthAudioFrameD())
00134 {
00135 tmpD.SetSynthAudioFrameD(CLAM_max(a.GetSynthAudioFrameD(),b.GetSynthAudioFrameD()));
00136 }
00137 return tmpD;
00138 }
00139
00140 template<>
00141 inline FrameDescriptors CLAM_min (const FrameDescriptors& a,const FrameDescriptors& b)
00142 {
00143 FrameDescriptors tmpD(a);
00144 if(a.HasSpectralPeakD() && b.HasSpectralPeakD())
00145 {
00146 tmpD.SetSpectralPeakD(CLAM_min(a.GetSpectralPeakD(),b.GetSpectralPeakD()));
00147 }
00148 if(a.HasSpectrumD() && b.HasSpectrumD())
00149 {
00150 tmpD.SetSpectrumD(CLAM_min(a.GetSpectrumD(),b.GetSpectrumD()));
00151 }
00152 if(a.HasResidualSpecD() && b.HasResidualSpecD())
00153 {
00154 tmpD.SetResidualSpecD(CLAM_min(a.GetResidualSpecD(),b.GetResidualSpecD()));
00155 }
00156 if(a.HasSinusoidalSpecD() && b.HasSinusoidalSpecD())
00157 {
00158 tmpD.SetSinusoidalSpecD(CLAM_min(a.GetSinusoidalSpecD(),b.GetSinusoidalSpecD()));
00159 }
00160 if(a.HasAudioFrameD() && b.HasAudioFrameD())
00161 {
00162 tmpD.SetAudioFrameD(CLAM_min(a.GetAudioFrameD(),b.GetAudioFrameD()));
00163 }
00164 if(a.HasSinusoidalAudioFrameD() && b.HasSinusoidalAudioFrameD())
00165 {
00166 tmpD.SetSinusoidalAudioFrameD(CLAM_min(a.GetSinusoidalAudioFrameD(),b.GetSinusoidalAudioFrameD()));
00167 }
00168 if(a.HasResidualAudioFrameD() && b.HasResidualAudioFrameD())
00169 {
00170 tmpD.SetResidualAudioFrameD(CLAM_min(a.GetResidualAudioFrameD(),b.GetResidualAudioFrameD()));
00171 }
00172 if(a.HasSynthAudioFrameD() && b.HasSynthAudioFrameD())
00173 {
00174 tmpD.SetSynthAudioFrameD(CLAM_min(a.GetSynthAudioFrameD(),b.GetSynthAudioFrameD()));
00175 }
00176 return tmpD;
00177 }
00178
00179
00180
00181
00182 };
00183
00184
00185
00186 #endif
00187