同时播放声音在C# [英] Play simultaneously sound in C#

查看:203
本文介绍了同时播放声音在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我想在Windows应用程序(C#编写),声音(WAV格式)扮演的背景声音和鼠标控制打小wav声音文件,
和当点击按钮,停止背景声音和...。

感谢您的指导。

Hello
I want in the win Application (written in C#), the sound (Wav Format) play as Background Sound, and mouse over Control play small wav sound File, and when Click on Button, Stop Background Sound and ... .
Thanks For your guidance.

推荐答案

您可以使用Windows Media Player:

you can use Windows Media Player:

引用C:\Windows\System32\wmp.dll在你的项目

reference C:\Windows\System32\wmp.dll in your project

推出wav文件:

WMPLib.WindowsMediaPlayer wmp = new WMPLib.WindowsMediaPlayerClass();
wmp.URL = "[wav file path]";

//then control the player with :

wmp.controls.play(), stop(), ...

第二wav文件,做同样的事情与WindowsMediaPlayer中的另一个实例等等...

for the second wav file, do the same thing with another instance of WindowsMediaPlayer etc...

您还可以使用托管DirectX:托管DirectX教程第2部分

you can also use Managed DirectX : Managed DirectX Tutorial Part 2

这篇关于同时播放声音在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆