Jump to content
  • Advertisement


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



This topic is 6327 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

Where can I find source code and possibly documentation on the mp3 format so that I might write a program to play them. Are mp3''s used in games a lot now? Just thought I''d ask that...

Share this post

Link to post
Share on other sites
yes, mp3's are pretty widely used in games today. If you think you're a pro, then you can find the format at Wotsit.org. I would recomend using DirectShow to load it. here's all code to play an mp3 with directshow, (this doesn't include other features, just a basic sample)
#include <dshow.h>

void main(void)
IGraphBuilder *pGraph;
IMediaControl *pMediaControl;
IMediaEvent *pEvent;

// Create the filter graph manager and query for interfaces.

IID_IGraphBuilder, (void **)&pGraph);
pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);

// Build the graph. IMPORTANT: Change string to a file on your system.

pGraph->RenderFile(L"C:\\Hello_World.avi", NULL);

// Run the graph.


// Wait for completion.

long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode);

// Clean up.


that's strait from msdn online. some people use fmod, gaudio, bass, or similar libraries. they are free for non-comercial use.

Polarisoft Home Page

Edited by - Julio on July 18, 2001 1:28:52 PM

Share this post

Link to post
Share on other sites
IN your code you have "HelloWorld.avi" would you just replace that with an mp3 file to play a mp3?

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Lo Man,

This is prolly not what you want but just in case.......

I''m making an MP3 player for a project in college and I''ve found quite a bit of stuff on ''em, but only for Visual Basic. Making a player in Visual Basic is simple if you use the media player OCX.

Here are a few links which might help:

www.vbweb.co.uk (Search for MP3''s).

Heres one for C/C++ which I''ve not got around to trying:


It''s not a player, it''s and API.

For things like graphic equalisers, visual equalisers, etc. Just search on places like www.planetsourcecode.com and www.programmersheaven.com.



Share this post

Link to post
Share on other sites
Hello, i am using DirectSound. is Direct Show better to play sounds? Should i switch over to direct show?

Share this post

Link to post
Share on other sites
yes temo, you just replace the file names. DirectSound is better for sound effects, mainly wave files. directshow was intended for video stuff, but works well with mp3''s and many sound type. I would recomending learning both.

Polarisoft Home Page

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!