Jump to content
  • Advertisement


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


playing mp3's

This topic is 5434 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone know how to play mp3''s using Direct X or Comns (? I''m not sure if this is the correct alternative), dont bother suggesting using Fmod and Midas as then you can''t sell anything, I looking for advice on how to write an mp3 player without 3rd party support and preferably only requires Direct X 7 not Direct X 8. Thanks in advance Kiel. ___________________________________ Home of my screensavers: http://www.lancs.ac.uk/ug/gilleade ___________________________________

Share this post

Link to post
Share on other sites
well using fmod (don''t know about midas) you can sell stuff, you just have to pay 200$ for shareware....:/ (and 1200$ for commercial) But fmod is a great sytem.
About your question, you can use DirectShow to play .mp3 files. I don''t know about dx7, but I have got a dx8 app that does just that. If you compare dx7 and dx8 sdk you might come to a dx7 solution, assuming it''s possible. So please check that with sdk... on the other hand, why bothering to go with dx7 if dx8 does it perfectly fine? 99.9% of gamers have got dx8 already installed anyway... and other ppl, most probably they will have to install one, so it''s not a big deal if they install dx8 instead dx7
ohh and about the mp3 player, it''s just a lil app using win32 to show a toolbar. My code is awfull, but I hope it helps. Btw DX doesn''t play mp3 with extreme performace. Comparing to winamp it does use more cpu/memory resources.
for the program download try this link
then go down to "mp3 player uzywajacy DirectShow8" and press on the src+exe image to start downloading. It uses VC++6.0 to compile. It''s pretty much the code from dx8sdk.
Hope it helps
PS. if you have some problems contact me via email. Sorry, that my page is in polish language. You can try my english page too (link below), but it''s outdated much more then polish version and i''m not sure if the mp3 player is there.
Have fun!

With best regards,
Mirek Czerwiñski

Share this post

Link to post
Share on other sites
Okay I''m not sure if this is the least CPU-intensive method, but it''s almost universal (among Win32 platforms) and doesn''t require extra files besides the mp3 file.

#include "mmsystem.h"

//When your program starts:

mciSendString("open song.mp3 type mpegvideo alias music", 0, 0, 0);
//When you want the song to start

mciSendString("play music from 0", 0, 0, 0);
//When you want it to stop

mciSendString("stop music", 0, 0, 0);
//When your program closes

mciSendString("close music", 0, 0, 0);

This uses Microsoft''s MP3 technology which comes with Windows. Since you don''t redistribute it, you won''t need licensing or anything.

Share this post

Link to post
Share on other sites
Something to watch out for here...
1) Microsoft''s MP3 technology hasn''t always been available and you may find you have to force older Windows systems to install the latest Windows Media setup. You''ll want to test that before selling.

2) I have no idea how it compares to other systems - it appears to me just under general usage WiMP sucks up multitudes more CPU than WinAMP, and more than Bass and FMod as well. That''s just anecdotal though and it may be more to do with WiMP''s UI.

Brett Porter
PortaLib3D : A portable 3D game/demo libary for OpenGL
Community Service Announcement: Read How to ask questions the smart way before posting!

Share this post

Link to post
Share on other sites
Does the above code still apply???

I copy pasted it into my program just to try it out, and I got the following link error:

Main.obj : error LNK2001: unresolved external symbol __imp__mciSendStringA@16
Debug/LandsCastles.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

I know nothing about link errors and haven''t the slightest clue what has gone wrong or why...!

PS my DX version is 8.1

What''s the problem? I don''t got a problem, I got fuckin'' problems!

-Tim Roth, Four Rooms

Share this post

Link to post
Share on other sites
Ok, I don''t get the linker error when I link to the winmm.lib

that''s nice... but no sound... it is as silent as the grave... before you ask, i have replaced the "song.mp3" with a mp3 file on my hdd and one which I put in the same directory as the executable.

Share this post

Link to post
Share on other sites
i got an mp3 player to work early last year at school using the mmsystem thing... go figure i never brought it home tho... can you post what code you have so far norleaf?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!