I worked on such a implementation using three different approaches: SMPEG,
mpg123 and now xaudio.
nod
I found smpeg not an optimal solution for pure MP3 playback as it has the
added MPEG1 ballast (large lib), did not support rate conversion on the fly
(a feature that I found too hard to add to the SMPEG source) and it had
problems when seeking in MP3 streams (decoding thread lost the stream
synchonization and stopped playback).
I tend to agree with you. The SMPEG 0.4.3 release is much improved, but
in general SMPEG seems too heavyweight for pure MP3 playback. We’re having
similar problems with OpenAL.
The lib code that is part of mpg123 is outdated and the main code mpg123
itself works well, but is GPLed which is not a good match with the LGPLed
SDL. Maybe SAM can get the author of mpg123 to relax the license for use in
SDL. Nevertheless, this would be a good solution for GPLed SDL projects.
I’ve already tried, and the author is firm on his desire not to use the LGPL
license.
xaudio (www.xaudio.com) is binary only, cross-platform and free but one has
to sign a disclaimer type license to be able to use it. It hast a SYNC
interface to get at the data and an ASYNC interface that does all the playing
by itselfg. I am using that right now as it seems the most stable and
compact.
Not having the source is often a problem when developing projects.
I think it might be worth it to actually create a seperate SDL_MP3 library
that will handle different input source libs (as listed above) and does MP3
to memory loading as well as rate conversion on the fly and provides an easy
to use SDL_Mixer interface.
That’s not a bad idea. The debian maintainer of SMPEG sent me a link
recently to what looks like a very good MP3 audio library. Perhaps
SDL_mixer and OpenAL can be modified to use it internally instead of
SMPEG: http://www.mars.org/home/rob/proj/mpeg/
I haven’t looked at it at all, but the web page is nice.
See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software