MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / RecoverWasapiDevice

Function RecoverWasapiDevice

deps/SDL2/src/audio/wasapi/SDL_wasapi.c:238–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236static void ReleaseWasapiDevice(_THIS);
237
238static SDL_bool
239RecoverWasapiDevice(_THIS)
240{
241 ReleaseWasapiDevice(this); /* dump the lost device's handles. */
242
243 if (this->hidden->default_device_generation) {
244 this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration);
245 }
246
247 /* this can fail for lots of reasons, but the most likely is we had a
248 non-default device that was disconnected, so we can't recover. Default
249 devices try to reinitialize whatever the new default is, so it's more
250 likely to carry on here, but this handles a non-default device that
251 simply had its format changed in the Windows Control Panel. */
252 if (WASAPI_ActivateDevice(this, SDL_TRUE) == -1) {
253 SDL_OpenedAudioDeviceDisconnected(this);
254 return SDL_FALSE;
255 }
256
257 this->hidden->device_lost = SDL_FALSE;
258
259 return SDL_TRUE; /* okay, carry on with new device details! */
260}
261
262static SDL_bool
263RecoverWasapiIfLost(_THIS)

Callers 1

RecoverWasapiIfLostFunction · 0.85

Calls 4

ReleaseWasapiDeviceFunction · 0.85
SDL_AtomicGetFunction · 0.85
WASAPI_ActivateDeviceFunction · 0.70

Tested by

no test coverage detected