本文整理汇总了C#中Microsoft.Xna.Framework.Audio.SoundEffect.PlatformLoadAudioStream方法的典型用法代码示例。如果您正苦于以下问题:C# SoundEffect.PlatformLoadAudioStream方法的具体用法?C# SoundEffect.PlatformLoadAudioStream怎么用?C# SoundEffect.PlatformLoadAudioStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Audio.SoundEffect
的用法示例。
在下文中一共展示了SoundEffect.PlatformLoadAudioStream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromStream
/// <summary>
/// Creates a SoundEffect object based on the specified data stream.
/// </summary>
/// <param name="s">Stream object containing PCM wave data.</param>
/// <returns>A new SoundEffect object.</returns>
/// <remarks>The Stream object must point to the head of a valid PCM wave file. Also, this wave file must be in the RIFF bitstream format.</remarks>
public static SoundEffect FromStream(Stream s)
{
if (s == null)
throw new ArgumentNullException();
// Notes from the docs:
/*The Stream object must point to the head of a valid PCM wave file. Also, this wave file must be in the RIFF bitstream format.
The audio format has the following restrictions:
Must be a PCM wave file
Can only be mono or stereo
Must be 8 or 16 bit
Sample rate must be between 8,000 Hz and 48,000 Hz*/
var sfx = new SoundEffect();
sfx.PlatformLoadAudioStream(s);
return sfx;
}