在Windows 7手机播放音频文件 [英] Play an audio file in Windows 7 Phone
问题描述
我工作的基于Windows 7的应用程序开发Silverlight中。我一直没能找到一种方法在Windows中发挥的音频文件7手机编程。我一直在Google上搜寻它,因为过去几天,但我不能得到任何的解决方案。有一个在C#中的一类声音播放,但我想它在Windows 7手机无法使用。任何人都可以请帮助?
I am working on Windows 7 based application development in Silverlight. I have not been able to find a way to play a an audio file in windows 7 phone programmatically. I have been googling it since past few days but i could not get any solution of that. There is a class SoundPlayer in C# but i guess its not available in Windows 7 Phone. Can anyone please help?
推荐答案
使用XNA播放声音。您可以从Silverlight应用程序交叉引用XNA虽然,播放声音文件,则需要以下内容:
Use Xna to play the sound. You can cross reference Xna from a Silverlight app though, for playing a sound file, you need to the following:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio
// ...
Stream stream = TitleContainer.OpenStream("sounds/bonk.wav");
SoundEffect effect = SoundEffect.FromStream(stream);
FrameworkDispatcher.Update();
effect.Play();
所有最适合你的应用开发!
All the best for your application development!
这篇关于在Windows 7手机播放音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!