protected virtual void OnSpeechRecognized(VoiceCommandEvents.SpeechRecognizedEventArgs e) { if (SpeechRecognizedEvent != null) { SpeechRecognizedEvent(this, e); } }
private void voice_SpeechRecognizedEvent(object sender, VoiceCommandEvents.SpeechRecognizedEventArgs e) { SetStatusMsg("Voice Command: " + Functions.String.ToTitleCase(e.Command), true); switch (e.Command) { case "open": case "open file": OpenFile(); break; case "mute": mp.Mute(true); break; case "unmute": mp.Mute(false); break; case "increase volume": case "raise volume": case "volume up": if (mp.Volume >= 90) SetVolume(100); else SetVolume(mp.Volume + 10); break; case "decrease volume": case "lower volume": case "volume down": if (mp.Volume <= 10) SetVolume(0); else SetVolume(mp.Volume - 10); break; case "hide": HidePlayer(); break; case "show": this.WindowState = FormWindowState.Normal; this.Focus(); break; case "help": voiceCommandHelpToolStripMenuItem_Click(this, EventArgs.Empty); break; case "stop listening": DisableVoiceCommand(); break; case "close": Application.Exit(); break; } // check if a file is opened before allowing playback commands if (!mp.PlayerIsRunning() || string.IsNullOrEmpty(mp.FileInfo.Url)) return; switch (e.Command) { case "play": mp.Play(); break; case "pause": mp.Pause(false); break; case "rewind": mp.Rewind(); break; case "stop": mp.Stop(); break; case "next chapter": case "skip chapter": mp.NextChapter(); break; case "previous chapter": mp.PreviousChapter(); break; case "next": case "next file": playlist.PlayNext(); break; case "previous": case "previous file": playlist.PlayPrevious(); break; case "fullscreen": case "view fullscreen": case "go fullscreen": FullScreen = true; break; case "exit fullscreen": case "leave fullscreen": FullScreen = false; break; case "whats playing": if (speech == null) speech = new Speech(mp.FileInfo); speech.SayMedia(); break; } }
protected virtual void OnAudioLevelUpdated(VoiceCommandEvents.AudioLevelUpdatedEventArgs e) { if (AudioLevelUpdatedEvent != null) { AudioLevelUpdatedEvent(this, e); } }
private void voice_AudioLevelUpdatedEvent(object sender, VoiceCommandEvents.AudioLevelUpdatedEventArgs e) { audioLevelBar.Value = e.AudioLevel; }