Free Educational Resource Center for teachers and students. Includes Interviews,
Sourcecode, Free Software, Research Papers, Articles, Tutorials and much more..
R E S E A R C H A C T I V I T Y . C O M
Our Fellow Research Center for Ph.D Schollars
|Home About Submit & Earn||Archives: C And C + + Programming » Dev Packages » Interviews » Php Mysql Programming » Windows Programming|
Windows Programming > play mp3, wav, wmv, mpg, avi etc files in win32 api program
Play au, snd, mp3, wav, wmv, asf, wma, mpg, midi, rmi, vob, dat files in Win32 API Program
Playing any video or audio such as au, snd, mp3, wav, wmv, asf, wma, mpg, midi, rmi, vob, or dat files in win32 api program is very simple, when you come to see the code you will come to believe, that how easy it is using MCI.
What you do basically when playing an audio file is:
1. open the audio file
2. play / pause / resume / stop
3. close the audio file
All of above mentioned actions are performed by sending properly formated string to MCI device, by using function mciSendString.
a) A very simple example would be as below, which will play song.mp3 from current folder your program executable is in:
Where myFile is a special textual word we have used to represent the auio file, so that we do not need to repeat the file name again in every action, becuase we may have long filename alognwith folder path such as
C:\Documents and Settings\User1\Desktop\Sounds\song.mp3
Other than that, you can also format many more command to send to MCI device.
a) Playing from specific position:
b) Stop playing and reset MCI device for current file:
c) Pause the play:
d) Resume the paused audio:
e) Repeated play
More help on command string can be viewed here:
I am sure this is useful to you. You can use this procedure to play any windows supported audio / midi / video formats.
Enjoy making your own mp3 players ;).