Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Self hosted pipelines (#678)
Browse files Browse the repository at this point in the history
* updated build and test steps

* Apply suggestions from code review

* Apply suggestions from code review

* updated pipelines to use VM

updated package seed asmdef to auto reference assemblies

* make sure we clean our workspace

fixed some typos
cleaned up install-unity task

* added project validation step

updated installed modules for windows machine

* removed package export and docs build from platform build loop

* Fixed some typos

added max parallel job specification
updated step title

* fix quotes for exitor path

* print the path just in case...

* remove the parallel strategy

* quotes are still not working

* try to get the output back to the console

* not sure why it isn't installing correctly

* kick the build

* revert seed asmdef changes

updated project validation

* fixed missing log directory variable

* skip project validation for now

* catch excpetions when trying to initialize speech services on unsupported machines

* a bit more polish to the speech providers

* better pattern matching for message

* Validate project

* add -quit so we don't get stuck forever and use sync solution method directly

* removed agent specification

* test new pool setup

* Add lumin build to core

* don't sign the lumin package

* format the log file names to group them together

* fix typo

* fixed test publishing

* better search pattern for tests

* Removed clean workspace to test speed

* only clean workspace on release or preview release builds

* centralized pipeline tasks into a single repo (#685)

* centralized pipeline tasks into a single repo

* fix endpoint

* updated how we define the array

* updated variable name

* try passing as parameter

* tweak allowable build targets

* updated build targets

* updated default built targets

* build all platforms
  • Loading branch information
StephenHodgson committed Nov 22, 2020
1 parent c6774a2 commit ffa75ad
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 15 deletions.
36 changes: 29 additions & 7 deletions Runtime/Providers/Speech/WindowsDictationDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,21 @@ public WindowsDictationDataProvider(string name, uint priority, BaseMixedReality
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
if (dictationRecognizer == null)
{
dictationRecognizer = new DictationRecognizer();
try
{
dictationRecognizer = new DictationRecognizer();
}
catch (UnityException e)
{
switch (e.Message)
{
case string message when message.Contains("Speech recognition is not supported on this machine."):
Debug.LogWarning($"Skipping {nameof(WindowsDictationDataProvider)} registration.\n{e.Message}");
break;
default:
throw;
}
}
}
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
}
Expand All @@ -40,7 +54,7 @@ public WindowsDictationDataProvider(string name, uint priority, BaseMixedReality
/// <inheritdoc />
public override void Enable()
{
if (!Application.isPlaying) { return; }
if (!Application.isPlaying || dictationRecognizer == null) { return; }

inputSource = MixedRealityToolkit.InputSystem.RequestNewGenericInputSource(Name);
dictationResult = string.Empty;
Expand All @@ -56,7 +70,7 @@ public override void Update()
{
base.Update();

if (!Application.isPlaying) { return; }
if (!Application.isPlaying || dictationRecognizer == null) { return; }

if (!isTransitioning && IsListening && !Microphone.IsRecording(deviceName) && dictationRecognizer.Status == SpeechSystemStatus.Running)
{
Expand All @@ -76,7 +90,7 @@ public override async void Disable()
{
base.Disable();

if (!Application.isPlaying) { return; }
if (!Application.isPlaying || dictationRecognizer == null) { return; }

if (!isTransitioning && IsListening) { await StopRecordingAsync(); }

Expand All @@ -90,7 +104,8 @@ protected override void OnDispose(bool finalizing)
{
if (finalizing)
{
dictationRecognizer.Dispose();
dictationRecognizer?.Dispose();
dictationRecognizer = null;
}

base.OnDispose(finalizing);
Expand Down Expand Up @@ -149,7 +164,11 @@ public override async void StartRecording(GameObject listener = null, float init
/// <inheritdoc />
public override async Task StartRecordingAsync(GameObject listener = null, float initialSilenceTimeout = 5f, float autoSilenceTimeout = 20f, int recordingTime = 10, string micDeviceName = "")
{
if (IsListening || isTransitioning || MixedRealityToolkit.InputSystem == null || !Application.isPlaying)
if (IsListening ||
isTransitioning ||
!Application.isPlaying ||
dictationRecognizer == null ||
MixedRealityToolkit.InputSystem == null)
{
Debug.LogWarning("Unable to start recording");
return;
Expand Down Expand Up @@ -205,7 +224,10 @@ public override async void StopRecording()
/// <inheritdoc />
public override async Task<AudioClip> StopRecordingAsync()
{
if (!IsListening || isTransitioning || !Application.isPlaying)
if (!IsListening ||
isTransitioning ||
!Application.isPlaying ||
dictationRecognizer == null)
{
Debug.LogWarning("Unable to stop recording");
return null;
Expand Down
31 changes: 23 additions & 8 deletions Runtime/Providers/Speech/WindowsSpeechDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,21 @@ public WindowsSpeechDataProvider(string name, uint priority, BaseMixedRealityCon

if (keywordRecognizer == null)
{
keywordRecognizer = new KeywordRecognizer(newKeywords, (ConfidenceLevel)RecognitionConfidenceLevel);
try
{
keywordRecognizer = new KeywordRecognizer(newKeywords, (ConfidenceLevel)RecognitionConfidenceLevel);
}
catch (UnityException e)
{
switch (e.Message)
{
case string message when message.Contains("Speech recognition is not supported on this machine."):
Debug.LogWarning($"Skipping {nameof(WindowsSpeechDataProvider)} registration.\n{e.Message}");
break;
default:
throw;
}
}
}
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
}
Expand All @@ -73,7 +87,7 @@ public override void Enable()
{
base.Enable();

if (!Application.isPlaying || Commands.Length == 0) { return; }
if (!Application.isPlaying || Commands.Length == 0 || keywordRecognizer == null) { return; }

InputSource = MixedRealityToolkit.InputSystem?.RequestNewGenericInputSource("Windows Speech Input Source");

Expand All @@ -90,7 +104,7 @@ public override void Update()
{
base.Update();

if (!keywordRecognizer.IsRunning) { return; }
if (keywordRecognizer == null || !keywordRecognizer.IsRunning) { return; }

for (int i = 0; i < Commands.Length; i++)
{
Expand All @@ -106,7 +120,7 @@ public override void Disable()
{
base.Disable();

if (!Application.isPlaying || Commands.Length == 0) { return; }
if (!Application.isPlaying || Commands.Length == 0 || keywordRecognizer == null) { return; }

StopRecognition();

Expand All @@ -117,7 +131,8 @@ protected override void OnDispose(bool finalizing)
{
if (finalizing)
{
keywordRecognizer.Dispose();
keywordRecognizer?.Dispose();
keywordRecognizer = null;
}

base.OnDispose(finalizing);
Expand All @@ -140,7 +155,7 @@ protected override void OnDispose(bool finalizing)
private static KeywordRecognizer keywordRecognizer;

/// <inheritdoc />
public override bool IsRecognitionActive => keywordRecognizer.IsRunning;
public override bool IsRecognitionActive => keywordRecognizer != null && keywordRecognizer.IsRunning;

/// <summary>
/// The <see cref="RecognitionConfidenceLevel"/> that the <see cref="KeywordRecognizer"/> is using.
Expand All @@ -150,7 +165,7 @@ protected override void OnDispose(bool finalizing)
/// <inheritdoc />
public override void StartRecognition()
{
if (!keywordRecognizer.IsRunning)
if (keywordRecognizer != null && !keywordRecognizer.IsRunning)
{
keywordRecognizer.Start();
}
Expand All @@ -159,7 +174,7 @@ public override void StartRecognition()
/// <inheritdoc />
public override void StopRecognition()
{
if (keywordRecognizer.IsRunning)
if (keywordRecognizer != null && keywordRecognizer.IsRunning)
{
keywordRecognizer.Stop();
}
Expand Down

0 comments on commit ffa75ad

Please sign in to comment.