/// <summary> /// Starts the recording of the video /// </summary> private void startRecord() { this.isRecording = true; //change the status of the WaLLBoT this.SetTextStatus(mainScreen.BoTStatusStr[(int)mainScreen.BoTStatus.Recording]); //more in-your face message Messenger message = new Messenger("WaLLBoT Recording"); message.ShowDialog(); //start the recoding limit of 5 minutes recordingLimTimer.Enabled = true; // Sets up publishing format for file archival type fileOut = new FileArchivePublishFormat(); // Sets file path and name //check the number of videos recorded at start by counting how many videos have been recorded //System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(mainFrame.theSettings.savePath); //MessageBox.Show( //mainFrame.numRecorded = dir.GetFiles().Length; fileOut.OutputFileName = mainFrame.theSettings.savePath + "Message_" + (mainFrame.numRecorded+1) + ".wmv"; //prepares to publish the file, even as one of the 3 file types mainFrame.audVidJob.PublishFormats.Add(fileOut); // Start encoding (recording video) mainFrame.audVidJob.StartEncoding(); }
/// <summary> /// Starts listening for commands /// </summary> public void Start() { //MessageBox.Show("Start Listening"); //compEars.recog try { compEars.RecognizeAsync(RecognizeMode.Multiple); } catch(Exception ex) { MessageBox.Show("Exception @ start recognition: " + ex.ToString()); } //change the status of the WaLLBoT...if not recording if (isRecording == false) { this.SetTextStatus(mainScreen.BoTStatusStr[(int)mainScreen.BoTStatus.Listening]); //more in-your face message Messenger thanks = new Messenger("WaLLBoT Listening"); thanks.ShowDialog(); //reset the confirmation for the next set of detecting this.SetTextCycle("Cycles confirmed: 0"); } //start the time-out for listening this.StartTimeOut(); }
/// <summary> /// Function that executes once the /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void sr_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { //test codez //MessageBox.Show(e.Result.Text); //MessageBox.Show(isRecording.ToString()); if(e.Result.Text == VoiceHandler.startCmd) { //kill the time-out if the command has been picked up this.StopTimeOut(); if (isRecording == false) { //start recording if command is said and not recording this.startRecord(); } //start listening for the next command to stop...if command is picked up by mistake //No longer needed in multiple-command mode //this.Start(); } if((e.Result.Text == VoiceHandler.stopCmd) && (isRecording == true)) { Messenger thanks = new Messenger("Message Received"); thanks.ShowDialog(); //stop listening this.Stop(); //stop recording and save file this.stopRecord(); } }
/// <summary> /// Function that keeps track of time (for mic) /// </summary> /// <param name="source"></param> /// <param name="e"></param> public virtual void IncrementEvent(object source, ElapsedEventArgs e) { this.clockTimeOut += VoiceHandler.REFRESHRATE; if (this.clockTimeOut >= VoiceHandler.timeOut) { if (this.isRecording == false) { Messenger message = new Messenger("Mic has Timed out"); message.ShowDialog(); this.Stop(); this.stopRecord(); } } }