1

I've been working on my first SDL game and adding sound effects went without a hitch. However as soon as I tried adding music, Mix_LoadMus() crashes the program.

if(SDL_Init(SDL_INIT_EVERYTHING) !=0)
    std::cout<<"SDL_INIT failed\n"<<SDL_GetError()<<std::endl;

if( Mix_Init(MIX_INIT_OGG | MIX_INIT_MOD | MIX_INIT_FLAC | MIX_INIT_MP3) !=0 )
    std::cout<< "SDL_mixer could not initialize! SDL_mixer Error\n"<<Mix_GetError()<<std::endl;


if( Mix_OpenAudio( 44100, MIX_DEFAULT_FORMAT, 2, 2048 ) < 0 )
    std::cout<< "SDL_mixer could not open audio! SDL_mixer Error\n"<<Mix_GetError()<<std::endl;

Mix_Music *music = Mix_LoadMUS("music.wav");
if( music == NULL )
    std::cout<<"Failed to load music! SDL_mixer Error\n"<<Mix_GetError()<<std::endl;

This crashes without any output. Heres the backtrace:

RaiseException()
SDL_LogCritical()
SDL_LogCritical()
SDL_LogCritical()
KERENEL32!BaseThreadInitThunk()
ntdll!RtlUserThreadStart()

My assumption is that something goes horribly wrong when retrieving the file but I have no idea how to go about correcting it. Any help is much appreciated.

0 Answers0