SDL: Ignore audio switch events in first second.

We get new device events right on start, which makes auto switch away from
the preferred / most recent device otherwise.  Fixes #12536.
This commit is contained in:
Unknown W. Brackets 2020-01-01 07:47:26 -08:00
parent 0a5ec48382
commit 9989c51f21

View File

@ -910,7 +910,9 @@ int main(int argc, char *argv[]) {
if (!name) {
break;
}
if (g_Config.bAutoAudioDevice || g_Config.sAudioDevice == name) {
// Don't start auto switching for a second, because some devices init on start.
bool doAutoSwitch = g_Config.bAutoAudioDevice && framecount > 60;
if (doAutoSwitch || g_Config.sAudioDevice == name) {
StopSDLAudioDevice();
InitSDLAudioDevice(name ? name : "");
}