FishNotify/Sounds.cs

31 lines
573 B
C#
Raw Normal View History

2021-09-29 14:36:27 +00:00
using System.IO;
using System.Media;
namespace FishNotify
{
public class Sounds
{
private static readonly SoundPlayer player = new SoundPlayer();
public static void PlaySound(Stream input)
{
lock (player)
{
Stop();
player.Stream = input;
player.Play();
}
}
public static void Stop()
{
lock (player)
{
player.Stop();
player.Stream = null;
}
}
}
}