PitchEvent.h
Go to the documentation of this file.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() : EventBase(), freq(), amplitude(), confidence() {genID=EventBase::micPitchEGID;}
00012
00013
00014 PitchEvent(size_t sid, EventTypeID_t type, const float freq_, const char *name_, const float amplitude_, const unsigned int duration_, const float confidence_)
00015 : EventBase(EventBase::micPitchEGID, sid, type,duration_,name_,(type==deactivateETID) ? 0 : confidence_*amplitude_), freq(freq_), amplitude(amplitude_), confidence(confidence_)
00016 {}
00017
00018
00019 PitchEvent(const PitchEvent &p)
00020 : EventBase(p), freq(p.freq), amplitude(p.amplitude), confidence(p.confidence)
00021 {}
00022
00023
00024 PitchEvent & operator=(const PitchEvent &p) {
00025 EventBase::operator=(p); freq=p.freq; amplitude=p.amplitude; confidence=p.confidence;
00026 return *this;
00027 }
00028
00029 virtual EventBase* clone() const { return new PitchEvent(*this); }
00030
00031 virtual std::string getDescription(bool showTypeSpecific=true, unsigned int verbosity=0) const;
00032
00033 virtual unsigned int getBinSize() const;
00034 virtual unsigned int loadBinaryBuffer(const char buf[], unsigned int len);
00035 virtual unsigned int saveBinaryBuffer(char buf[], unsigned int len) const;
00036 virtual void loadXML(xmlNode* node);
00037 virtual void saveXML(xmlNode * node) const;
00038
00039 float getFreq(void) const { return freq; }
00040 float getAmplitude(void) const { return amplitude; }
00041 float getConfidence(void) const { return confidence; }
00042
00043 virtual classTypeID_t getClassTypeID() const { return autoRegisterPitchEvent; }
00044
00045 protected:
00046 float freq;
00047 float amplitude;
00048 float confidence;
00049
00050
00051 static const EventBase::classTypeID_t autoRegisterPitchEvent;
00052 };
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 #endif