Skip to content

Commit eea97ba

Browse files
committed
Updating TextToSpeechManager test scene
1 parent 258be9e commit eea97ba

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Assets/HoloToolkit/Utilities/Tests/TextToSpeechManagerTest.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ public class TextToSpeechManagerTest : MonoBehaviour
99
{
1010
private GestureRecognizer gestureRecognizer;
1111
public TextToSpeechManager textToSpeechManager;
12+
private bool isSpeaking;
1213

1314
// Use this for initialization
1415
void Start ()
1516
{
17+
isSpeaking = false;
18+
1619
// Set up a GestureRecognizer to detect Select gestures.
1720
gestureRecognizer = new GestureRecognizer();
1821
gestureRecognizer.TappedEvent += GestureRecognizer_TappedEvent;
@@ -36,17 +39,24 @@ private void GestureRecognizer_TappedEvent(InteractionSourceKind source, int tap
3639

3740
// If we have a text to speech manager on the target object, say something.
3841
// This voice will appear to emanate from the object.
39-
if (tts != null)
42+
if (tts != null && !isSpeaking)
4043
{
4144
// Get the name
4245
var voiceName = Enum.GetName(typeof(TextToSpeechVoice), tts.Voice);
4346

4447
// Create message
4548
var msg = string.Format("This is the {0} voice. It should sound like it's coming from the object you clicked. Feel free to walk around and listen from different angles.", voiceName);
4649

50+
isSpeaking = true;
51+
4752
// Speak message
4853
tts.SpeakText(msg);
4954
}
55+
else if (isSpeaking)
56+
{
57+
isSpeaking = false;
58+
tts.StopSpeaking();
59+
}
5060
}
5161
}
5262

0 commit comments

Comments
 (0)