The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Windows 7 update messing with SDL2_mixer?
Christian Knudsen


Joined: 14 Nov 2009
Posts: 37
I'm having a weird issue. I first noticed that some of the sound effects in my game had a hiss/static quality to them. Thinking it might be my headphones giving up, I unplugged my headphones. No sound came from the laptop speakers. Tried turning up the volume. Still nothing. Plugged the headphones back in. Silence. I then tried the same with VLC to check if this was a global issue, but VLC played some music fine with the headphones plugged in, continued to play from the laptop speakers when the headphones were unplugged, and still played in the headphones when I plugged them back in. This sound issue with SDL2_mixer (I assume) also results in another of my games freezing completely when shutting down (this only happens when the sound is 'muted' or whatever is happening when I unplug the headphones and plug them back in). I tested the same thing on a Linux machine and it didn't have this problem. So... does anybody know if a recent Windows 7 update has messed up SDL2_mixer?
Christian Knudsen


Joined: 14 Nov 2009
Posts: 37
Also, if I start the game with headphones unplugged, plugging in the headphones doesn't seem to do anything -- it just keeps playing through the laptop speakers.
Christian Knudsen


Joined: 14 Nov 2009
Posts: 37
Found an old version of my game that uses SDL 1.2.14 and SDL_mixer 1.2.12 and it doesn't have this problem.
Christian Knudsen


Joined: 14 Nov 2009
Posts: 37
Well, updating my audio driver fixed the headphone issue. There's still an issue with high frequencies getting a sharp/hissy tinge to them that I don't get in the older game version that uses SDL 1.2.
Christian Knudsen


Joined: 14 Nov 2009
Posts: 37
Setting audio to 44100 Hz instead of 22050 seems to have fixed the sharp/hissy tinge issue. But all my wavs are 22050, so I guess SDL2_mixer just doesn't handle being set to 22050 very well?
Windows 7 update messing with SDL2_mixer?
eric.w


Joined: 12 Feb 2014
Posts: 38
Hi,
I encountered something similar with 11025Hz audio. It turned out to
be a bug either in the SDL2 XAudio2 code, or in XAudio2 itself, which
I filed here: https://bugzilla.libsdl.org/show_bug.cgi?id=2551
Basically, the resampling done by XAudio2 is unusably bad.

Can you see if SDL_AudioInit("winmm") or SDL_AudioInit("directsound ")
fixes the issue, in which case it's likely the same bug as I was
hitting?

IMO, one fix could be, SDL2 could blacklist the XAudio2 driver if it's
going to have to do any resampling, and fall back to
winmm/directsound.

On Tue, Mar 10, 2015 at 10:08 AM, Christian Knudsen
wrote:
Quote:
Setting audio to 44100 Hz instead of 22050 seems to have fixed the
sharp/hissy tinge issue. But all my wavs are 22050, so I guess SDL2_mixer
just doesn't handle being set to 22050 very well?

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: Windows 7 update messing with SDL2_mixer?
Christian Knudsen


Joined: 14 Nov 2009
Posts: 37
eric.w wrote:
Can you see if SDL_AudioInit("winmm") or SDL_AudioInit("directsound ")
fixes the issue, in which case it's likely the same bug as I was
hitting?


Yup, both of these fixed the issue. I'm not getting any distortion at 22050 Hz now. With winmm there was a 1-2 second audio delay, so that wasn't really usable, but directsound seems to work perfect. So I can just use that without any problems?
Windows 7 update messing with SDL2_mixer?
eric.w


Joined: 12 Feb 2014
Posts: 38
On Tue, Mar 10, 2015 at 2:10 PM, Christian Knudsen wrote:

Quote:



eric.w wrote:

Can you see if SDL_AudioInit("winmm") or SDL_AudioInit("directsound ")
fixes the issue, in which case it's likely the same bug as I was
hitting?




Yup, both of these fixed the issue. I'm not getting any distortion at 22050 Hz now. With winmm there was a 1-2 second audio delay, so that wasn't really usable, but directsound seems to work perfect. So I can just use that without any problems?






I'm not sure to be honest, but I assume it's safe, SDL1.2 only had waveout and directsound.Here are the docs for the SDL_AudioInit function:
https://wiki.libsdl.org/SDL_AudioInit?highlight=%28%5CbCategoryAudio%5Cb%29%7C%28CategoryEnum%29%7C%28CategoryStruct%29