|
|
相关代码如下:
void InitAudio()
{
CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC,IID_IGraphBuilder,(void**)&pGBuilder);
pGBuilder->QueryInterface(IID_IMediaControl,(void**)&pMControl);
pGBuilder->QueryInterface(IID_IMediaPosition,(void**)&pMPos);
CHAR strSoundPath[MAX_PATH];
WCHAR wstrSoundPath[MAX_PATH];
GetCurrentDirectory(MAX_PATH,strSoundPath);
strcat(strSoundPath,"time.mp3");
MultiByteToWideChar(CP_ACP,0,strSoundPath,-1,wstrSoundPath,MAX_PATH);
pGBuilder->RenderFile(wstrSoundPath,NULL);
}
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
InitAudio();
for(;;)
{
pMPos->put_CurrentPosition(0);
pMControl->Run();
}
}
编译可以正常通过,文件也在,但却没有声音,是怎么回事呢? |
|