Sign in to follow this  
Varchild

Stopping an MP3 file in midstream

Recommended Posts

I have an MP3 file that is running but how do I stop the MP3 file in midstream so that I can play a different MP3 file? I am using this code to run the MP3 "IMediaControl *pMediaControl; IMediaEvent *pEvent; pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl); pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent); pGraph->RenderFile(L"C:\\Song1.mp3", NULL); pMediaControl->Run();" Now I would like the gamer to press a button on the keyboard and stop the MP3 from playing without ending my application. If I type in this code: "pMediaControl->Stop();" My entire application closes:-( If I type in this code: "pMediaCotnrol->StopWhenReady();" My application will stop the song but the application freezes and quits.:-( I am unable to run my next song file because the application is quitting all of the time.:-( Thanks for any help you can provide.

Share this post


Link to post
Share on other sites
Well, Stop() is the correct function to call. I use it now in my DS wrapper without a problem. The only thing I can think of is you're doing something incorrect that we cant see. Which would mean your program isn't just closing, its crashing. Run it in debug a few times and see whats going on there. If you need to drop some code and let us take a looksee.

regards,
Tang

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this