如何发挥动态声音在XNA? [英] How to play dynamic sounds in XNA?

查看:167
本文介绍了如何发挥动态声音在XNA?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能dynanmically生成与XNA C#code的声音?

Is it possible to dynanmically generate sounds with XNA C# code?

我看着这一段时间前,当新华社首次发布。当时它是唯一可能的回放包含在编译code声音资源。

I looked into this some time ago when XNA was first released. At that time it was only possible to playback sound resources included in the compiled code.

是否有过因为XNA 1.0添加任何变化或新的功能,将允许XNA应用程序生成和动态播放音频?

Have there been any changes or new features added since XNA 1.0 that would allow an XNA application to generate and playback audio on the fly?

推荐答案

是的。

XNA 4.0增加了对动态音频支持,使您可以:

XNA 4.0 added support for dynamic audio that allows you to:

  • 创建一个常规不变的声音 使用<一个从原始缓冲作用href="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.audio.soundeffect.fromstream%28XNAGameStudio.40%29.aspx">SoundEffect.FromStream方法
  • 创建一个 <一href="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.audio.dynamicsoundeffectinstance.aspx">DynamicSoundEffectInstance对象,然后修改这个新的音频数据 串流音效对象 动态。
  • Create a regular immutable sound effect from a raw buffer using the SoundEffect.FromStream method.
  • Create a DynamicSoundEffectInstance object then modify the audio data of this new streaming sound effect object dynamically.

了解更多的博客文章<一个href="http://blogs.msdn.com/b/ashtat/archive/2010/09/08/what-s-dynamic-about-this-soundeffectinstance-part-1.aspx">What’s 动态这个SoundEffectInstance?,并在AppHub文章动态音频

Read more in the blog entry What’s "Dynamic" about this SoundEffectInstance? and in the AppHub article Dynamic Audio.

这篇关于如何发挥动态声音在XNA?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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