mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Android: Get rid of OpenSLESStream's global state
Not sure if we're ever going to want to have more than one of these at the same time, but these global variables are a code smell nonetheless. I'm also deleting the existing member variables because they were unused.
This commit is contained in:
@ -3,10 +3,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <thread>
|
||||
#ifdef HAVE_OPENSL_ES
|
||||
#include <SLES/OpenSLES.h>
|
||||
#include <SLES/OpenSLES_Android.h>
|
||||
#endif // HAVE_OPENSL_ES
|
||||
|
||||
#include "AudioCommon/SoundStream.h"
|
||||
#include "Common/Event.h"
|
||||
|
||||
class OpenSLESStream final : public SoundStream
|
||||
{
|
||||
@ -19,7 +21,25 @@ public:
|
||||
static bool IsValid() { return true; }
|
||||
|
||||
private:
|
||||
std::thread thread;
|
||||
Common::Event soundSyncEvent;
|
||||
static void BQPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void* context);
|
||||
void PushSamples(SLAndroidSimpleBufferQueueItf bq);
|
||||
|
||||
// engine interfaces
|
||||
SLObjectItf m_engine_object;
|
||||
SLEngineItf m_engine_engine;
|
||||
SLObjectItf m_output_mix_object;
|
||||
|
||||
// buffer queue player interfaces
|
||||
SLObjectItf m_bq_player_object = nullptr;
|
||||
SLPlayItf m_bq_player_play;
|
||||
SLAndroidSimpleBufferQueueItf m_bq_player_buffer_queue;
|
||||
SLVolumeItf m_bq_player_volume;
|
||||
|
||||
static constexpr int BUFFER_SIZE = 512;
|
||||
static constexpr int BUFFER_SIZE_IN_SAMPLES = BUFFER_SIZE / 2;
|
||||
|
||||
// Double buffering.
|
||||
short m_buffer[2][BUFFER_SIZE];
|
||||
int m_current_buffer = 0;
|
||||
#endif // HAVE_OPENSL_ES
|
||||
};
|
||||
|
Reference in New Issue
Block a user