How to play a .mp3 file in my program?

Started by
8 comments, last by BauerGL 22 years, 4 months ago
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)

@mikaelbauer

Super Sportmatchen - A retro multiplayer competitive sports game project!

Advertisement
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.
haven''t tried fmod but bass is pretty simple imo. add like 3-4 lines then you''ve got a mp3 playing.
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)
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!
Okay, thanks everyone.

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

Thanks again, Bauer.

@mikaelbauer

Super Sportmatchen - A retro multiplayer competitive sports game project!

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)
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.
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
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)
On my site, I''ve a example for using FMOD 3.33

It can reads MP3, WAV

========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
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

This topic is closed to new replies.

Advertisement