How to play dynamic sounds in XNA?

前端 未结 3 1903
庸人自扰
庸人自扰 2021-01-20 23:02

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

I looked into this some time ago when XNA was first released. At that time it was only possible to pl

相关标签:
3条回答
  • 2021-01-20 23:38

    Depends how dynamic you want to get. I know that XACT will let you change pitch and such, which, when combined with using cues in a programmatic fashion, can give some nice results.

    If you want to generate your own waveform, you're out of luck. There's always the option of dropping below the framework and doing it yourself.

    0 讨论(0)
  • 2021-01-20 23:39

    Yes.

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

    • 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.

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

    0 讨论(0)
  • 2021-01-20 23:44

    I think you can do this in XNA with DirectSound. Here's a link with code that seems to do what you want:

    http://forums.create.msdn.com/forums/t/40361.aspx

    0 讨论(0)
提交回复
热议问题