shithub: ft2-clone

Download patch

ref: 01c80a14685fe493b019a4e1e02cdababf452825
parent: 88b376c9f47d1b4851be142bc6834ec89cbe104f
author: Christopher Snowhill <[email protected]>
date: Mon Mar 29 11:17:31 EDT 2021

Fix macOS default audio device config, since SDL doesn't appreciably list the current default device first

--- a/src/ft2_audioselector.c
+++ b/src/ft2_audioselector.c
@@ -24,6 +24,9 @@
 	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 @@
 		if (devStringLen > 0)
 			strncpy(devString, devStringTmp, MAX_DEV_STR_LEN);
 		devString[devStringLen+1] = '\0'; // UTF-8 needs double null termination
+#endif
 	}
 	else
 	{