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 2940 - default audio driver (xaudio2) doesn't support reopening device
Summary: default audio driver (xaudio2) doesn't support reopening device
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.3
Hardware: x86_64 Windows 7
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-11 17:04 UTC by g1529208
Modified: 2017-05-27 20:05 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 g1529208 2015-04-11 17:04:22 UTC
The following does not work with the default audio driver on my system (xaudio2):

ASSERT (SDL_OpenAudio (&audio, nullptr) == 0);
SDL_PauseAudio (false);
// <Later>
SDL_CloseAudio ();
ASSERT (SDL_OpenAudio (&audio, nullptr) == 0); // <- this fails the assert

Checking SDL_GetError, "XAudio2: XAudio2Create() failed at open." is returned.

The above code works fine (as it should) with the directsound audio driver.

This bug prevents one from changing the audio format/sample-rate (by reopening the device with the new format/sample-rate), or from closing the device for a while while no sound is expected.
Comment 1 Ryan C. Gordon 2017-05-27 20:05:18 UTC
Coming along to this a long time later, I can't get this to reproduce, but we made heavy fixes to this code since then, so I'm assuming we fixed it.

(Also, we're about to dump XAudio2 entirely, with a new WASAPI renderer for Vista and later, and DirectSound remaining for WinXP...and winmm for XP users with bad DirectSound drivers. :)   ...so you should be good to go here in 2.0.6 in any case, if not already in 2.0.5).

--ryan.