Skip to content

Commit 866ad8e

Browse files
author
Jared Bienz
committed
Updated the test scene to have each voice speak its name as part of the message.
1 parent f496558 commit 866ad8e

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Assets/HoloToolkit/Utilities/Tests/TextToSpeechManagerTest.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ public class TextToSpeechManagerTest : MonoBehaviour
1313
// Use this for initialization
1414
void Start ()
1515
{
16+
#if WINDOWS_UWP
17+
// var synthesizer = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
18+
var voices = Windows.Media.SpeechSynthesis.SpeechSynthesizer.AllVoices;
19+
foreach (var voice in voices)
20+
{
21+
Debug.Log("voice = " + voice.DisplayName);
22+
}
23+
#endif
24+
1625
// Set up a GestureRecognizer to detect Select gestures.
1726
gestureRecognizer = new GestureRecognizer();
1827
gestureRecognizer.TappedEvent += GestureRecognizer_TappedEvent;
1928
gestureRecognizer.StartCapturingGestures();
20-
2129
}
2230

2331
private void GestureRecognizer_TappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)
@@ -39,7 +47,14 @@ private void GestureRecognizer_TappedEvent(InteractionSourceKind source, int tap
3947
// This voice will appear to emanate from the object.
4048
if (tts != null)
4149
{
42-
tts.SpeakText("This voice should sound like it's coming from the object you clicked. Feel free to walk around and listen from different angles.");
50+
// Get the name
51+
var voiceName = Enum.GetName(typeof(TextToSpeechVoice), tts.voice);
52+
53+
// Create message
54+
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);
55+
56+
// Speak message
57+
tts.SpeakText(msg);
4358
}
4459
}
4560
}

0 commit comments

Comments
 (0)