Files
ZuneShell.dll/UIX/Microsoft/Iris/Audio/Sound.cs
T

64 lines
1.8 KiB
C#
Raw Normal View History

// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Audio.Sound
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using Microsoft.Iris.Render;
using Microsoft.Iris.RenderAPI.Audio;
using Microsoft.Iris.Session;
using Microsoft.Iris.UI;
namespace Microsoft.Iris.Audio
{
internal class Sound
{
private string _source;
private SystemSoundEvent _systemSoundEvent;
internal Sound()
{
}
internal string Source
{
2021-04-02 19:10:51 -05:00
get => _source;
set
{
2021-04-02 19:10:51 -05:00
_source = value;
_systemSoundEvent = SystemSoundEvent.None;
}
}
internal SystemSoundEvent SystemSoundEvent
{
2021-04-02 19:10:51 -05:00
get => _systemSoundEvent;
set
{
2021-04-02 19:10:51 -05:00
_systemSoundEvent = value;
_source = null;
}
}
public void Play()
{
if (!Environment.Instance.SoundEffectsEnabled)
return;
SoundManager soundManager = UISession.Default.SoundManager;
2021-03-31 17:15:06 -05:00
ISoundBuffer soundBuffer = null;
string source = null;
2021-04-02 19:10:51 -05:00
if (_source != null)
source = _source;
else if (_systemSoundEvent != SystemSoundEvent.None)
source = soundManager.GetSystemSoundEventSource(_systemSoundEvent);
if (source != null)
soundBuffer = soundManager.GetSoundBuffer(source);
if (soundBuffer == null)
return;
2021-03-31 17:15:06 -05:00
ISound sound = soundBuffer.CreateSound(this);
sound.Play();
2021-03-31 17:15:06 -05:00
sound.UnregisterUsage(this);
}
}
}