Jump to content
  • Advertisement
Sign in to follow this  
_Phalanx_

Playing Mp3?

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

Advertisement
It is possible to use MP3 music in your game's if you use one of the several audio API's out there which supports the format but the licensing for MP3's is the major downfall - check out this page for the full details.

For a patent free format of equal (and somtimes better quality) try OGG Vorbis

Share this post


Link to post
Share on other sites
I'm not a lawyer, but I think that the mp3 licensing fees only apply if you actually write your own player for them. If you were to use something that could already play them, like DirectSound (I think DS can play these files) or some other audio library, they you don't have to pay the fee because the maker of the library already payed.

Share this post


Link to post
Share on other sites
I believe if your program has a distribution of > 2500 copies, then you have to pay mp3 licensing fees. This is something I heard, I dont have any proof if it is true or not.

For outputing sound (ogg, wav, mp3) try:

http://audiere.sourceforge.net

This is VERY simple to use and it is free.

Share this post


Link to post
Share on other sites
I believe if your program has a distribution of > 2500 copies, then you have to pay mp3 licensing fees. This is something I heard, I dont have any proof if it is true or not.

For outputing sound (ogg, wav, mp3) try:

http://audiere.sourceforge.net

This is VERY simple to use and it is free.

Share this post


Link to post
Share on other sites
DirectSound cannot play MP3s, but DirectShow can, and it's very easy to do it, like 10 lines of code :)
I also heard that if you use DirectShow you don't have to pay fees, because Microsoft is already doing it for you

Share this post


Link to post
Share on other sites
My dshow music class. it basically loasd the mp3 or whatever then u play it using the:
.getMediaControl()->Run();


#define _WIN32_DCOM
#include <dshow.h>

class ADX_API Music {
private:
IGraphBuilder *g_pGraphBuilder;
IMediaControl *g_pMediaControl;
IMediaSeeking *g_pMediaSeeking;
IBasicAudio *g_pBasicAudio;
public:
Music();
~Music();
bool create();
bool load(const char filename[]);
IMediaControl * getMediaControl(){return g_pMediaControl;}
IMediaSeeking * getMediaSeeking(){return g_pMediaSeeking;}
IBasicAudio * getBasicAudio(){return g_pBasicAudio;}
};

Music::Music()
{
g_pMediaControl = NULL;
g_pMediaSeeking = NULL;
g_pBasicAudio = NULL;
g_pGraphBuilder = NULL;
}
Music::~Music()
{
if(g_pMediaControl)
{
g_pMediaControl->Release();
g_pMediaControl = NULL;
}
if(g_pMediaSeeking)
{
g_pMediaSeeking->Release();
g_pMediaSeeking = NULL;
}
if(g_pBasicAudio)
{
g_pBasicAudio->Release();
g_pBasicAudio = NULL;
}
if(g_pGraphBuilder)
{
g_pGraphBuilder->Release();
g_pGraphBuilder = NULL;
}
}
bool Music::create()
{
if(FAILED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
return false;

if(FAILED(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, reinterpret_cast<void **>(&g_pGraphBuilder))))
return false;

if(FAILED(g_pGraphBuilder->QueryInterface(IID_IMediaControl,reinterpret_cast<void **>(&g_pMediaControl))))
return false;

if(FAILED(g_pGraphBuilder->QueryInterface(IID_IMediaSeeking,reinterpret_cast<void **>(&g_pMediaSeeking))))
return false;

if(FAILED(g_pGraphBuilder->QueryInterface(IID_IBasicAudio,reinterpret_cast<void **>(&g_pBasicAudio))))
return false;

return true;
}
bool Music::load(const char filename[])
{
WCHAR wFilename[MAX_PATH];
MultiByteToWideChar(CP_ACP,0,filename,-1,wFilename,MAX_PATH);
LPCWSTR lwFilename= wFilename;
if(FAILED(g_pGraphBuilder->RenderFile(lwFilename,NULL)))
return false;

return true;
}



Share this post


Link to post
Share on other sites
Sign in to follow this  

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