UtiLite
0.3.1
A lite utilities library
|
00001 00007 #ifndef UTONEAUDIOPLAYER_H 00008 #define UTONEAUDIOPLAYER_H 00009 00010 #include "utilite/UtiLiteAudioExp.h" // DLL export/import defines 00011 00012 #include "utilite/UAudioPlayer.h" 00013 #include <utilite/UThreadNode.h> 00014 #include <string> 00015 00016 class FMOD_DSP; 00017 00024 class UTILITEAUDIO_EXP UAudioPlayerTone : public UAudioPlayer, public UThread 00025 { 00026 public: 00027 UAudioPlayerTone(float freq = 440.0f, float vol = 0.5f, unsigned int toneMs = 200, unsigned int tickMs = 200); 00028 UAudioPlayerTone(const char* filePath, float vol = 0.5f, unsigned int tickMs = 200); 00029 00030 virtual ~UAudioPlayerTone(); 00031 00032 virtual void play(); 00033 virtual void pause(); 00034 virtual void stop(); 00035 virtual unsigned int positionMs(); 00036 00037 virtual void setPositionMs(unsigned int pos); 00038 00039 //setters 00040 void setFreq(float freq) {_freq = freq;} 00041 void setVol(float vol) {_vol = vol;} 00042 void setToneMs(unsigned int toneMs) {_toneMs = toneMs;} 00043 void setSilenceMs(unsigned int tickMs) {_tickMs = tickMs;} 00044 00045 //getters 00046 float getFreq() {return _freq;} 00047 float getVol() {return _vol;} 00048 unsigned int getToneMs() {return _toneMs;} 00049 unsigned int getTickMs() {return _tickMs;} 00050 virtual int init(); 00051 00052 protected: 00053 00054 private: 00055 00056 virtual void mainLoopBegin(); 00057 virtual void mainLoop(); 00058 virtual void mainLoopEnd(); 00059 00060 private: 00061 float _freq; 00062 FMOD_DSP * _dsp; 00063 00064 unsigned int _toneMs; 00065 unsigned int _tickMs; 00066 float _vol; 00067 00068 }; 00069 00070 #endif