00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _Frame_
00023 #define _Frame_
00024
00025 #include "DynamicType.hxx"
00026 #include "Spectrum.hxx"
00027 #include "Array.hxx"
00028 #include "IndexArray.hxx"
00029 #include "DataTypes.hxx"
00030 #include "OSDefines.hxx"
00031 #include "Err.hxx"
00032 #include "ProcessingData.hxx"
00033 #include "Fundamental.hxx"
00034 #include "SpectralPeakArray.hxx"
00035 #include "Audio.hxx"
00036
00037 namespace CLAM {
00038
00039
00055 class Frame : public ProcessingData
00056 {
00057 public:
00058 DYNAMIC_TYPE_USING_INTERFACE (Frame, 14, ProcessingData);
00060 DYN_ATTRIBUTE (0, public, TData, CenterTime);
00062 DYN_ATTRIBUTE (1, public, TData, Duration);
00064 DYN_ATTRIBUTE (2, public, Spectrum, Spectrum);
00066 DYN_ATTRIBUTE (3, public, Spectrum, SinusoidalAnalSpectrum);
00068 DYN_ATTRIBUTE (4, public, SpectralPeakArray, SpectralPeakArray);
00070 DYN_ATTRIBUTE (5, public, Fundamental, Fundamental);
00072 DYN_ATTRIBUTE (6, public, Spectrum, OutSpec);
00074 DYN_ATTRIBUTE (7, public, Spectrum, ResidualSpec);
00076 DYN_ATTRIBUTE (8, public, Spectrum, SinusoidalSpec);
00077
00078
00080 DYN_ATTRIBUTE (9, public, Audio, AudioFrame);
00082 DYN_ATTRIBUTE (10, public, Audio, SinusoidalAudioFrame);
00084 DYN_ATTRIBUTE (11, public, Audio, ResidualAudioFrame);
00086 DYN_ATTRIBUTE (12, public, Audio, SynthAudioFrame);
00088 DYN_ATTRIBUTE (13, public, bool, IsHarmonic);
00089
00090 protected:
00091 void DefaultInit();
00092
00093 public:
00094
00095
00096
00101 TData GetMag(TData freq) const;
00102
00107 TData GetMag(TIndex pos) const ;
00108
00113 TData GetPhase(TData freq) const ;
00114
00119 TData GetPhase(TIndex pos) const ;
00120
00121
00122
00127 void SetMag(TData freq, TData newMag);
00128
00133 void SetMag(TIndex pos, TData newMag);
00134
00139 void SetPhase(TData freq, TData newPhase);
00140
00145 void SetPhase(TIndex pos, TData newPhase);
00146
00147
00148
00153 SpectralPeak GetSpectralPeak(TIndex pos) const;
00154
00159 SpectralPeak GetThruIndexSpectralPeak(TIndex pos) const ;
00160
00166 void SetSpectralPeak(TIndex pos,const SpectralPeak& spectralPeak,TIndex index=-1);
00167
00174 void InsertSpectralPeak(TIndex pos,const SpectralPeak& spectralPeak,
00175 bool insertIndex=false,TIndex index=-1);
00176
00182 void AddSpectralPeak(const SpectralPeak& spectralPeak,bool addIndex=false,TIndex index=-1);
00183
00188 void DeleteSpectralPeak(TIndex pos,bool deleteIndex=false);
00189
00190
00191
00196 TData GetResMag(TData freq) const;
00197
00202 TData GetResMag(TIndex pos) const ;
00203
00208 TData GetResPhase(TData freq) const ;
00209
00214 TData GetResPhase(TIndex pos) const ;
00215
00216
00221 void SetResMag(TData freq, TData newMag);
00222
00227 void SetResMag(TIndex pos, TData newMag);
00228
00233 void SetResPhase(TData freq, TData newPhase);
00234
00239 void SetResPhase(TIndex pos, TData newPhase);
00240
00241
00242
00247 TData GetFundamentalFreq(TIndex pos=0)const;
00248
00253 TData GetFundamentalErr(TIndex pos=0);
00254
00259 void SetFundamentalFreq(TIndex pos,TData newFreq)const;
00260
00265 void SetFundamentalErr(TIndex pos,TData newErr)const;
00266
00267
00268
00273 bool operator ==(const Frame& newFrame) const ;
00274
00279 bool operator !=(const Frame& newFrame) const ;
00280
00285 bool operator <(const Frame& newFrame) const ;
00286
00291 bool operator <=(const Frame& newFrame) const ;
00292
00297 bool operator >(const Frame& newFrame) const ;
00298
00303 bool operator >=(const Frame& newFrame) const ;
00304
00305 };
00306
00307 };
00308
00309 #endif
00310