Browse Source

force audio driver to directsound, fix audio glitching in new wasapi driver introduced in SDL 2.0.6. thanks for solution provided by @louyihua

U-DESKTOP-HPNHAFN\palen 6 years ago
parent
commit
1230770a98
1 changed files with 2 additions and 1 deletions
  1. 2 1
      win32/win32.cpp

+ 2 - 1
win32/win32.cpp

@@ -381,7 +381,8 @@ INT_PTR CALLBACK LauncherDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
 typedef LANGID(__stdcall *GETLANGUAGEID)(void);
 
 extern "C" int UTIL_Platform_Init(int argc, char* argv[])
-{
+{
+	SDL_setenv("SDL_AUDIODRIVER","directsound",1);
 	// Try to get Vista+ API at runtime, and falls back to XP's API if not found
 	GETLANGUAGEID GetLanguage = (GETLANGUAGEID)GetProcAddress(GetModuleHandle(TEXT("Kernel32.dll")), "GetThreadUILanguage");
 	if (!GetLanguage) GetLanguage = GetUserDefaultLangID;