| 6 |
| 7 | #ifndef LIBTGVOIP_AUDIOOUTPUTWAVE_H |
| 8 | #define LIBTGVOIP_AUDIOOUTPUTWAVE_H |
| 9 |
| 10 | #include "../../audio/AudioOutput.h" |
| 11 | #include <string> |
| 12 | #include <vector> |
| 13 | #include <windows.h> |
| 14 |
| 15 | namespace tgvoip |
| 16 | { |
| 17 | namespace audio |
| 18 | { |
| 19 |
| 20 | class AudioOutputWave : public AudioOutput |
| 21 | { |
| 22 | public: |
| 23 | AudioOutputWave(std::string deviceID); |
| 24 | virtual ~AudioOutputWave(); |
| 25 | virtual void Start(); |
| 26 | virtual void Stop(); |
| 27 | virtual bool IsPlaying(); |
| 28 | virtual void SetCurrentDevice(std::string deviceID); |
| 29 | static void EnumerateDevices(std::vector<AudioOutputDevice>& devs); |
| 30 |
| 31 | private: |
| 32 | HWAVEOUT hWaveOut; |
| 33 | WAVEFORMATEX format; |
| 34 | WAVEHDR buffers[4]; |
| 35 | static void CALLBACK WaveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2); |
| 36 | void OnBufferDone(WAVEHDR* hdr); |
| 37 | bool isPlaying; |
| 38 | }; |
| 39 |
| 40 | } |
| 41 | } |
| 42 |
| 43 | #endif //LIBTGVOIP_AUDIOOUTPUTWAVE_H |
| 44 |