apple: don't allow opening sdl2 microphone if not using sdl2 audio (#16989)
Some checks failed
CI Windows (MSVC) / msvc (Debug, x64, 2019) (push) Waiting to run
CI Windows (MSVC) / msvc (Debug, x64, 2022) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, 2019) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, 2022) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, UWP) (push) Waiting to run
CI Windows (MSVC) / msvc (ReleaseAngle, x64, UWP) (push) Waiting to run
CI macOS / build (push) Waiting to run
CI 3DS / build (push) Failing after 1s
CI Android / build (push) Failing after 1s
CI DOS/DJGPP / build (push) Failing after 1s
CI Emscripten / build (push) Failing after 1s
CI GameCube / build (push) Failing after 1s
CI Linux (i686) / build (push) Failing after 1s
CI Miyoo ARM32 / build (push) Failing after 1s
CI PS2 / build (push) Failing after 1s
CI PS4/ORBIS / build (push) Failing after 1s
CI PSP / build (push) Failing after 1s
CI PSVita / build (push) Failing after 1s
CI RS90 Odbeta MIPS32 / build (push) Failing after 1s
CI RetroFW MIPS32 / build (push) Failing after 1s
CI Switch/libnx / build (push) Failing after 1s
CI Wii / build (push) Failing after 1s
CI WiiU / build (push) Failing after 1s
CI Windows i686 (MXE) / build (push) Failing after 1s
CI Windows x64 (MXE) / build (push) Failing after 1s
Crowdin Workflow / sync (push) Failing after 1s
RetroArch CI / linux-c89 (push) Failing after 1s
CI webOS / build (push) Failing after 1s
Crowdin Daily Workflow / sync (push) Failing after 0s

This commit is contained in:
Eric Warmenhoven 2024-09-11 15:33:41 -04:00 committed by GitHub
parent 14b1af9e1a
commit 6e2f0a4f30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 28 additions and 0 deletions

View File

@ -132,6 +132,16 @@ static void *sdl_microphone_open_mic(void *driver_context,
SDL_AudioSpec desired_spec = {0};
void *tmp = NULL;
#if __APPLE__
if (!string_is_equal(audio_driver_get_ident(), "sdl2"))
{
runloop_msg_queue_push(
msg_hash_to_str(MSG_SDL2_MIC_NEEDS_SDL2_AUDIO), 1, 100, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_WARNING);
return NULL;
}
#endif
/* If the audio driver wasn't initialized yet... */
if (!SDL_WasInit(SDL_INIT_AUDIO))
{

View File

@ -521,10 +521,15 @@ static const enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_AUDIOIO;
static const enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_OSS;
#elif defined(HAVE_JACK)
static const enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_JACK;
#elif defined(HAVE_COREAUDIO3) || defined(HAVE_COREAUDIO)
/* SDL microphone does not play well with coreaudio audio driver */
#if defined(HAVE_SDL2) && defined(HAVE_MICROPHONE)
static const enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_SDL2;
#elif defined(HAVE_COREAUDIO3)
static const enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_COREAUDIO3;
#elif defined(HAVE_COREAUDIO)
static const enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_COREAUDIO;
#endif
#elif defined(HAVE_WASAPI)
static const enum audio_driver_enum AUDIO_DEFAULT_DRIVER = AUDIO_WASAPI;
#elif defined(HAVE_XAUDIO)

View File

@ -16558,6 +16558,10 @@ MSG_HASH(
MSG_IOS_TOUCH_MOUSE_DISABLED,
"Touch mouse is disabled"
)
MSG_HASH(
MSG_SDL2_MIC_NEEDS_SDL2_AUDIO,
"sdl2 microphone requires sdl2 audio driver"
)
MSG_HASH(
MSG_ACCESSIBILITY_STARTUP,
"RetroArch accessibility on. Main Menu Load Core."

View File

@ -578,6 +578,7 @@ enum msg_hash_enums
MSG_IOS_TOUCH_MOUSE_ENABLED,
MSG_IOS_TOUCH_MOUSE_DISABLED,
MSG_SDL2_MIC_NEEDS_SDL2_AUDIO,
/* Add To Playlist*/
MSG_ADDED_TO_PLAYLIST,

View File

@ -51,6 +51,11 @@
#import <GameController/GCMouse.h>
#endif
#ifdef HAVE_SDL2
#define SDL_MAIN_HANDLED
#include "SDL.h"
#endif
#if defined(HAVE_COCOA_METAL) || defined(HAVE_COCOATOUCH)
#import "JITSupport.h"
id<ApplePlatform> apple_platform;
@ -963,6 +968,9 @@ int main(int argc, char *argv[])
RARCH_LOG("Ptrace hack complete, JIT support is enabled.\n");
else
RARCH_WARN("Ptrace hack NOT available; Please use an app like Jitterbug.\n");
#endif
#ifdef HAVE_SDL2
SDL_SetMainReady();
#endif
@autoreleasepool {
return UIApplicationMain(argc, argv, NSStringFromClass([RApplication class]), NSStringFromClass([RetroArch_iOS class]));