开发者

C# Microsoft.DirectX.DirectShow cause crash on load

开发者 https://www.devze.com 2023-02-10 15:00 出处:网络
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.

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();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号