Android: Add emulated Wii Speak

This commit is contained in:
Sepalani
2024-05-12 23:29:00 +04:00
parent a85ffc116e
commit dbc09bfb0d
12 changed files with 153 additions and 2 deletions

View File

@ -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;