31 lines
573 B
C#
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|