5

I have a game that, up until now, uses SDL_mixer for playing MP3 sound effects. Works on Linux, Windows, OSX. At the moment doesn't work on 64 bit Linux, so I was thinking of switching to FMOD.

Anyway, it would be nice if the game also worked on the PI, for when I get one. Is there a C library for mp3 playing that works on the PI? Does SDL_mixer work? I took a look at mpg123, but on Windows its just an exe and I need a cross platform lib. FMOD is not available for the PI.

3
  • Where did you read 'SDL_mixer does not work'? SDL_mixer seems to the easiest cross platform lib. However the MP3 audio format is dependent on additional libraries; which, may not be as portable. Have you tried switch the audio files to .wav? Oct 9, 2012 at 14:57
  • I thought I read it "somewhere" on a forum today, but I can't find it. Have reworded my post. Also, I haven't got a PI so I can't try your suggestion yet. Oct 9, 2012 at 15:18
  • you could use something like libsox for reading the mp3 and portaudio for audio playback. maybe not optimal, but it works. Oct 10, 2012 at 1:41

1 Answer 1

4

I can confirm that SDL_mixer works on the pi. I am working on a platform game and use SDL for graphics and sound. My sounds are in the ogg format, but SDL_mixer promises mp3 support as well. I have raspbian, every SDL package I needed I could install from the repositories. Btw, the same game runs well and with sound on 64 bit linux too (at least Ubuntu and Debian).

Incidentally, to get SDL graphics working in the console, have a look here for initializing it. Main point: first determine the screen dimensions with SDL_GetVideoInfo(), then initialize with those values.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.