123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #ifndef AUDIO_DRIVER_OPENSL_H
- #define AUDIO_DRIVER_OPENSL_H
- #include "os/mutex.h"
- #include "servers/audio_server.h"
- #include <SLES/OpenSLES.h>
- #include <SLES/OpenSLES_Android.h>
- class AudioDriverOpenSL : public AudioDriver {
- bool active;
- Mutex *mutex;
- enum {
- BUFFER_COUNT = 2
- };
- bool pause;
- uint32_t buffer_size;
- int16_t *buffers[BUFFER_COUNT];
- int32_t *mixdown_buffer;
- int last_free;
- SLPlayItf playItf;
- SLObjectItf sl;
- SLEngineItf EngineItf;
- SLObjectItf OutputMix;
- SLVolumeItf volumeItf;
- SLObjectItf player;
- SLAndroidSimpleBufferQueueItf bufferQueueItf;
- SLDataSource audioSource;
- SLDataFormat_PCM pcm;
- SLDataSink audioSink;
- SLDataLocator_OutputMix locator_outputmix;
- SLBufferQueueState state;
- static AudioDriverOpenSL *s_ad;
- void _buffer_callback(
- SLAndroidSimpleBufferQueueItf queueItf
-
- );
- static void _buffer_callbacks(
- SLAndroidSimpleBufferQueueItf queueItf,
-
- void *pContext);
- public:
- void set_singleton();
- virtual const char *get_name() const;
- virtual Error init();
- virtual void start();
- virtual int get_mix_rate() const;
- virtual SpeakerMode get_speaker_mode() const;
- virtual void lock();
- virtual void unlock();
- virtual void finish();
- virtual void set_pause(bool p_pause);
- AudioDriverOpenSL();
- };
- #endif
|