Archived

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

johnnyBravo

directshow, playing mp3, IBasicAudio not intialising

Recommended Posts

hi, im playing mp3s and midis using directshow. Ive got the playing, stopping, set position, load, and initialising stuff for all that working. But when i try to initialise IBasicAudio, it just crashes. heres my code:
IGraphBuilder *g_pGraphBuilder;
IMediaControl *g_pMediaControl;
IMediaSeeking *g_pMediaSeeking;
IBasicAudio   *g_pBasicAudio;

void create()
{
	if(SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
		if(SUCCEEDED(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, reinterpret_cast<void **>(&g_pGraphBuilder))))
		{
			g_pGraphBuilder->QueryInterface(IID_IMediaControl,
				reinterpret_cast<void **>(&g_pMediaControl));
			
			g_pGraphBuilder->QueryInterface(IID_IMediaSeeking,
				reinterpret_cast<void **>(&g_pMediaSeeking));
			
			g_pGraphBuilder->QueryInterface(IID_IBasicAudio,
				reinterpret_cast<void **>(&g_pBasicAudio));
		}
}

the g_pGraphBuilder->QueryInterface(IID_IBasicAudio, reinterpret_cast(&g_pBasicAudio)); line is what is not working. I don''t see why as i have copied it basically directly from the audiobox sample, i just changed the name a little to fit in with my current naming system. Is there anything else i have to do, to get it to initialise? thanks,

Share this post


Link to post
Share on other sites