Пример #1
0
        void player_ProgressChanged(object sender, TextToSpeech.ProgressChangedEventArgs e)
        {
            SpeechPart speechPart = e.Data;

            rtbContent.Select(0, speechPart.TextIndex);
            rtbContent.SelectionColor = Color.Gray;
            rtbContent.Select(speechPart.TextIndex, speechPart.TextLength);
            rtbContent.SelectionColor = Color.Red;
            rtbContent.Select(speechPart.TextIndex + speechPart.TextLength, 0);
        }
Пример #2
0
        void tts_ProgressChanged(object sender, TextToSpeech.ProgressChangedEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new EventHandler <TextToSpeech.ProgressChangedEventArgs>(tts_ProgressChanged), sender, e);
                return;
            }

            SpeechPart speechPart = e.Data;

            progressBar.Maximum = speechPart.TotalCount;
            progressBar.Value   = speechPart.TextIndex + speechPart.TextLength;


            player.PlayRawAudioSync(speechPart);
        }