Skip to content

Commit 73542e1

Browse files
Merge pull request #3011 from alcooper91/SpeechInformation
Helper methods to determine if speech is active
2 parents e0840e1 + cd9be6c commit 73542e1

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ public WindowsSpeechInputDeviceManager(string name, uint priority) : base(name,
3030
/// </summary>
3131
public IMixedRealityInputSource InputSource = null;
3232

33-
3433
private KeywordRecognizer keywordRecognizer;
3534

35+
/// <inheritdoc />
36+
public bool IsRecognitionActive
37+
{
38+
get { return keywordRecognizer != null && keywordRecognizer.IsRunning; }
39+
}
40+
3641
public RecognitionConfidenceLevel RecognitionConfidenceLevel { get; set; }
3742

3843
/// <inheritdoc />
@@ -85,10 +90,7 @@ public override void Disable()
8590
}
8691
}
8792

88-
/// <summary>
89-
/// Make sure the keyword recognizer is off, then start it.
90-
/// Otherwise, leave it alone because it's already in the desired state.
91-
/// </summary>
93+
/// <inheritdoc />
9294
public void StartRecognition()
9395
{
9496
if (keywordRecognizer != null && !keywordRecognizer.IsRunning)
@@ -97,10 +99,7 @@ public void StartRecognition()
9799
}
98100
}
99101

100-
/// <summary>
101-
/// Make sure the keyword recognizer is on, then stop it.
102-
/// Otherwise, leave it alone because it's already in the desired state.
103-
/// </summary>
102+
/// <inheritdoc />
104103
public void StopRecognition()
105104
{
106105
if (keywordRecognizer != null && keywordRecognizer.IsRunning)

Assets/MixedRealityToolkit/_Core/Interfaces/Devices/IMixedRealitySpeechSystem.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ namespace Microsoft.MixedReality.Toolkit.Core.Interfaces.Devices
88
/// </summary>
99
public interface IMixedRealitySpeechSystem : IMixedRealityDeviceManager, IMixedRealityExtensionService
1010
{
11+
/// <summary>
12+
/// Query whether or not the speech system is active
13+
/// </summary>
14+
bool IsRecognitionActive { get; }
15+
1116
/// <summary>
1217
/// Make sure the keyword recognizer is on, then stop it.
1318
/// Otherwise, leave it alone because it's already in the desired state.
@@ -20,4 +25,4 @@ public interface IMixedRealitySpeechSystem : IMixedRealityDeviceManager, IMixedR
2025
/// </summary>
2126
void StopRecognition();
2227
}
23-
}
28+
}

0 commit comments

Comments
 (0)