UtiLite
0.2.14
A lite utilities library
|
00001 00007 #ifndef UMICAUDIORECORDER_H 00008 #define UMICAUDIORECORDER_H 00009 00010 #include "utilite/UtiLiteExp.h" // DLL export/import defines 00011 00012 #include "utilite/UAudioRecorder.h" 00013 #include <string> 00014 #include <vector> 00015 00016 namespace FMOD 00017 { 00018 class Sound; 00019 } 00020 00050 class UTILITE_EXP UAudioRecorderMic : public UAudioRecorder 00051 { 00052 public: 00056 UAudioRecorderMic(int driver = 0, 00057 int fs = 44100, 00058 int frameLength = 1024, 00059 int bytesPerSample = 2, 00060 int channels = 1); 00061 00065 UAudioRecorderMic(const std::string &fileName, 00066 int maxFileSizeMb, 00067 int driver = 0, 00068 int fs = 44100, 00069 int frameLength = 1024, 00070 int bytesPerSample = 2, 00071 int channels = 1); 00072 00073 virtual ~UAudioRecorderMic(); 00074 00075 virtual bool init(); 00076 virtual void close(); 00077 const std::string &getFileName() const { return _fileName; } 00078 int getDriverId() const { return _driver; } 00079 00080 public: 00081 static std::vector<std::string> getRecordDrivers(); 00082 00083 protected: 00084 virtual void mainLoopBegin(); 00085 virtual void mainLoop(); 00086 virtual void mainLoopEnd(); 00087 00088 private: 00089 int _driver; 00090 00091 std::string _fileName; 00092 int _maxFileSize; 00093 bool _encodeToMp3; 00094 FILE *_fp; 00095 00096 FMOD::Sound * _sound; 00097 00098 unsigned int _dataLength; 00099 unsigned int _soundLength; 00100 unsigned int _lastRecordPos; 00101 }; 00102 00103 #endif