commit 01c80a14685fe493b019a4e1e02cdababf452825
parent 88b376c9f47d1b4851be142bc6834ec89cbe104f
Author: Christopher Snowhill <kode54@gmail.com>
Date: Mon, 29 Mar 2021 15:17:04 -0700
Fix macOS default audio device config, since SDL doesn't appreciably list the current default device first
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/ft2_audioselector.c b/src/ft2_audioselector.c
@@ -24,6 +24,9 @@ char *getAudioOutputDeviceFromConfig(void)
FILE *f = UNICHAR_FOPEN(editor.audioDevConfigFileLocation, "r");
if (f == NULL)
{
+#if defined(__APPLE__)
+ return NULL; // SDL doesn't return devices in any appreciable order, and device 0 is most certainly not guaranteed to be the current default device
+#else
const char *devStringTmp = SDL_GetAudioDeviceName(0, false);
if (devStringTmp == NULL)
{
@@ -35,6 +38,7 @@ char *getAudioOutputDeviceFromConfig(void)
if (devStringLen > 0)
strncpy(devString, devStringTmp, MAX_DEV_STR_LEN);
devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination
+#endif
}
else
{