C/C++ sound engine that supports mp3's
Does anyone know where I can find a sound engine that supports mp3''s and that is for C/C++ and DirectX.??
You can play an mp3 in three lines of code in FMOD.
Alan
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
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
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
Use Directshow ! it''s so easy... you wrap it to a class and done. Here, some code :
/* Bullmax */
-------------
Reality has many forms : good and evil, black and white, yin and yang.
// 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.
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
- J
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement