SDL_Mixer error "The mixer is not built with support ..."

I'm trying to play music in the background of a game I'm working on. I am using SDL2 and SDL mixer for the first time. I compiled them myself and put the files in the root folder of my program (for portability purposes). Now when I start the game no sound plays and Mix_GetError () returns this error:

"Mixer not built with MP3 support"

      

I am trying to play an MP3 file, but I am getting the same error when I try to initialize OGG and other formats.

Here's a function, if it's relevant at all.

int     play_sound(void)
{
    int         mp3;
    Mix_Music   *music;

    mp3 = MIX_INIT_MP3;
    music = NULL;
    if (mp3 != Mix_Init(mp3))
        return (put_error(Mix_GetError()));
    if (Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096) == -1)
        return (-1);
    music = Mix_LoadMUS("data/music.mp3");
    Mix_PlayMusic(music, -1);
    return (0);
}

      

I didn't find much in this particular issue, but I think the problem is with compiling SDL2 and SDL mixer from sources. I must have forgotten something, but I really don't know ... By the way, I'm on OSX (and haven't used it yet).

Thanks everyone for the help!

edit / I haven't tried with the WAV file.

+3


source to share





All Articles