summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorSepalani <sepalani@hotmail.fr>2024-05-12 23:29:00 +0400
committerSepalani <sepalani@hotmail.fr>2025-05-07 20:33:22 +0400
commitdbc09bfb0d75f939fd29e68d621cb56fff07ba6e (patch)
treedadef3d17653b4544ee9b9d53d97d8c8c074811a /Source/Core
parenta85ffc116e6fd2af83f53e4b5d1a4937e5af1225 (diff)
Android: Add emulated Wii Speak
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/IOS/USB/Emulated/Microphone.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp b/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp
index 450247b12b..6e2f40072c 100644
--- a/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp
+++ b/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp
@@ -23,6 +23,10 @@
#include <Objbase.h>
#endif
+#ifdef ANDROID
+#include "jni/AndroidCommon/IDCache.h"
+#endif
+
namespace IOS::HLE::USB
{
Microphone::Microphone(const WiiSpeakState& sampler) : m_sampler(sampler)
@@ -122,6 +126,20 @@ void Microphone::StreamStart()
return;
m_work_queue.PushBlocking([this] {
#endif
+
+#ifdef ANDROID
+ JNIEnv* env = IDCache::GetEnvForThread();
+ if (jboolean result = env->CallStaticBooleanMethod(
+ IDCache::GetPermissionHandlerClass(),
+ IDCache::GetPermissionHandlerHasRecordAudioPermission(), nullptr);
+ result == JNI_FALSE)
+ {
+ env->CallStaticVoidMethod(IDCache::GetPermissionHandlerClass(),
+ IDCache::GetPermissionHandlerRequestRecordAudioPermission(),
+ nullptr);
+ }
+#endif
+
cubeb_stream_params params{};
params.format = CUBEB_SAMPLE_S16LE;
params.rate = SAMPLING_RATE;