Archived

This topic is now archived and is closed to further replies.

BauerGL

How to play a .mp3 file in my program?

Recommended Posts

Hi, this might be the wrong forum, but since some of you probably have done this before I''m going to ask here anyway What should I do to be able to play .mp3 files in my program? I do not want to use DX... Someone said that there should be an ActiveX plugin that can do this, but I haven''t found it. So should I try with FMOD or such? All help is appreciated. Thanks, Bauer. // No code = No errors (at least in non Microsoft compilers)

Share this post


Link to post
Share on other sites
if you dont want to use directx, then dont use activex since you will be limiting yourself to windows anyway. go for fmod or bass.

Share this post


Link to post
Share on other sites
Ok you''ve got several options. If you''re going to use an existing audio library I recommend FMOD - apparently it''s the fastest audio library there is and the license agreement is very reasonable. For developers not wishing to sell their game/demo the library is free, and if you wish to use the library to commercial ends you only have to pay a single lump sum then you get free updates! It''s a good library too - probably similar to BASS in that it only requires a few lines of code to playback an MP3.

Your next option is to use the DirectMedia component of DX. A -lot- of programs use this to my knowledge, though I have no real information for you on this!

Another option is to use Windows''s built in MP3 player using the Win32 API. I believe you can play an MP3 in a similar fashion to how you play a MIDI file... Again - little information here!

The only other thing I can think of is to write your own MP3 player. *g* If you need some code check out mpg123 on sourceforge.net. It''s an open source MP3 player and it''s pretty damn fast! Can play back an MP3 comfortably on my P133 under Linux whilst I do other stuff at the same time! Or try mpg321... Although these are linux progs I think they have win32 ports... Well, if you''ve ever checked out the Jet3D engine, it had some MP3 support in one of the releases and that was done using mpg123!

Hope this helps!

Share this post


Link to post
Share on other sites
Use mciSendString(..)

in two commands you can load anything windows media player can
and its much quicker than fmod or any other library (does not require Direct X)

i think loading mp3 goes as

mciSendString(open C:\mp3\one.mp3 alias music)
mciSendString(play music)

mciSendString(stop music)

Share this post


Link to post
Share on other sites
the mp3 audio must have the extension of mpa or a few others due to how mci works (it goes by extension). mp3 is not the true extension since its really mpeg1 layer 3 and should be mpa like other mpeg audio.

for testing use mplayer (not mplayer2 or mediapleyr7, just run mplayer from command line) this is the activemovie player and the old school way for doing media things in windows. i suggest using directshow since its much better orgranized and more up to date.

Share this post


Link to post
Share on other sites
quote:
Original post by BauerGL
Okay, thanks everyone.

Any advice on where I can find the BASS and FMOD APIs?

Thanks again, Bauer.



http://www.un4seen.com/music/

http://www.fmod.org

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
There is a fully operational
MPEG audio I,II,II encoder/decoder
here:

http://www.programmersheaven.com/zone12/cat164/15984.htm

But I''m not sure if it can be legally
used in comercial applications
If anybody knows, please tell me

Share this post


Link to post
Share on other sites