33
44using Microsoft . MixedReality . Toolkit . Core . Interfaces . Devices ;
55using Microsoft . MixedReality . Toolkit . Core . Interfaces . InputSystem ;
6- using Microsoft . MixedReality . Toolkit . Core . Managers ;
6+ using Microsoft . MixedReality . Toolkit . Core . Services ;
77using Microsoft . MixedReality . Toolkit . Core . Utilities . Async ;
88using System . Text ;
99using System . Threading . Tasks ;
1616namespace Microsoft . MixedReality . Toolkit . Core . Devices . VoiceInput
1717{
1818#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
19- public class WindowsDictationInputDeviceManager : BaseDeviceManager , IMixedRealityDictationManager
19+ public class WindowsDictationInputDeviceManager : BaseDeviceManager , IMixedRealityDictationSystem
2020 {
2121 /// <summary>
2222 /// Constructor.
@@ -72,13 +72,13 @@ public override void Enable()
7272 {
7373 if ( ! Application . isPlaying ) { return ; }
7474
75- if ( MixedRealityManager . InputSystem == null )
75+ if ( MixedRealityToolkit . InputSystem == null )
7676 {
7777 Debug . LogWarning ( "Unable to start Windows Dictation Device Manager. An Input System is required for this feature." ) ;
7878 return ;
7979 }
8080
81- inputSource = MixedRealityManager . InputSystem . RequestNewGenericInputSource ( "Dictation Recognizer" ) ;
81+ inputSource = MixedRealityToolkit . InputSystem . RequestNewGenericInputSource ( "Dictation Recognizer" ) ;
8282 dictationResult = string . Empty ;
8383
8484 if ( dictationRecognizer == null )
@@ -95,7 +95,7 @@ public override void Enable()
9595 /// <inheritdoc />
9696 public override void Update ( )
9797 {
98- if ( ! Application . isPlaying || MixedRealityManager . InputSystem == null ) { return ; }
98+ if ( ! Application . isPlaying || MixedRealityToolkit . InputSystem == null ) { return ; }
9999
100100 if ( ! isTransitioning && IsListening && ! Microphone . IsRecording ( deviceName ) && dictationRecognizer . Status == SpeechSystemStatus . Running )
101101 {
@@ -106,7 +106,7 @@ public override void Update()
106106 if ( ! hasFailed && dictationRecognizer . Status == SpeechSystemStatus . Failed )
107107 {
108108 hasFailed = true ;
109- MixedRealityManager . InputSystem . RaiseDictationError ( inputSource , "Dictation recognizer has failed!" ) ;
109+ MixedRealityToolkit . InputSystem . RaiseDictationError ( inputSource , "Dictation recognizer has failed!" ) ;
110110 }
111111 }
112112
@@ -141,7 +141,7 @@ public async void StartRecording(GameObject listener, float initialSilenceTimeou
141141 /// <inheritdoc />
142142 public async Task StartRecordingAsync ( GameObject listener = null , float initialSilenceTimeout = 5f , float autoSilenceTimeout = 20f , int recordingTime = 10 , string micDeviceName = "" )
143143 {
144- if ( IsListening || isTransitioning || MixedRealityManager . InputSystem == null || ! Application . isPlaying )
144+ if ( IsListening || isTransitioning || MixedRealityToolkit . InputSystem == null || ! Application . isPlaying )
145145 {
146146 Debug . LogWarning ( "Unable to start recording" ) ;
147147 return ;
@@ -154,7 +154,7 @@ public async Task StartRecordingAsync(GameObject listener = null, float initialS
154154 if ( listener != null )
155155 {
156156 hasListener = true ;
157- MixedRealityManager . InputSystem . PushModalInputHandler ( listener ) ;
157+ MixedRealityToolkit . InputSystem . PushModalInputHandler ( listener ) ;
158158 }
159159
160160 if ( PhraseRecognitionSystem . Status == SpeechSystemStatus . Running )
@@ -179,7 +179,7 @@ public async Task StartRecordingAsync(GameObject listener = null, float initialS
179179
180180 if ( dictationRecognizer . Status == SpeechSystemStatus . Failed )
181181 {
182- MixedRealityManager . InputSystem . RaiseDictationError ( inputSource , "Dictation recognizer failed to start!" ) ;
182+ MixedRealityToolkit . InputSystem . RaiseDictationError ( inputSource , "Dictation recognizer failed to start!" ) ;
183183 return ;
184184 }
185185
@@ -209,7 +209,7 @@ public async Task<AudioClip> StopRecordingAsync()
209209
210210 if ( hasListener )
211211 {
212- MixedRealityManager . InputSystem . PopModalInputHandler ( ) ;
212+ MixedRealityToolkit . InputSystem . PopModalInputHandler ( ) ;
213213 hasListener = false ;
214214 }
215215
@@ -241,7 +241,7 @@ private void DictationRecognizer_DictationHypothesis(string text)
241241 // We don't want to append to textSoFar yet, because the hypothesis may have changed on the next event.
242242 dictationResult = $ "{ textSoFar } { text } ...";
243243
244- MixedRealityManager . InputSystem . RaiseDictationHypothesis ( inputSource , dictationResult ) ;
244+ MixedRealityToolkit . InputSystem . RaiseDictationHypothesis ( inputSource , dictationResult ) ;
245245 }
246246
247247 /// <summary>
@@ -255,7 +255,7 @@ private void DictationRecognizer_DictationResult(string text, ConfidenceLevel co
255255
256256 dictationResult = textSoFar . ToString ( ) ;
257257
258- MixedRealityManager . InputSystem . RaiseDictationResult ( inputSource , dictationResult ) ;
258+ MixedRealityToolkit . InputSystem . RaiseDictationResult ( inputSource , dictationResult ) ;
259259 }
260260
261261 /// <summary>
@@ -273,7 +273,7 @@ private void DictationRecognizer_DictationComplete(DictationCompletionCause caus
273273 dictationResult = "Dictation has timed out. Please try again." ;
274274 }
275275
276- MixedRealityManager . InputSystem . RaiseDictationComplete ( inputSource , dictationResult , dictationAudioClip ) ;
276+ MixedRealityToolkit . InputSystem . RaiseDictationComplete ( inputSource , dictationResult , dictationAudioClip ) ;
277277 textSoFar = null ;
278278 dictationResult = string . Empty ;
279279 }
@@ -287,7 +287,7 @@ private void DictationRecognizer_DictationError(string error, int hresult)
287287 {
288288 dictationResult = $ "{ error } \n HRESULT: { hresult } ";
289289
290- MixedRealityManager . InputSystem . RaiseDictationError ( inputSource , dictationResult ) ;
290+ MixedRealityToolkit . InputSystem . RaiseDictationError ( inputSource , dictationResult ) ;
291291 textSoFar = null ;
292292 dictationResult = string . Empty ;
293293 }
0 commit comments