Skip to content

Commit f2a0c12

Browse files
Stephen HodgsonStephen Hodgson
authored andcommitted
DictationManager: handle any audio source we want. Hmm maybe in the future we can register this new clip into the UAudioManager somehow.
1 parent 86f332f commit f2a0c12

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Assets/HoloToolkit/Input/Scripts/Microphone/DictationManager.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class DictationManager : Singleton<DictationManager>
1313
/// <summary>
1414
/// Dictation Audio Source. Useful for dictation playback.
1515
/// </summary>
16-
public AudioSource DictationAudioSource { get; private set; }
16+
public AudioSource DictationAudioSource { get; set; }
1717

1818
/// <summary>
1919
/// String result of the current dictation.
@@ -120,8 +120,6 @@ protected override void Awake()
120120

121121
DictationResult = string.Empty;
122122

123-
DictationAudioSource = gameObject.GetComponent<AudioSource>();
124-
125123
dictationRecognizer = new DictationRecognizer();
126124
dictationRecognizer.DictationHypothesis += DictationRecognizer_DictationHypothesis;
127125
dictationRecognizer.DictationResult += DictationRecognizer_DictationResult;
@@ -176,7 +174,10 @@ public void StartRecording()
176174
recordingStarted = true;
177175

178176
// Start recording from the microphone.
179-
DictationAudioSource.clip = Microphone.Start(DeviceName, false, recordingTime, samplingRate);
177+
if (DictationAudioSource != null)
178+
{
179+
DictationAudioSource.clip = Microphone.Start(DeviceName, false, recordingTime, samplingRate);
180+
}
180181
}
181182

182183
/// <summary>

0 commit comments

Comments
 (0)