Sdl 2.0.7 released!

Thanks to all the people who contributed code and feedback, SDL 2.0.7 is
now available!
http://www.libsdl.org/download-2.0.php

In addition to audio resampling improvements and fixed D-BUS support, here are the major changes in this release:

  • Added audio stream conversion functions:
    SDL_NewAudioStream
    SDL_AudioStreamPut
    SDL_AudioStreamGet
    SDL_AudioStreamAvailable
    SDL_AudioStreamFlush
    SDL_AudioStreamClear
    SDL_FreeAudioStream
  • Added functions to query and set the SDL memory allocation functions:
    SDL_GetMemoryFunctions()
    SDL_SetMemoryFunctions()
    SDL_GetNumAllocations()
  • Added locking functions for multi-threaded access to the joystick and game controller APIs:
    SDL_LockJoysticks()
    SDL_UnlockJoysticks()
  • The following functions are now thread-safe:
    SDL_SetEventFilter()
    SDL_GetEventFilter()
    SDL_AddEventWatch()
    SDL_DelEventWatch()

Enjoy!

3 Likes

There’s still tonnes of noise in audio like 2.0.6. Now it’s on every driver not just wasapi, and it’s there even if I set the frequency to the same as the hardware. Only tried Windows thus far.

Just as one data point, I’m not hearing any noise with:

  • Windows 10, default format (in the audio device properties) set to 24 bit / 48kHz.
  • application is requesting 16-bit, 44.1kHz from SDL. SDL is using the WASAPI backend.

The application is quakespasm and we’re providing audio data via the thread callback method, and not using SDL_mixer or SDL_AudioCVT.

What formats are your OS and SDL app using? Using SDL_mixer?

I think the key difference is the type of sound you’re listening to. I’m using sine waves and pulse waves so noise is much more noticeable than a sample which is already all over the place. I’m on Windows 10 and have tried 44100, 48000 and 192000 Hz at 16 bits on all the backends. I haven’t tried 24 bits. I’m also using the thread callback method and not using SDL_mixer or anything else. I’ll try to take a closer look at it or at least make a small demo application which shows the problem in the near future.

Hmmm, I get a lot of noise/bad feedback if I use stereo audio in 2.0.5 as well (which works with mono.) Not sure what’s going on. I’m just doubling up the same samples for L and R. If I don’t specify SDL_AUDIO_ALLOW_FORMAT_CHANGE with 2.0.7 and use mono, it sounds quite a bit better but not perfect.

Update: the problem with stereo audio was my fault. But I went through SDL hg history and tracked the noise down to the WASAPI driver. Then I found my code to force directsound had stopped working (had moved SDL_Init before it!) So yeah, the WASAPI driver is very noisy on my 2 Windows computers.

One last thing, may have found a small bug but not sure… judging by the comment and a cursory look this should be an or in src/audio/SDL_audiocvt.c:

@@ -1533,7 +1534,7 @@
         /* If we don't have a staging buffer or we're given enough data that
            we don't need to store it for later, skip the staging process.
          */
-        if (!stream->staging_buffer_filled && len >= stream->staging_buffer_size) {
+        if (!stream->staging_buffer_filled || len >= stream->staging_buffer_size) {
             return SDL_AudioStreamPutInternal(stream, buf, len, NULL);
         }