| 6 |
| 7 | #ifndef LIBTGVOIP_AUDIOOUTPUTOPENSLES_H |
| 8 | #define LIBTGVOIP_AUDIOOUTPUTOPENSLES_H |
| 9 |
| 10 | #include <SLES/OpenSLES.h> |
| 11 | #include <SLES/OpenSLES_Android.h> |
| 12 |
| 13 | #include "../../audio/AudioOutput.h" |
| 14 |
| 15 | namespace tgvoip{ namespace audio{ |
| 16 | class AudioOutputOpenSLES : public AudioOutput{ |
| 17 | public: |
| 18 | AudioOutputOpenSLES(); |
| 19 | virtual ~AudioOutputOpenSLES(); |
| 20 | virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels); |
| 21 | virtual bool IsPhone(); |
| 22 | virtual void EnableLoudspeaker(bool enabled); |
| 23 | virtual void Start(); |
| 24 | virtual void Stop(); |
| 25 | virtual bool IsPlaying(); |
| 26 | virtual float GetLevel(); |
| 27 |
| 28 | static void SetNativeBufferSize(unsigned int size); |
| 29 | static unsigned int nativeBufferSize; |
| 30 |
| 31 | private: |
| 32 | static void BufferCallback(SLAndroidSimpleBufferQueueItf bq, void *context); |
| 33 | void HandleSLCallback(); |
| 34 | SLEngineItf slEngine; |
| 35 | SLObjectItf slPlayerObj; |
| 36 | SLObjectItf slOutputMixObj; |
| 37 | SLPlayItf slPlayer; |
| 38 | SLAndroidSimpleBufferQueueItf slBufferQueue; |
| 39 | int16_t* buffer; |
| 40 | int16_t* nativeBuffer; |
| 41 | bool stopped; |
| 42 | unsigned char remainingData[10240]; |
| 43 | size_t remainingDataSize; |
| 44 | }; |
| 45 | }} |
| 46 |
| 47 | #endif //LIBTGVOIP_AUDIOOUTPUTANDROID_H |
| 48 |