Advertisement Jump to content


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


Loading multiple mp3's

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

I''ve been trying to use direct show to load several mp3''s. I''ve gotten this to work, but it''s a very inefficient method, which is by re-initializing direct show every time a new mp3 is loaded. Is there a different way of loading several files? Im using m_pGraphBuilder->RenderFile(SomeFile,NULL); to load and play files, but the problem is that when I want to play a different file, the first and second songs end up being mixed together. I''m not using anything special, here''s my code: This is in my constructor: CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&m_pGraph); m_pGraph->QueryInterface(IID_IMediaControl, (void **)&m_pMediaControl); m_pGraph->QueryInterface(IID_IMediaPosition, (void**)&m_pMediaPosition); m_pMediaControl->QueryInterface(IID_IBasicAudio, (void **)&m_pAudioControl); m_pGraph->QueryInterface(IID_IMediaEventEx, (void**)&m_pEvent); m_pEvent->SetNotifyWindow((OAHWND)g_hWndMain,WM_P_GRAPHNOTIFY,0); And then in a method named LoadFile: WCHAR Tmp[100]; MultiByteToWideChar(CP_ACP, 0, Path, -1, Tmp,100); m_pGraph->RenderFile(Tmp,NULL); m_Playing = false; anyway, I think getting this to work the way I want involves using the Disconnect() method, but it requires a pin as a parameter, and I don''t really know what the pin that I am using as all I am doing is using RenderFile()

Share this post

Link to post
Share on other sites
You can make a second (and third, fourth...) graph object and load each mp3 into a different graph.

Also, someone said that DirectMusic did mp3''s, so that may be an easier way to play them.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!