DirectSound Initialization Retry

Reporter: RobertBColton  |  Status: open  |  Last Modified: June 25, 2020, 01:43:11 PM

This solves #1770 the same way GM8.1 solves it, by displaying the error message in a loop that actually allows the user to retry. I tested it by simulating unplugging of my speakers by disabling the device in Device Manager. Sure enough, the dialog now correctly allows the user to abort or retry after the error occurs. If I enable my sound device after the error and retry, the game correctly starts and plays sound. Interestingly enough, once an application/process takes control over the sound device, there's no way to disable it in Device Manager short of physically removing the sound device (not possible?).

@time-killer-games what do you say about this one?

time-killer-games  
I think it should error once and ignore should be treated like ignore and not as a retry. That would imply sound would fail silently after pressing ignore. That way people can still play without sound because a lot of people don't exactly like listening to video game music anyway.

Feel free to disregard this comment if you disagree. You asked my opinion so I gave it. It's not a huge deal to me either way.

RobertBColton  

Then you've leaned towards the GMS solution, which requires a dummy interface, and tbh I had this feeling from the beginning. If we can't create a DirectSound object, then almost certainly the user already knows they have a sound problem or don't have their speakers plugged in. It could be intentional too, maybe they just don't want to play the game with sound.

There's other parts of this problem as I discussed with Rusky too. Modern games with detecting a change to the sound device, such as plugging headphones in after launching the game. How do other game engines handle this? I could easily hack our DirectSound system to poll in the background and continuously try to detect a sound device and swap out a dummy object, but then there's a problem of reloading sound buffers.

However, it would be impossible with OpenAL since it could not even do this similar retry as the OpenAL32.dll has to actually be reloaded due to the similar to OpenGL nature of its initialization. That drives us to considering system hot loading in ENIGMA. If ENIGMA had hot loading, it could solve this problem by swapping out the None and OpenAL system, which would reload the OpenAL dll.

RobertBColton  

@time-killer-games Thanks for your input, I did want to ask because you originally filed that issue. As it stands right now, on master, ignoring the message just crashes because I haven't programmed a dummy object.
time-killer-games  

That's fine, we can do whatever you guys prefer.
Please sign in to post comments, or you can view this issue on GitHub.