By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,797 Members | 1,848 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,797 IT Pros & Developers. It's quick & easy.

Playing MP3 File

P: 2
Hi..
Anybody know how to play a MP3 file in C. Is there any header files available for it ? Is it a complex task. What should i know in order to play a MP3 file ? Suggest me please....
Sep 29 '06 #1
Share this Question
Share on Google+
4 Replies


Banfa
Expert Mod 5K+
P: 8,916
It is a very complex task, you will either need to know most of the MPEG2 specification or find a libarray that does the decode for you.
Sep 29 '06 #2

P: 8
i dont think it is possible
Oct 5 '06 #3

P: 2
i dont think it is possible
Of course its possible Windows was written in C++.
Feb 27 '08 #4

P: 2
Hi..
Anybody know how to play a MP3 file in C. Is there any header files available for it ? Is it a complex task. What should i know in order to play a MP3 file ? Suggest me please....
The easiest way to go about doing that is to convert the mp3 file to a wav file to avoid having to import the AudioX library to your program which may require additional work. Here is the code I came up with that worked on a video game i developed.

#include <windows.h>
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")

char* declaredVariable = "C:\\nameOfSong.wav";

/*where declaredVariable can be name of song or whatever and C:\\ should lead to the directory where your audio file has been stored*/

int main()
{

sndPlaySound(declaredVariable, SND_ASYNC);

return 0;
}


It doesnt get much easier than this.
Feb 27 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.