| Summary: | Xaudio2: Xaudio2Create() failed | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Wouter van Oortmerssen <aardappel> |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P1 | CC: | philipp.wiesemann |
| Version: | 2.0.3 | ||
| Hardware: | x86 | ||
| OS: | Windows 7 | ||
|
Description
Wouter van Oortmerssen
2013-05-22 21:50:04 UTC
Is the error message containing "XAudio2Create() failed" caused in SDL_OpenAudioDevice() or already in SDL_Init*()? Maybe XAudio2 is not used but an other audio backend. It happens during SDL_InitSubSystem(SDL_INIT_AUDIO). If another backend is being used, it must be a NULL driver, since there's no actual audio output. The subsequent SDL_OpenAudioDevice returns 2, so that sounds plausible. This problem is still happening in 2.0.3 (that I just upgraded to), I thought I'd look at it again, see if it gives any new output.
This is on Windows 7, VS 2013
The problem ONLY happens in release mode, which doesn't help with tracking it down.
If I just run it, the moment it tries to init audio, it outputs:
ERROR: Not enough resources to create thread
It then freezes. If I try to break the program, it looks stuck in
ntdll.dll!_ZwWaitForSingleObject or on occasion in SDL_SemWaitTimeout
If I step through the code in the debugger (in release mode), I get through SDL_OpenAudioDevice without it hanging or giving the above message, but instead it says:
ERROR: XAudio2: Couldn't create mastering voice
So the issue seems timing related as well.
Again, my code, which I run upon the first sound I want to play, looks like:
if (SDL_InitSubSystem(SDL_INIT_AUDIO))
return false;
SDL_zero(playbackspec);
playbackspec.freq = 44100;
playbackspec.format = AUDIO_S16SYS;
playbackspec.channels = 1;
playbackspec.samples = 512;
playbackspec.callback = SDLAudioCallback;
playbackspec.userdata = nullptr;
audioid = SDL_OpenAudioDevice(nullptr, 0, &playbackspec, nullptr, SDL_AUDIO_ALLOW_ANY_CHANGE);
The audio devices I get are (in both debug and release):
LOG: Audio device 0: Speakers (Realtek High Definition Audio)
LOG: Audio device 1: Realtek Digital Output (Realtek High Definition Audio)
LOG: Audio device 2: Realtek Digital Output(Optical) (Realtek High Definition Audio)
and it returns audio device id 2 in debug.
passing any of these 2 names to SDL_OpenAudioDevice explicitly makes no difference.
We're removing XAudio2 in favor of WASAPI after the 2.0.6 release. |