// READ MENU PROCESSORS private void ProcessReadAllSpeech() { currentState = speakingStates.speakingAll; updateStatusField(_speakingStatus); strSpeechBuffer = txtLectureBox.Text; ProcessNextSpeakAllSentence(); }
private void ProcessNextSpeakParagraphSentence() { Log.Debug("Entering..."); Log.Debug("txtLectureBox.SelectionStart =" + txtLectureBox.SelectionStart); Log.Debug("txtLectureBox.SelectionLength=" + txtLectureBox.SelectionLength); Log.Debug("txtLectureBox.Text.Length=" + txtLectureBox.Text.Length); string strLectureText = String.Empty; strLectureText = txtLectureBox.Text; int currentStartPos = txtLectureBox.SelectionStart + txtLectureBox.SelectionLength; if (currentStartPos > txtLectureBox.Text.Length) { currentState = speakingStates.silent; clearStatusField(); return; } Log.Debug("currentStartPos text is >>>" + (int)strLectureText[currentStartPos] + "<<<"); if ((int)strLectureText[currentStartPos] == 13) { Log.Debug("REACHED END OF PARAGRAPH!"); currentState = speakingStates.silent; clearStatusField(); txtLectureBox.SelectionStart = currentStartPos + 1; txtLectureBox.SelectionLength = 0; txtLectureBox.Focus(); return; } else { Log.Debug("moving to next sentence..."); txtLectureBox.Invoke(new delegateMoveToNextTextFragment(MoveToNextTextFragment), txtLectureBox, SENTENCE_TERMINATORS); txtStatusBox.Invoke((MethodInvoker) delegate { txtStatusBox.Text = txtLectureBox.SelectedText; }); Log.Debug("selected text=" + txtLectureBox.SelectedText + "len=" + txtLectureBox.SelectedText.Length.ToString()); SendTextImmediate(txtLectureBox.SelectedText); txtLectureBox.Focus(); } //if (String.IsNullOrEmpty(txtStatusBox.Text)) //{ // currentState = speakingStates.silent; // clearStatusField(); //} //else //{ // updateStatusField(_speakingStatus); // SendTextImmediate(txtStatusBox.SelectedText); // txtLectureBox.Focus(); //} }
private void StopSpeaking() { // TODO: speaking state should be handled in the speech api but it's // not working so well so just handle it here for now // only send stop speech if it is not already silent. for some reason // stop speech requests get piled up and prevent further speech from // commencing if the hardware isn't already speaking if (currentState != speakingStates.silent) { TTSManager.Instance.ActiveEngine.Stop(); currentState = speakingStates.silent; clearStatusField(); } }
private void ProcessNextSpeakAllSentence() { Log.Debug("entering..."); MoveToNextTextFragment(ref txtLectureBox, SENTENCE_TERMINATORS); txtStatusBox.Text = txtLectureBox.SelectedText; if (String.IsNullOrEmpty(txtStatusBox.Text)) { currentState = speakingStates.silent; clearStatusField(); } else { updateStatusField(_speakingStatus); SendTextImmediate(txtLectureBox.SelectedText); txtLectureBox.Focus(); } }
private void ProcessSpeakParagraph() { Log.Debug("Entering..."); currentState = speakingStates.speakingParagraph; updateStatusField(_speakingStatus); //txtLectureBox.Invoke(new delegateMoveToNextTextFragment(MoveToNextTextFragment), // txtLectureBox, PARAGRAPH_TERMINATORS); txtLectureBox.Invoke(new delegateMoveToNextTextFragment(MoveToNextTextFragment), txtLectureBox, SENTENCE_TERMINATORS); txtStatusBox.Invoke((MethodInvoker) delegate { txtStatusBox.Text = txtLectureBox.SelectedText; }); Log.Debug("selected text=" + txtLectureBox.SelectedText); SendTextImmediate(txtLectureBox.SelectedText); txtLectureBox.Focus(); }
private void ProcessNextSpeakParagraphSentence() { Log.Debug("Entering..."); Log.Debug("txtLectureBox.SelectionStart =" + txtLectureBox.SelectionStart); Log.Debug("txtLectureBox.SelectionLength=" + txtLectureBox.SelectionLength); Log.Debug("txtLectureBox.Text.Length=" + txtLectureBox.Text.Length); string strLectureText = String.Empty; strLectureText = txtLectureBox.Text; int currentStartPos = txtLectureBox.SelectionStart + txtLectureBox.SelectionLength; if (currentStartPos > txtLectureBox.Text.Length) { currentState = speakingStates.silent; clearStatusField(); return; } Log.Debug("currentStartPos text is >>>" + (int)strLectureText[currentStartPos] + "<<<"); if ( (int) strLectureText[currentStartPos] == 13) { Log.Debug("REACHED END OF PARAGRAPH!"); currentState = speakingStates.silent; clearStatusField(); txtLectureBox.SelectionStart = currentStartPos + 1; txtLectureBox.SelectionLength = 0; txtLectureBox.Focus(); return; } else { Log.Debug("moving to next sentence..."); txtLectureBox.Invoke(new delegateMoveToNextTextFragment(MoveToNextTextFragment), txtLectureBox, SENTENCE_TERMINATORS); txtStatusBox.Invoke((MethodInvoker)delegate { txtStatusBox.Text = txtLectureBox.SelectedText; }); Log.Debug("selected text=" + txtLectureBox.SelectedText + "len=" + txtLectureBox.SelectedText.Length.ToString()); SendTextImmediate(txtLectureBox.SelectedText); txtLectureBox.Focus(); } //if (String.IsNullOrEmpty(txtStatusBox.Text)) //{ // currentState = speakingStates.silent; // clearStatusField(); //} //else //{ // updateStatusField(_speakingStatus); // SendTextImmediate(txtStatusBox.SelectedText); // txtLectureBox.Focus(); //} }
private void ProcessSpeakParagraph() { Log.Debug("Entering..."); currentState = speakingStates.speakingParagraph; updateStatusField(_speakingStatus); //txtLectureBox.Invoke(new delegateMoveToNextTextFragment(MoveToNextTextFragment), // txtLectureBox, PARAGRAPH_TERMINATORS); txtLectureBox.Invoke(new delegateMoveToNextTextFragment(MoveToNextTextFragment), txtLectureBox, SENTENCE_TERMINATORS); txtStatusBox.Invoke((MethodInvoker)delegate { txtStatusBox.Text = txtLectureBox.SelectedText; }); Log.Debug("selected text=" + txtLectureBox.SelectedText); SendTextImmediate(txtLectureBox.SelectedText); txtLectureBox.Focus(); }
private void ProcessKeyPress(char ch) { Log.Debug(ch.ToString()); if (currentState == speakingStates.speakingAll) { Debug.WriteLine("ProcessKeyPress() - stopping \"read all\" command!"); StopSpeaking(); currentState = speakingStates.silent; clearStatusField(); return; } if (true == (((ch == 'u') | (ch == 'U')))) { // start reading all ProcessReadAllSpeech(); } else if (true == (((ch == 'r') | (ch == 'R')))) { // read sentence ProcessSpeakSentence(); } else if (true == ((ch == ' '))) { // read paragraph //ProcessSpeakSentence(); ProcessSpeakParagraph(); } else if (true == (((ch == 'm') | (ch == 'M')))) { // move up a paragraph ProcessParagraphUp(); } else if (true == (((ch == 'x') | (ch == 'X')))) { // move up a sentence ProcessSentenceUp(); } else if (true == (((ch == 'k') | (ch == 'K')))) { // move down a paragraph ProcessParagraphDown(); } else if (true == (((ch == 'w') | (ch == 'W')))) { // move down a sentence ProcessSentenceDown(); } else if (true == (((ch == 'z') | (ch == 'Z')))) { // open file this.Invoke(new MethodInvoker(delegate() { ProcessOpenFile(); })); } else if (true == (((ch == 'i') | (ch == 'I')))) { // go to top MoveCursorToBeginning(ref txtLectureBox); } else if (true == (((ch == 'q') | (ch == 'Q')))) { // quit app Log.Debug("Quit"); ProcessExit(); } else { // TODO } }