Jump to content
  • Advertisement

Archived

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

MP3

This topic is 6149 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
Advertisement
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;
CoInitialize(NULL);

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

CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
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.

pMediaControl->Run();

// Wait for completion.

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

// Clean up.

pMediaControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize();
}

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

HHSDrum@yahoo.com
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:

http://home12.inet.tele.dk/mkaratha/
http://www.elementkjournals.com/ivb/0011/ivb00b1.htm
www.vbweb.co.uk (Search for MP3''s).

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

www.xaudio.com

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.

Cya

CoiN

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

  • 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!