Debian Codegraph @

Source/Core/AudioCommon/OpenSLESStream.h

raw symbols SCIP
1 // Copyright 2008 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #ifdef HAVE_OPENSL_ES
7 #include <array>
8 #include <vector>
9
10 #include <SLES/OpenSLES.h>
11 #include <SLES/OpenSLES_Android.h>
12 #endif // HAVE_OPENSL_ES
13
14 #include "AudioCommon/SoundStream.h"
15
16 class OpenSLESStream final : public SoundStream
17 {
18 #ifdef HAVE_OPENSL_ES
19 public:
20 ~OpenSLESStream() override;
21 bool Init() override;
22 bool SetRunning(bool running) override;
23 void SetVolume(int volume) override;
24 static bool IsValid() { return true; }
25
26 private:
27 static void BQPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void* context);
28 void PushSamples(SLAndroidSimpleBufferQueueItf bq);
29
30 // engine interfaces
31 SLObjectItf m_engine_object;
32 SLEngineItf m_engine_engine;
33 SLObjectItf m_output_mix_object;
34
35 // buffer queue player interfaces
36 SLObjectItf m_bq_player_object = nullptr;
37 SLPlayItf m_bq_player_play;
38 SLAndroidSimpleBufferQueueItf m_bq_player_buffer_queue;
39 SLVolumeItf m_bq_player_volume;
40
41 SLuint32 m_frames_per_buffer;
42 SLuint32 m_bytes_per_buffer;
43
44 // Double buffering.
45 std::array<std::vector<short>, 2> m_buffer;
46 int m_current_buffer = 0;
47 #endif // HAVE_OPENSL_ES
48 };