C/C++ sound engine that supports mp3's

Started by
8 comments, last by computer_guy 21 years, 2 months ago
Does anyone know where I can find a sound engine that supports mp3''s and that is for C/C++ and DirectX.??
I'll Be Back
Advertisement
I really like FMOD.

Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
you can play mp3s using DirectShow in a few lines of code
You can play an mp3 in three lines of code in FMOD.


  FSOUND_Init(44100, 32, 0);FSOUND_STREAM * stream = FSOUND_Stream_OpenFile("song.mp3", FSOUND_16BITS | FSOUND_STEREO, 0)FSOUND_Stream_Play(FSOUND_FREE, stream);  


Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
thanks for the replys i''ll try Fmod,

Do you realy only have to write three lines of code?
I'll Be Back
thats nice!!!

3 lines and some nifty back ground music...would be easy to expand on that!
I would *really* suggest error checking (and probably closing the stream when you''re finished with it...).

I only started looking at FMOD two days ago and I have already got a full sound effects and background music system running. Its fast too, on my 1.7ghz p4 it runs at about .075% (three quarters of one percent) processor usage.

Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
Use Directshow ! it''s so easy... you wrap it to a class and done. Here, some code :


  // INITIALIZATION //IGraphBuilder*	m_pGraph;IMediaControl*	m_pControl;CoInitialize( NULL );CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (VOID**) &m_pGraph ) ));m_pGraph->QueryInterface( IID_IMediaControl, (VOID**) &m_pControl ) ));// LOADING //WCHAR	strFilename[256];MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, "tune.mp3, -1, strFilename, MAX_PATH );m_pGraph->RenderFile( strFilename, NULL ) ));// DURING GAME /////////////////////////////////////////////////////////////// Play //m_pControl->Run();// or Stop //m_pControl->Stop();///////////////////////////////////////////////////////////// SHUTDOWN //if (m_pControl){	m_pControl->Stop();	m_pControl->Release();	m_pControl = NULL;}if (m_pGraph){	//m_pGraph->Release();	m_pGraph = NULL;}	CoUninitialize();  



/* Bullmax */
-------------
Reality has many forms : good and evil, black and white, yin and yang.
/* Bullmax */-------------Reality has many forms : good and evil, black and white, yin and yang.
Beware of FMOD''s licensing issues. You must give your game awayf for free or else pay $100 for a license to use it if you intend to sell your game.

- J
Jeff OutlawPresidentDigitalOutlawhttp://www.digitaloutlaw.com
Not to mention the licensing issues surrounding MP3 itself. Using DirectShow is equivalent to allowing Microsoft to pick up the tab; that is, if you had any intention of taking the license seriously at all. Another alternative is Ogg Vorbis, which lacks licensing of any kind and is rumored to have better sound quality overall.
________________________________________________"Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

This topic is closed to new replies.

Advertisement