Stopping an MP3 file in midstream
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.
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
regards,
Tang
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement