Created
August 6, 2015 18:10
-
-
Save money4honey/ebd1ebd78c8103b74846 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace myClasses | |
{ | |
public class PlayWav | |
{ | |
static System.Media.SoundPlayer player = new System.Media.SoundPlayer(); | |
public static void Play(string path) { | |
if (path.Contains(".wav")) { | |
if (File.Exists(path)) { | |
player.SoundLocation = path; | |
player.Play(); | |
} | |
} | |
} | |
public static void PlayLoop(string path) { | |
if (path.Contains(".wav")) { | |
if (File.Exists(path)) { | |
player.SoundLocation = path; | |
player.PlayLooping(); | |
} | |
} | |
} | |
public static void Stop() { | |
player.Stop(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment