Skip to content

Commit c6e7290

Browse files
author
Jared Bienz
committed
Made fields private with SerializeField attribute and exposed the fields as properties.
1 parent 866ad8e commit c6e7290

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

Assets/HoloToolkit/Utilities/Scripts/TextToSpeechManager.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ public class TextToSpeechManager : MonoBehaviour
5454
{
5555
// Inspector Variables
5656
[Tooltip("The audio source where speech will be played.")]
57-
public AudioSource audioSource;
57+
[SerializeField]
58+
private AudioSource audioSource;
5859

5960
[Tooltip("The voice that will be used to generate speech.")]
60-
public TextToSpeechVoice voice;
61+
[SerializeField]
62+
private TextToSpeechVoice voice;
6163

6264
// Member Variables
6365
#if WINDOWS_UWP
@@ -379,5 +381,15 @@ public void SpeakText(string text)
379381
LogSpeech(text);
380382
#endif
381383
}
384+
385+
/// <summary>
386+
/// Gets or sets the audio source where speech will be played.
387+
/// </summary>
388+
public AudioSource AudioSource { get { return audioSource; } set { audioSource = value; } }
389+
390+
/// <summary>
391+
/// Gets or sets the voice that will be used to generate speech.
392+
/// </summary>
393+
public TextToSpeechVoice Voice { get { return voice; } set { voice = value; } }
382394
}
383395
}

Assets/HoloToolkit/Utilities/Tests/TextToSpeechManagerTest.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@ 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-
2516
// Set up a GestureRecognizer to detect Select gestures.
2617
gestureRecognizer = new GestureRecognizer();
2718
gestureRecognizer.TappedEvent += GestureRecognizer_TappedEvent;
@@ -48,7 +39,7 @@ private void GestureRecognizer_TappedEvent(InteractionSourceKind source, int tap
4839
if (tts != null)
4940
{
5041
// Get the name
51-
var voiceName = Enum.GetName(typeof(TextToSpeechVoice), tts.voice);
42+
var voiceName = Enum.GetName(typeof(TextToSpeechVoice), tts.Voice);
5243

5344
// Create message
5445
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);

0 commit comments

Comments
 (0)