UtiLite
0.3.1
A lite utilities library
|
00001 00007 #ifndef UMICAUDIORECORDER_H 00008 #define UMICAUDIORECORDER_H 00009 00010 #include "utilite/UtiLiteAudioExp.h" // DLL export/import defines 00011 00012 #include "utilite/UAudioCapture.h" 00013 #include <string> 00014 #include <vector> 00015 00016 class FMOD_SOUND; 00017 00047 class UTILITEAUDIO_EXP UAudioCaptureMic : public UAudioCapture 00048 { 00049 public: 00053 UAudioCaptureMic(int driver = 0, 00054 int fs = 44100, 00055 int frameLength = 1024, 00056 int bytesPerSample = 2, 00057 int channels = 1); 00058 00062 UAudioCaptureMic(const std::string &fileName, 00063 int maxFileSizeMb, 00064 int driver = 0, 00065 int fs = 44100, 00066 int frameLength = 1024, 00067 int bytesPerSample = 2, 00068 int channels = 1); 00069 00070 virtual ~UAudioCaptureMic(); 00071 00072 virtual bool init(); 00073 virtual void close(); 00074 const std::string &getFileName() const { return _fileName; } 00075 int getDriverId() const { return _driver; } 00076 00077 public: 00078 static std::vector<std::string> getRecordDrivers(); 00079 00080 protected: 00081 virtual void mainLoopBegin(); 00082 virtual void mainLoop(); 00083 virtual void mainLoopEnd(); 00084 00085 private: 00086 int _driver; 00087 00088 std::string _fileName; 00089 int _maxFileSize; 00090 bool _encodeToMp3; 00091 FILE *_fp; 00092 00093 FMOD_SOUND * _sound; 00094 00095 unsigned int _dataLength; 00096 unsigned int _soundLength; 00097 unsigned int _lastRecordPos; 00098 }; 00099 00100 #endif