Skip to content

Commit ba2c579

Browse files
authored
Merge pull request #3741 from keveleigh/speech-system-ifs
Update #if wrappings around speech providers
2 parents b144eb2 + 5a4d23f commit ba2c579

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

Assets/MixedRealityToolkit.Providers/WindowsVoiceInput/WindowsDictationInputProvider.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
namespace Microsoft.MixedReality.Toolkit.Windows.Input
1515
{
16-
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
17-
1816
[MixedRealityExtensionService(SupportedPlatforms.WindowsStandalone | SupportedPlatforms.WindowsUniversal | SupportedPlatforms.WindowsEditor)]
1917
public class WindowsDictationInputProvider : BaseDeviceManager, IMixedRealityDictationSystem
2018
{
@@ -31,11 +29,10 @@ public WindowsDictationInputProvider(
3129
uint priority = DefaultPriority,
3230
BaseMixedRealityProfile profile = null) : base(registrar, name, priority, profile) { }
3331

34-
/// <summary>
35-
/// Is the Dictation Manager currently running?
36-
/// </summary>
32+
/// <inheritdoc />
3733
public bool IsListening { get; private set; } = false;
3834

35+
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
3936
private bool hasFailed;
4037
private bool hasListener;
4138
private bool isTransitioning;
@@ -130,6 +127,7 @@ public override async void Disable()
130127
}
131128
}
132129

130+
/// <inheritdoc />
133131
public override void Destroy()
134132
{
135133
if (Application.isPlaying)
@@ -297,6 +295,6 @@ private void DictationRecognizer_DictationError(string error, int hresult)
297295
textSoFar = null;
298296
dictationResult = string.Empty;
299297
}
300-
}
301298
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
299+
}
302300
}

Assets/MixedRealityToolkit.Providers/WindowsVoiceInput/WindowsSpeechInputProvider.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33

44
using Microsoft.MixedReality.Toolkit.Input;
55
using Microsoft.MixedReality.Toolkit.Utilities;
6-
using System;
7-
using UnityEngine;
8-
using UInput = UnityEngine.Input;
96

107
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
8+
using System;
9+
using UnityEngine;
1110
using UnityEngine.Windows.Speech;
11+
using UInput = UnityEngine.Input;
1212
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
1313

1414
namespace Microsoft.MixedReality.Toolkit.Windows.Input
1515
{
16-
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
17-
1816
[MixedRealityExtensionService(SupportedPlatforms.WindowsStandalone | SupportedPlatforms.WindowsUniversal | SupportedPlatforms.WindowsEditor)]
1917
public class WindowsSpeechInputProvider : BaseDeviceManager, IMixedRealitySpeechSystem
2018
{
@@ -26,9 +24,9 @@ public class WindowsSpeechInputProvider : BaseDeviceManager, IMixedRealitySpeech
2624
/// <param name="priority">Service priority. Used to determine order of instantiation.</param>
2725
/// <param name="profile">The service's configuration profile.</param>
2826
public WindowsSpeechInputProvider(
29-
IMixedRealityServiceRegistrar registrar,
30-
string name = null,
31-
uint priority = DefaultPriority,
27+
IMixedRealityServiceRegistrar registrar,
28+
string name = null,
29+
uint priority = DefaultPriority,
3230
BaseMixedRealityProfile profile = null) : base(registrar, name, priority, profile) { }
3331

3432
/// <summary>
@@ -41,6 +39,12 @@ public WindowsSpeechInputProvider(
4139
/// </summary>
4240
public IMixedRealityInputSource InputSource = null;
4341

42+
/// <summary>
43+
/// The minimum confidence level for the recognizer to fire an event.
44+
/// </summary>
45+
public RecognitionConfidenceLevel RecognitionConfidenceLevel { get; set; }
46+
47+
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
4448
private KeywordRecognizer keywordRecognizer;
4549

4650
/// <inheritdoc />
@@ -49,8 +53,6 @@ public bool IsRecognitionActive
4953
get { return keywordRecognizer != null && keywordRecognizer.IsRunning; }
5054
}
5155

52-
public RecognitionConfidenceLevel RecognitionConfidenceLevel { get; set; }
53-
5456
/// <inheritdoc />
5557
public override void Enable()
5658
{
@@ -135,6 +137,6 @@ private void OnPhraseRecognized(ConfidenceLevel confidence, TimeSpan phraseDurat
135137
}
136138
}
137139
}
138-
}
139140
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
141+
}
140142
}

Assets/MixedRealityToolkit/Interfaces/Devices/IMixedRealityDictationSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.MixedReality.Toolkit.Input
1212
public interface IMixedRealityDictationSystem : IMixedRealityDeviceManager, IMixedRealityExtensionService
1313
{
1414
/// <summary>
15-
/// Is the system currently listing to dictation input?
15+
/// Is the system currently listing for dictation input?
1616
/// </summary>
1717
bool IsListening { get; }
1818

0 commit comments

Comments
 (0)