00001
00002 #ifndef INCLUDED_PitchEvent_h_
00003 #define INCLUDED_PitchEvent_h_
00004
00005 #include "EventBase.h"
00006
00007
00008 class PitchEvent : public EventBase {
00009 public:
00010
00011 PitchEvent(unsigned int sid, EventTypeID_t type, const float freq_, const char *name_, const float amplitude_, const unsigned int duration_, const float confidence_)
00012 : EventBase(EventBase::micPitchEGID, sid, type,duration_,name_,(type==deactivateETID) ? 0 : confidence_*amplitude_), freq(freq_), amplitude(amplitude_), confidence(confidence_)
00013 {}
00014
00015
00016 PitchEvent(const PitchEvent &p)
00017 : EventBase(p), freq(p.freq), amplitude(p.amplitude), confidence(p.confidence)
00018 {}
00019
00020
00021 PitchEvent & operator=(const PitchEvent &p) {
00022 EventBase::operator=(p); freq=p.freq; amplitude=p.amplitude; confidence=p.confidence;
00023 return *this;
00024 }
00025
00026 virtual EventBase* clone() const { return new PitchEvent(*this); }
00027
00028 virtual std::string getDescription(bool showTypeSpecific=true, unsigned int verbosity=0) const;
00029
00030 virtual unsigned int getBinSize() const;
00031 virtual unsigned int loadBinaryBuffer(const char buf[], unsigned int len);
00032 virtual unsigned int saveBinaryBuffer(char buf[], unsigned int len) const;
00033 virtual void loadXML(xmlNode* node);
00034 virtual void saveXML(xmlNode * node) const;
00035
00036 float getFreq(void) const { return freq; }
00037 float getAmplitude(void) const { return amplitude; }
00038 float getConfidence(void) const { return confidence; }
00039
00040 protected:
00041 float freq;
00042 float amplitude;
00043 float confidence;
00044 };
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 #endif