FishNotify/Sounds.cs
2021-09-29 16:41:18 +02:00

31 lines
573 B
C#

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;
}
}
}
}