vendredi 29 mai 2015

SDL_Mixer error "Mixer not built with ... support"

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

"Mixer not built with MP3 support"

I'm trying to play a MP3 file, but I get the same error when I try to initialize with OGG and other formats.

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

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 haven't found much on that particular issue, but I think the problem comes from me compiling SDL2 and SDL-mixer from sources. I must've forgot something, but I don't really know... I'm on OSX by the way (and not really used to it yet).

Thanks everyone for the help!

edit/ I have not tried with a WAV file.

Aucun commentaire:

Enregistrer un commentaire