We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2723 - XAudio 2Create() failed at initialization
Summary: XAudio 2Create() failed at initialization
Status: RESOLVED WONTFIX
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.3
Hardware: x86_64 Windows 7
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-08 19:46 UTC by rswhite4
Modified: 2017-08-14 05:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rswhite4 2014-09-08 19:46:10 UTC
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.
Comment 1 rswhite4 2014-09-08 19:48:57 UTC
Sorry, I mistyped:
The code to play the sample is:
 > Mix_FadeInMusic(_music, 1, -1);
Comment 2 rswhite4 2014-09-08 21:19:54 UTC
Sorry, I changed the title. It seems that SDL and SDL_OpenAudio is the culprit.
Comment 3 Sam Lantinga 2017-08-14 05:06:26 UTC
We're removing XAudio2 in favor of WASAPI after the 2.0.6 release.