2021-07-11 22:59:29 -05:00
|
|
|
// Decompiled with JetBrains decompiler
|
|
|
|
|
// Type: Microsoft.Iris.Render.Extensions.SoundLoader
|
|
|
|
|
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
|
|
|
|
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
|
|
|
|
|
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
|
|
|
|
|
|
|
|
|
|
using Microsoft.Iris.Render.Common;
|
|
|
|
|
using Microsoft.Iris.Render.Internal;
|
|
|
|
|
using Microsoft.Iris.Render.Protocol;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.Iris.Render.Extensions
|
|
|
|
|
{
|
2021-07-11 23:04:40 -05:00
|
|
|
public static class SoundLoader
|
2021-07-11 22:59:29 -05:00
|
|
|
{
|
2021-07-11 23:04:40 -05:00
|
|
|
public static void FromResource(
|
|
|
|
|
string moduleName,
|
|
|
|
|
string resourceId,
|
|
|
|
|
out ExtensionsApi.HSpSound soundDataHandle,
|
|
|
|
|
out ExtensionsApi.SoundInformation soundDataInfo)
|
|
|
|
|
{
|
|
|
|
|
Win32Api.HINSTANCE hInstance = ModuleManager.Instance.LoadModule(moduleName);
|
|
|
|
|
Debug2.Validate(hInstance != Win32Api.HINSTANCE.NULL, typeof(ArgumentException), nameof(moduleName));
|
2021-10-04 14:17:40 -05:00
|
|
|
byte[] resourceData;
|
2021-07-11 23:04:40 -05:00
|
|
|
int resourceSize;
|
|
|
|
|
ModuleManager.Instance.LoadResource(hInstance, resourceId, out resourceData, out resourceSize);
|
2021-07-11 23:07:04 -05:00
|
|
|
FromMemory(resourceData, resourceSize, out soundDataHandle, out soundDataInfo);
|
2021-07-11 23:04:40 -05:00
|
|
|
}
|
2021-07-11 22:59:29 -05:00
|
|
|
|
2021-07-11 23:04:40 -05:00
|
|
|
public static void FromMemory(
|
2021-10-04 14:17:40 -05:00
|
|
|
byte[] rawSoundData,
|
2021-07-11 23:04:40 -05:00
|
|
|
int rawSoundDataSize,
|
|
|
|
|
out ExtensionsApi.HSpSound soundDataHandle,
|
|
|
|
|
out ExtensionsApi.SoundInformation soundDataInfo)
|
|
|
|
|
{
|
2021-10-04 14:17:40 -05:00
|
|
|
Debug2.Validate(rawSoundData != null, typeof(ArgumentNullException), nameof(rawSoundData));
|
2021-07-11 23:04:40 -05:00
|
|
|
Debug2.Validate(rawSoundDataSize > 0, typeof(ArgumentException), "Invalid sound data size");
|
|
|
|
|
ExtensionsApi.SoundOptions options = ExtensionsApi.SoundOptions.Decode;
|
|
|
|
|
ExtensionsApi.SoundInformation info = new ExtensionsApi.SoundInformation();
|
|
|
|
|
ExtensionsApi.HSpSound hSound;
|
|
|
|
|
EngineApi.IFC(ExtensionsApi.SpSoundLoadBuffer(rawSoundData, rawSoundDataSize, options, out hSound, out info));
|
|
|
|
|
soundDataHandle = hSound;
|
|
|
|
|
soundDataInfo = info;
|
|
|
|
|
}
|
2021-07-11 22:59:29 -05:00
|
|
|
|
2021-07-11 23:04:40 -05:00
|
|
|
public static void DisposeData(
|
|
|
|
|
ExtensionsApi.HSpSound soundDataHandle,
|
|
|
|
|
ExtensionsApi.SoundInformation soundDataInfo)
|
|
|
|
|
{
|
|
|
|
|
EngineApi.IFC(ExtensionsApi.SpSoundDispose(soundDataHandle, soundDataInfo));
|
|
|
|
|
}
|
2021-07-11 22:59:29 -05:00
|
|
|
}
|
|
|
|
|
}
|