使用C#播放WAV文件 [英] Play wav file using c#
本文介绍了使用C#播放WAV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
尝试在 c#智能设备应用程序中播放wav文件时卡住了.
例外是找不到路径"\ C:\ Users \ Desktop \ test.wav"的一部分."
我尝试将wav文件复制到模拟器的我的文档\我的音乐"中,并更改了
soundLocation根据该路径,但不起作用.而且我也将wav文件复制到myProject的调试文件夹中.没有更改.
请帮助.
我的代码是
Hi all,
I got stuck when I tried to play a wav file in my c# smart device application.
The exception is "Could not find a part of the path ''\C:\Users\Desktop\test.wav''."
I''ve tried with copying the wav file to emulator''s "my Document\my music" and changed
soundLocation according to that path,but doesn''t work. And also I copied wav file into myProject''s debug folder..no change.
Plz help.
my code is
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"C:\Users\Desktop\test.wav";
player.Play();
}
谢谢.
推荐答案
使用此地址手动...
"C:\\ Users \\" + Environment.UserName +"\\ Desktop \\ test.wav"
use this address man...
"C:\\Users\\"+Environment.UserName+"\\Desktop\\test.wav"
^ ]
http://www.crowsprogramming.com/archives/58 [
http://www.daniweb.com/software-development/csharp/code/216393/play-a-wave-file-c[^]
http://www.crowsprogramming.com/archives/58[^]
首先,感谢大家的回应.
有人看到异常开始处有一个" \ "符号.这是什么意思?
First of all,Thank you all for response..
have somebody of you saw that there is a " \ " sign at the beginning of the exception.. what does that mean??
这篇关于使用C#播放WAV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文