2021-03-31 16:42:58 -05:00
|
|
|
// 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;
|
2021-03-31 16:42:58 -05:00
|
|
|
set
|
|
|
|
|
{
|
2021-04-02 19:10:51 -05:00
|
|
|
_source = value;
|
|
|
|
|
_systemSoundEvent = SystemSoundEvent.None;
|
2021-03-31 16:42:58 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal SystemSoundEvent SystemSoundEvent
|
|
|
|
|
{
|
2021-04-02 19:10:51 -05:00
|
|
|
get => _systemSoundEvent;
|
2021-03-31 16:42:58 -05:00
|
|
|
set
|
|
|
|
|
{
|
2021-04-02 19:10:51 -05:00
|
|
|
_systemSoundEvent = value;
|
|
|
|
|
_source = null;
|
2021-03-31 16:42:58 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
2021-03-31 16:42:58 -05:00
|
|
|
if (source != null)
|
|
|
|
|
soundBuffer = soundManager.GetSoundBuffer(source);
|
|
|
|
|
if (soundBuffer == null)
|
|
|
|
|
return;
|
2021-03-31 17:15:06 -05:00
|
|
|
ISound sound = soundBuffer.CreateSound(this);
|
2021-03-31 16:42:58 -05:00
|
|
|
sound.Play();
|
2021-03-31 17:15:06 -05:00
|
|
|
sound.UnregisterUsage(this);
|
2021-03-31 16:42:58 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|