C# Microsoft.DirectX.DirectShow cause crash on load
I am using Microsoft.DirectX.DirectShow to play 2 or more audio files at the same time.
I tried it in my computer with directx11 and it works fin开发者_JAVA技巧e. but I also tried it in directx 10 and 9 and It crashed onload..
any Idea why and how to fix it? I can accept other ways to play 2 or more audio files at the same time (not only WAV)
Thanks
You can use WMPLib > Windows Media Player Library
add Windows Media Player reference (References > Add Reference > COM)
and use this code:
using WMPLib;
WindowsMediaPlayer wmp = new WindowsMediaPlayer();
wmp.URL = url; //filepath
wmp.controls.play();
wmp.settings.volume = volume; //(int between 0 to 50)
//get duration as double
WindowsMediaPlayerClass wmpi = new WindowsMediaPlayerClass();
IWMPMedia wmpinfo = wmpi.newMedia(url);
int duration = wmpinfo.duration
//end
wmp.controls.stop();
精彩评论