| Summary: | XAudio 2Create() failed at initialization | ||
|---|---|---|---|
| Product: | SDL | Reporter: | rswhite4 |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.3 | ||
| Hardware: | x86_64 | ||
| OS: | Windows 7 | ||
Sorry, I mistyped: The code to play the sample is: > Mix_FadeInMusic(_music, 1, -1); Sorry, I changed the title. It seems that SDL and SDL_OpenAudio is the culprit. We're removing XAudio2 in favor of WASAPI after the 2.0.6 release. |
In Code::Blocks (Code::Blocks 13.12) and with MinGW (gcc (GCC) 4.8.1) I get the error > XAudio2: XAudio2Create() failed at initialization all the time. The responsible code is this: > if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0) { > std::cerr << "SDL init failed: " << SDL_GetError() << std::endl; > exit(1); > } If I check SDL_GetError after that, I get the error message above. But it works with Visual Studio 13 If I do not abort and proceed with: > int flags = MIX_INIT_OGG | MIX_INIT_MP3; > int initted = Mix_Init(flags); > if ((initted & flags) != flags) { > std::cerr << "Failed to init SDL_mixer: " << Mix_GetError() << std::endl; > exit(1); > } > > if (Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096) != 0) { > std::cerr << "Error by Mix_OpenAudio: " << Mix_GetError() << std::endl; > exit(1); > } The sound (an *.ogg file with a length of several minutes) plays only the first few seconds and repeat that gain and gain. The code to play the sample is: > Mix_FadeInMusic(_music, 1, 1); The Mix_Music pointer '_music' is (of course) valid.