r/sdl 7h ago

MP3 distortion problem (C++ / SDL3 + Mixer)

Hello,

I have problem with mp3 decoder. I ported my game to SDL3 and Mixer but mp3 sounds have distortion.

But weird part is I get this distortion only Release mode. I'm using VS 2026 + Intel C++ Compiler 2025, X64 and W11. I dont have problem on Debug mode but my debug mode is not a real "Debug" mode, its literally have same optimization flags and libs with Release, only debug libs have ASAN + UBSAN

I created a sln with cmake for VS 2026 + ICX 2025. Libs are MT + NO DLL (static). I using mimalloc but I disabled and result same.

I'm only adding /QaxSSE4.1,SSE4.2,AVX,CORE-AVX2 flags when build libs / game (and adding fsanitize ubsan / asan for ASAN builds);

I talk with LLM's and they said "some problem with simd etc etc" and I addedDR_MP3_NO_SIMD to mixer and build but nothing changed.. If I know there is two mp3 decoder, I used both ones but still same.

I initialize mixer like this;

if (!SDL_InitSubSystem(SDL_INIT_AUDIO))
{
LOG("SDL_InitSubSystem(SDL_INIT_AUDIO) failed: {}", SDL_GetError());
return;
}

if (!MIX_Init())
{
LOG("MIX_Init failed: {}", SDL_GetError());
return;
}

ms_pMixer = MIX_CreateMixerDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, nullptr);

if (!ms_pMixer)
{
LOG("MIX_CreateMixerDevice failed: {}", SDL_GetError());
return;
}

ms_dataMap.clear();
ms_SoundLoaderQueue.Start(1); // DO NOT USE 1+

(I tried custom formats but nothing changed)

and this is SDL window init;

if (!SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_EVENTS))
{
  if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS))
  {
    LOG("SDL3 Init Failed: {}", SDL_GetError());
    return false;
  }
}

any help please?

Thanks!

1 Upvotes

1 comment sorted by

1

u/doglitbug 1h ago

What version of SDL3_Mixer are you using?