-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSapiOutput.cs
More file actions
40 lines (33 loc) · 777 Bytes
/
SapiOutput.cs
File metadata and controls
40 lines (33 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace AccessibleOutput
{
using System;
using System.Speech.Synthesis;
public class SapiOutput : IAccessibleOutput
{
private SpeechSynthesizer synth;
public SapiOutput()
{
this.synth = new SpeechSynthesizer();
}
public bool IsAvailable()
{
return true;
}
public void Speak(string text)
{
this.Speak(text, false);
}
public void Speak(string text, bool interrupt)
{
if (interrupt)
{
this.StopSpeaking();
}
this.synth.SpeakAsync(text);
}
public void StopSpeaking()
{
this.synth.SpeakAsyncCancelAll();
}
}
}