Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Play MP3 in C with WinAPI?

226 views
Skip to first unread message

Xunshirine Xun

unread,
Apr 30, 2013, 6:22:06 PM4/30/13
to
How can I play MP3 with WinAPI in C? I am new to C and WinAPI. Could you provide an example code listing?

R.Wieser

unread,
May 1, 2013, 5:30:06 AM5/1/13
to
Xunshirine Xun,

If-and-when you have C specific questions I would suggest to post them in a
C related newsgroup. It ofcourse depends on the version of C you are using,
but if its VC++ I would suggest something like
"microsoft.public.vc.language" or "microsoft.public.vc.mfc"


As to how to play MP3 sounds/music ? That can be done using the
"mciSendString" function as supplied by the "winmm" DLL. I found several
examples for it using google.

Regards,
Rudy Wieser


-- Origional message:
Xunshirine Xun <xunsh...@gmail.com> schreef in berichtnieuws
eb97db5a-e9ef-442b...@googlegroups.com...

Derell Licht

unread,
Jun 20, 2013, 12:58:38 PM6/20/13
to
On Tuesday, April 30, 2013 3:22:06 PM UTC-7, Xunshirine Xun wrote:
> How can I play MP3 with WinAPI in C? I am new to C and WinAPI. Could you provide an example code listing?

I have used PlaySound() in the past to play .WAV files, I don't know if it supports .MP3 as well or not. The syntax I used was:

PlaySound(wave_name, NULL, SND_FILENAME) ;

(BTW, Rudy Wieser, I think this is an appropriate place to ask WinAPI questions; in fact, this is where I post *my* WinAPI questions. I use the MinGW toolchain to build my apps, and I've found that MinGW groups are not very efficient places to ask WinAPI questions!! 8-{) )

R.Wieser

unread,
Jun 20, 2013, 1:52:32 PM6/20/13
to
Helo Derell,

> How can I play MP3 with WinAPI in C?

I myself did that by going the "mciSendString" way. It accepts a several
kinds of sound formats.

> Could you provide an example code listing?

As I did not write it in C I'm not sure how much my code would help you.
:-\

The first thing I did was to send the following string to load the sound:

'open "yoursoundfile.mp3" type mpegvideo alias Sound1'

After that the following string starts it

'play Sound1'

> BTW, Rudy Wieser, I think this is an appropriate place to
> ask WinAPI questions; in fact, this is where I post *my*
> WinAPI questions.

Same here. There does not seem to exist a better newsgroup for it anymore.

Regards,
Rudy Wieser


-- Origional message:
Derell Licht <derell...@gmail.com> schreef in berichtnieuws
459770a9-1586-48a1...@googlegroups.com...
0 new messages