Skip to content

Commit 8e84d05

Browse files
updated merged items
1 parent 25dcdf9 commit 8e84d05

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

Assets/MixedRealityToolkit/_Core/Devices/VoiceInput/WindowsDictationInputDeviceManager.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using Microsoft.MixedReality.Toolkit.Core.Interfaces.Devices;
55
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
6-
using Microsoft.MixedReality.Toolkit.Core.Managers;
6+
using Microsoft.MixedReality.Toolkit.Core.Services;
77
using Microsoft.MixedReality.Toolkit.Core.Utilities.Async;
88
using System.Text;
99
using System.Threading.Tasks;
@@ -16,7 +16,7 @@
1616
namespace 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}\nHRESULT: {hresult}";
289289

290-
MixedRealityManager.InputSystem.RaiseDictationError(inputSource, dictationResult);
290+
MixedRealityToolkit.InputSystem.RaiseDictationError(inputSource, dictationResult);
291291
textSoFar = null;
292292
dictationResult = string.Empty;
293293
}

Assets/MixedRealityToolkit/_Core/Services/MixedRealityToolkit.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ public void RegisterService(Type type, IMixedRealityService service)
501501
Debug.LogWarning("Unable to add a manager of type null.");
502502
return;
503503
}
504-
if (manager == null)
504+
if (service == null)
505505
{
506506
Debug.LogWarning("Unable to add a manager with a null instance.");
507507
return;
@@ -600,7 +600,7 @@ public IMixedRealityService GetService(Type type, string serviceName)
600600
{
601601
if (ActiveProfile == null)
602602
{
603-
Debug.LogError($"Unable to get {managerName} Manager as the Mixed Reality Manager has no Active Profile.");
603+
Debug.LogError($"Unable to get {serviceName} Manager as the Mixed Reality Manager has no Active Profile.");
604604
return null;
605605
}
606606

@@ -609,7 +609,7 @@ public IMixedRealityService GetService(Type type, string serviceName)
609609
Debug.LogError("Unable to get null manager type.");
610610
return null;
611611
}
612-
if (string.IsNullOrEmpty(managerName))
612+
if (string.IsNullOrEmpty(serviceName))
613613
{
614614
Debug.LogError("Unable to get manager by name without the name being specified.");
615615
return null;
@@ -627,7 +627,7 @@ public IMixedRealityService GetService(Type type, string serviceName)
627627

628628
if (service == null)
629629
{
630-
Debug.LogError($"Unable to find {managerName} Manager.");
630+
Debug.LogError($"Unable to find {serviceName} Manager.");
631631
}
632632

633633
return service;
@@ -676,7 +676,7 @@ public void UnregisterService(Type type, string serviceName)
676676
{
677677
if (ActiveProfile == null)
678678
{
679-
Debug.LogError($"Unable to remove {managerName} Manager as the Mixed Reality Manager has no Active Profile.");
679+
Debug.LogError($"Unable to remove {serviceName} Manager as the Mixed Reality Manager has no Active Profile.");
680680
return;
681681
}
682682

@@ -686,7 +686,7 @@ public void UnregisterService(Type type, string serviceName)
686686
return;
687687
}
688688

689-
if (string.IsNullOrEmpty(managerName))
689+
if (string.IsNullOrEmpty(serviceName))
690690
{
691691
Debug.LogError("Unable to remove manager by name without the name being specified.");
692692
return;
@@ -744,7 +744,7 @@ public void DisableService(Type type, string serviceName)
744744
Debug.LogError("Unable to disable null manager type.");
745745
return;
746746
}
747-
if (string.IsNullOrEmpty(managerName))
747+
if (string.IsNullOrEmpty(serviceName))
748748
{
749749
Debug.LogError("Unable to disable manager by name without the name being specified.");
750750
return;
@@ -800,7 +800,7 @@ public void EnableService(Type type, string serviceName)
800800
Debug.LogError("Unable to enable null manager type.");
801801
return;
802802
}
803-
if (string.IsNullOrEmpty(managerName))
803+
if (string.IsNullOrEmpty(serviceName))
804804
{
805805
Debug.LogError("Unable to enable manager by name without the name being specified.");
806806
return;
@@ -833,7 +833,7 @@ public List<IMixedRealityService> GetActiveServices(Type type)
833833
if (type == null)
834834
{
835835
Debug.LogWarning("Unable to get managers with a type of null.");
836-
return new List<IMixedRealityManager>();
836+
return new List<IMixedRealityService>();
837837
}
838838

839839
return GetActiveServices(type, string.Empty);
@@ -850,13 +850,13 @@ public List<IMixedRealityService> GetActiveServices(Type type, string serviceNam
850850
if (ActiveProfile == null)
851851
{
852852
Debug.LogWarning($"Unable to get {nameof(type)} Manager as the Mixed Reality Manager has no Active Profile");
853-
return new List<IMixedRealityManager>();
853+
return new List<IMixedRealityService>();
854854
}
855855

856856
if (type == null)
857857
{
858858
Debug.LogWarning("Unable to get managers with a type of null.");
859-
return new List<IMixedRealityManager>();
859+
return new List<IMixedRealityService>();
860860
}
861861

862862
var services = new List<IMixedRealityService>();
@@ -1040,7 +1040,7 @@ private void GetService(Type type, out IMixedRealityService service)
10401040
if (type == null)
10411041
{
10421042
Debug.LogWarning("Unable to get a component with a type of null.");
1043-
manager = null;
1043+
service = null;
10441044
return;
10451045
}
10461046

@@ -1058,8 +1058,8 @@ private bool GetService(Type type, string serviceName, out IMixedRealityService
10581058
if (type == null)
10591059
{
10601060
Debug.LogWarning("Unable to get a component with a type of null.");
1061-
manager = null;
1062-
return;
1061+
service = null;
1062+
return false;
10631063
}
10641064

10651065
service = null;

0 commit comments

Comments
 (0)