1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-12-11 16:49:52 +01:00
libtgvoip/os/android/AudioOutputOpenSLES.h

48 lines
1.3 KiB
C
Raw Normal View History

2017-02-02 17:24:40 +01:00
//
// libtgvoip is free and unencumbered public domain software.
// For more information, see http://unlicense.org or the UNLICENSE file
// you should have received with this source code distribution.
//
#ifndef LIBTGVOIP_AUDIOOUTPUTOPENSLES_H
#define LIBTGVOIP_AUDIOOUTPUTOPENSLES_H
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
#include "../../audio/AudioOutput.h"
namespace tgvoip{ namespace audio{
class AudioOutputOpenSLES : public AudioOutput{
2017-02-02 17:24:40 +01:00
public:
AudioOutputOpenSLES();
virtual ~AudioOutputOpenSLES();
2017-02-02 17:24:40 +01:00
virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
virtual bool IsPhone();
virtual void EnableLoudspeaker(bool enabled);
virtual void Start();
virtual void Stop();
virtual bool IsPlaying();
virtual float GetLevel();
2018-05-15 20:23:46 +02:00
static void SetNativeBufferSize(unsigned int size);
static unsigned int nativeBufferSize;
2017-02-02 17:24:40 +01:00
private:
static void BufferCallback(SLAndroidSimpleBufferQueueItf bq, void *context);
void HandleSLCallback();
SLEngineItf slEngine;
SLObjectItf slPlayerObj;
SLObjectItf slOutputMixObj;
SLPlayItf slPlayer;
SLAndroidSimpleBufferQueueItf slBufferQueue;
int16_t* buffer;
int16_t* nativeBuffer;
bool stopped;
unsigned char remainingData[10240];
size_t remainingDataSize;
};
}}
2017-02-02 17:24:40 +01:00
#endif //LIBTGVOIP_AUDIOOUTPUTANDROID_H