Xaudio2 - don't schedule auto restart until after successful device creation.
@@ -76,6 +76,8 @@ class XAudio2Driver:
self._players = [] # Only used for resetting/restoring xaudio2. Store players to callback.
+ self._create_xa2()
+
if self.restart_on_error:
audio_devices = get_audio_device_manager()
if audio_devices:
@@ -87,8 +89,6 @@ class XAudio2Driver:
pyglet.clock.schedule_interval_soft(self._check_state, 0.5)
- self._create_xa2()
-
def _check_state(self, dt):
"""Hack/workaround, you cannot shutdown/create XA2 within a COM callback, set a schedule to check state."""
if self._dead is True:
