本文整理汇总了C#中AudioManager.ToDisposeAudioAsset方法的典型用法代码示例。如果您正苦于以下问题:C# AudioManager.ToDisposeAudioAsset方法的具体用法?C# AudioManager.ToDisposeAudioAsset怎么用?C# AudioManager.ToDisposeAudioAsset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioManager
的用法示例。
在下文中一共展示了AudioManager.ToDisposeAudioAsset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromStream
/// <summary>
/// Initializes a new wave bank from the provided stream.
/// </summary>
/// <param name="audioManager">The associated audio manager.</param>
/// <param name="stream">The stream containing wave bank data.</param>
/// <returns>The wave bank initialized from provided stream.</returns>
public static WaveBank FromStream(AudioManager audioManager, Stream stream)
{
return audioManager.ToDisposeAudioAsset(new WaveBank(audioManager, stream));
}
示例2: FromStream
/// <summary>
/// Creates a new instance of the <see cref="SoundEffect"/> class from the spefified data stream.
/// </summary>
/// <param name="audioManager">The audio manager associated to the created instance.</param>
/// <param name="stream">The stream containing the data from which to create the effect.</param>
/// <param name="name">The name of the effect (optional).</param>
/// <returns>The created effect.</returns>
public static SoundEffect FromStream(AudioManager audioManager, Stream stream, string name = null)
{
if (audioManager == null)
throw new ArgumentNullException("audioManager");
if (stream == null)
throw new ArgumentNullException("stream");
var sound = new SoundStream(stream);
var format = sound.Format;
var decodedPacketsInfo = sound.DecodedPacketsInfo;
var buffer = sound.ToDataStream();
sound.Dispose();
return audioManager.ToDisposeAudioAsset(new SoundEffect(audioManager, name, format, buffer, decodedPacketsInfo));
}