How to play MP3 files in C?
Using FMOD (cross platform), this should be as simple as this:
#include <conio.h>
#include "inc/fmod.h"
FSOUND_SAMPLE* handle;
int main ()
{
// init FMOD sound system
FSOUND_Init (44100, 32, 0);
// load and play mp3
handle=FSOUND_Sample_Load (0,"my.mp3",0, 0, 0);
FSOUND_PlaySound (0,handle);
// wait until the users hits a key to end the app
while (!_kbhit())
{
}
// clean up
FSOUND_Sample_Free (handle);
FSOUND_Close();
}
As a side note, I'd suggest you using C++ over C.
The BASS DLL is really easy to use and will probably do what you need. It is only free for non-commercial use though.
If you need more control, you will need a codec (I prefer libMad) and some sound output API like DirectSound on Windows or ALSA or Linux (or whatever Linux guys use for sound this week)
I don't know if it is "the easiest way", but you could have a look at SDL (along with SDL_sound).
If you are on Windows or OSX, I recommend BASS (http://www.un4seen.com/bass.html)
You can download the library and look at code sample to get started. The "contest" example in C directory is a good start point.