using WMPLib; namespace zenat { public partial class Form1 : Form { int PlayerFinished = 0; WMPLib.WindowsMediaPlayer Player; public Form1() { InitializeComponent(); //Sound Player = new WMPLib.WindowsMediaPlayer(); Player.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange); Player.MediaError += new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError); Player.settings.volume = 100; } // private void Player_PlayStateChange(int NewState) { if ((WMPLib.WMPPlayState)NewState == WMPLib.WMPPlayState.wmppsStopped) PlayerFinished = 1; } // private void Player_MediaError(object pMediaObject) { MessageBox.Show("Cannot play media file."); } // private void pronouncClick(object sender, EventArgs e) { string sound; //PlayerFinished = 0; //Player.URL = "PalySilence4_OneSecond.wav"; PlayerFinished = 0; sound = "x0.wav"; if (File.Exists(sound)) Player.URL = sound; else Player.URL = "PalySilence4_OneSecond.wav";// if (PlayerFinished == 1)//start playing x1.wav if only the x0.wav ended { //PlayerFinished = 0; //Player.URL = "PalySilence4_OneSecond.wav"; PlayerFinished = 0; sound = "x1.wav"; if (File.Exists(sound)) Player.URL = sound; else Player.URL = "PalySilence4_OneSecond.wav"; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)