UtiLite
0.3.1
A lite utilities library
|
00001 /* 00002 * UAudioEvent.h 00003 * 00004 * Created on: 2012-12-07 00005 * Author: mathieu 00006 */ 00007 00008 #ifndef UAUDIOEVENT_H_ 00009 #define UAUDIOEVENT_H_ 00010 00011 #include "utilite/UtiLiteAudioExp.h" // DLL export/import defines 00012 00013 #include <utilite/UEvent.h> 00014 #include <vector> 00015 00019 class UTILITEAUDIO_EXP UAudioEvent : 00020 public UEvent 00021 { 00022 public: 00023 enum Type { 00024 kTypeFrame, 00025 kTypeFrameFreq, 00026 kTypeFrameFreqSqrdMagn, 00027 kTypeNoMoreFrames 00028 }; 00029 00030 public: 00031 // kTypeNoMoreFrames constructor 00032 UAudioEvent(int microId = 0); 00033 // kTypeFrame constructor 00034 UAudioEvent(const std::vector<std::vector<char> > & frame, 00035 int sampleSize, 00036 int fs, 00037 int channels, 00038 int microId = 0); 00039 // kTypeFrameFreq and kTypeFrameFreqSqrdMagn constructors 00040 UAudioEvent(Type frameType, 00041 const std::vector<std::vector<float> > & frameFreq, 00042 int fs, 00043 int channels, 00044 int microId = 0); 00045 00046 int type() const {return this->getCode();} 00047 const std::vector<std::vector<char> > & frame() const {return _frame;} 00048 const std::vector<std::vector<float> > & frameFreq() const {return _frameFreq;} 00049 int sampleSize() const {return _sampleSize;} 00050 int microId() const {return _microId;} 00051 int fs() const {return _fs;} 00052 virtual ~UAudioEvent() {} 00053 virtual std::string getClassName() const {return std::string("UAudioEvent");} 00054 00055 private: 00056 std::vector<std::vector<char> > _frame; 00057 std::vector<std::vector<float> > _frameFreq; 00058 int _sampleSize; // bytes 00059 int _fs; //sampling rate 00060 int _microId; 00061 }; 00062 00063 #endif /* UAUDIOEVENT_H_ */