Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speak the last letter of a matched word before speaking the word itself #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ private void AddFigure(FrameworkElement uie, char c)
this.wordFinder.AnimateLettersIntoWord(figuresUserControlQueue[window.Name], lastWord);
}

SpeakString(lastWord);
PlaySound(template);
SpeakString(lastWord, 500);
}
else
{
Expand Down Expand Up @@ -444,10 +445,10 @@ private void PlayLaughter()
Win32Audio.PlayWavResource(Utils.GetRandomSoundFile());
}

private void SpeakString(string s)
private void SpeakString(string s, int delayStart = 0)
{
ThreadedSpeak ts = new ThreadedSpeak(s);
ts.Speak();
ts.Speak(delayStart);
}

private class ThreadedSpeak
Expand Down Expand Up @@ -485,15 +486,16 @@ public ThreadedSpeak(string Word)
SpeechSynth.Rate = -1;
SpeechSynth.Volume = 100;
}
public void Speak()
public void Speak(int delayStart = 0)
{
Thread oThread = new Thread(new ThreadStart(this.Start));
oThread.Start();
Thread oThread = new Thread(new ParameterizedThreadStart(this.Start));
oThread.Start(delayStart);
}
private void Start()
private void Start(object delayStart)
{
try
{
Thread.Sleep((int)delayStart);
SpeechSynth.Speak(Word);
}
catch (Exception e)
Expand Down