-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No device and/or context creation failure on some hardware. #1118
Comments
Hi. Are you able to provide a trace log from OpenAL Soft? If you set the |
Hi, sorry for the delay, I was waiting for someone to send me the logs. Here it is
|
Looks like
The log doesn't show OpenAL Soft trying to open it in exclusive mode. Is there anything else running on the system that may periodically try opening the device in exclusive mode? Unfortunately since it's an error from the system about the device being unavailable, there isn't really much to do except try again after a moment. The error code The way the error happens in that log does seem a bit weird. It works the first time, gets closed, then fails to reopen the audio client right afterward due to the device being in use. This kind of behavior is something you'd sometimes see when using hardware directly; after closing a device it could take an extra moment for the hardware resources to be freed and become usable again. But using the device in shared mode through WASAPI should avoid that problem since it's the audio service managing the device state, and the apps/clients are simply providing a stream to the shared mode engine for it to mix together for output. The mentioned workaround, having a youtube video playing in the background, does seem to play into this behavior though, as it would basically force WASAPI to keep the hardware open and in use by the shared mode engine while OpenAL Soft opens, closes, and reopens its own device client(s). If it's not the fault of some background process temporarily opening the device in exclusive mode, this would suggest a race condition in either WASAPI or the device driver. An app tries to open the device at the same moment the hardware is being put into a suspended/stopped state, but rather than waiting for the hardware to finish transitioning to a suspended/stopped state to be able to resume/start it again, it's inferred as the device being in-use. |
Thanks for your answer ! |
The simplest solution would likely be to have a loop where you do a short delay (20 ms or so, probably) and try again, and break from the loop after it succeeds or a certain amount of time passes (or a certain number of attempts). I can't really give any guidance on how long to wait since I wouldn't expect this to happen to begin with, I don't know how much of a delay to expect, nor do I know what else your app may be trying to do at this point that would get held up by waiting. Maybe 1 or 2 seconds max is the longest I'd wait, if not shorter, but it's up to you. You wouldn't want to wait indefinitely since it can also be possible the device is actually in use by another process with exclusive access and won't be available any time soon. |
Thank you, will try that and see what happens. |
Hi,
I'm making a game and some of my players are having issues on their computers. Looking at the logs I see that either OpenAL doesn't find any device or the context creation fails.
I don't do anything complex and everything can be resumed to this:
It looks like it happens mostly on USB sound cards such as Sound Blaster GC7 and some USB headsets.
Unfortunately I don't have the error code returned because I didn't logged this information before and now I've fixed the crashes when sound system isn't initialized I don't receive reports any more.
However, I can say that there is a workaround for this, which is described here which is quite dumb: simply play a video on youtube before launching the game, and voilà. Note this also works if one's playing with the sound volume control of Windows that plays a little sound when touched.
I feel like for some reason OpenAL can't find or use devices if they're in some "sleep" mode, and playing some sound on the desktop "wake" them up.
As apart from my game at least another one have this issue, I guess I'm not the only one to encounter this.
By chance, does anybody know if there is something to prevent this ?
The text was updated successfully, but these errors were encountered: