C
C#12mo ago
!Rushaan

✅ WPF TTS plays before text updates

mainText.Text = (string)reader.Value;
if (autoplayVar)
{
PlayTTS(mainText.Text);
}
mainText.Text = (string)reader.Value;
if (autoplayVar)
{
PlayTTS(mainText.Text);
}
The above code is inside a button click event. I want the mainText.Text to update before the TTS plays because when it starts playing the mainText.Text doesn't updates to reader.Value until the TTS has stopped playing
1 Reply
!Rushaan
!RushaanOP12mo ago
PlayTTS method:
public void PlayTTS(string text)
{
SpeechSynthesizer ss = new SpeechSynthesizer();
ss.Speak(text);
}
public void PlayTTS(string text)
{
SpeechSynthesizer ss = new SpeechSynthesizer();
ss.Speak(text);
}
Nvm I fixed the issue by creating a new thread and using the SpeechSynthesizer in that thread.
Want results from more Discord servers?
Add your server