diff --git a/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json b/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json index ce075f1d1..a74e77404 100644 --- a/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json +++ b/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json @@ -442,7 +442,6 @@ "depth": 0, "source": "local", "dependencies": { - "com.microsoft.mrtk.tts.windows": "1.0.4", "org.mixedrealitytoolkit.core": "3.2.2" } }, diff --git a/UnityProjects/MRTKDevTemplate/ProjectSettings/ProjectSettings.asset b/UnityProjects/MRTKDevTemplate/ProjectSettings/ProjectSettings.asset index ffbf4295f..95551d3bf 100644 --- a/UnityProjects/MRTKDevTemplate/ProjectSettings/ProjectSettings.asset +++ b/UnityProjects/MRTKDevTemplate/ProjectSettings/ProjectSettings.asset @@ -240,7 +240,7 @@ PlayerSettings: clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea templatePackageId: com.unity.template.3d@5.0.4 templateDefaultScene: Assets/Scenes/SampleScene.unity - useCustomMainManifest: 1 + useCustomMainManifest: 0 useCustomLauncherManifest: 0 useCustomMainGradleTemplate: 0 useCustomLauncherGradleManifest: 0 @@ -843,9 +843,9 @@ PlayerSettings: metroPackageVersion: 3.0.0.0 metroCertificatePath: Assets/WSATestCertificate.pfx metroCertificatePassword: - metroCertificateSubject: Microsoft - metroCertificateIssuer: Microsoft - metroCertificateNotAfter: 803769c0d5dfda01 + metroCertificateSubject: Mixed Reality Toolkit Organization + metroCertificateIssuer: Mixed Reality Toolkit Organization + metroCertificateNotAfter: 00abfea1861cdd01 metroApplicationDescription: MRTK3 Sample wsaImages: {} metroTileShortName: MRTK3 diff --git a/org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md b/org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md index fd6c5941a..fd954d6a5 100644 --- a/org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md +++ b/org.mixedrealitytoolkit.windowsspeech/CHANGELOG.md @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ### Changed +* Made the dependency on com.microsoft.mrtk.tts.windows optional. [PR #1060](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1060) + +## [3.0.4] - 2025-11-12 + +### Changed + * Subsystems no longer register themselves on non-Windows platforms. ### Fixed diff --git a/org.mixedrealitytoolkit.windowsspeech/MRTK.Speech.Windows.asmdef b/org.mixedrealitytoolkit.windowsspeech/MRTK.Speech.Windows.asmdef index f9f01d437..6511ffd96 100644 --- a/org.mixedrealitytoolkit.windowsspeech/MRTK.Speech.Windows.asmdef +++ b/org.mixedrealitytoolkit.windowsspeech/MRTK.Speech.Windows.asmdef @@ -18,6 +18,11 @@ "name": "com.microsoft.mixedreality.openxr", "expression": "1.5.0", "define": "MSFT_OPENXR_1_5_0_OR_NEWER" + }, + { + "name": "com.microsoft.mrtk.tts.windows", + "expression": "", + "define": "MSFT_TTS_WIN_PRESENT" } ], "noEngineReferences": false diff --git a/org.mixedrealitytoolkit.windowsspeech/Subsystems/TextToSpeech/WindowsTextToSpeechSubsystem.cs b/org.mixedrealitytoolkit.windowsspeech/Subsystems/TextToSpeech/WindowsTextToSpeechSubsystem.cs index 64a9e905f..d8ade283a 100644 --- a/org.mixedrealitytoolkit.windowsspeech/Subsystems/TextToSpeech/WindowsTextToSpeechSubsystem.cs +++ b/org.mixedrealitytoolkit.windowsspeech/Subsystems/TextToSpeech/WindowsTextToSpeechSubsystem.cs @@ -2,15 +2,13 @@ // Licensed under the BSD 3-Clause using MixedReality.Toolkit.Subsystems; -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; -using System.Linq; using UnityEngine; using UnityEngine.Scripting; #if WINDOWS_UWP -using Windows.Foundation; +using System; +using System.Linq; using Windows.Media.SpeechSynthesis; using Windows.Storage.Streams; #endif // WINDOWS_UWP @@ -41,7 +39,7 @@ static void Register() // Fetch subsystem metadata from the attribute. var cinfo = XRSubsystemHelpers.ConstructCinfo(); - if (!WindowsTextToSpeechSubsystem.Register(cinfo)) + if (!Register(cinfo)) { Debug.LogError($"Failed to register the {cinfo.Name} subsystem."); } @@ -72,6 +70,7 @@ public override void Start() #endif } + /// public override void Destroy() { #if WINDOWS_UWP @@ -85,7 +84,7 @@ public override void Destroy() #region ITextToSpeechSubsystem implementation -#if !(WINDOWS_UWP || UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) +#if !(WINDOWS_UWP || ((UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) && MSFT_TTS_WIN_PRESENT)) private bool haveLogged = false; #endif @@ -124,7 +123,7 @@ public override async Task TrySpeak(string phrase, AudioSource audioSource sampleRate); audioSource.Play(); - + return true; } @@ -186,17 +185,17 @@ private async Task Synthesize(string phrase) } return waveData; -#elif (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) - return await Task.Run(() => +#elif (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) && MSFT_TTS_WIN_PRESENT + return await Task.Run(() => { - if (!Microsoft.MixedReality.Toolkit.Speech.Windows.WinRTTextToSpeechPInvokes.TrySynthesizePhraseWithCustomVoice(phrase, config.VoiceName, out IntPtr nativeData, out int length)) + if (!Microsoft.MixedReality.Toolkit.Speech.Windows.WinRTTextToSpeechPInvokes.TrySynthesizePhraseWithCustomVoice(phrase, config.VoiceName, out System.IntPtr nativeData, out int length)) { Debug.LogError("Failed to synthesize the phrase"); return null; } byte[] waveData = new byte[length]; - Marshal.Copy(nativeData, waveData, 0, length); + System.Runtime.InteropServices.Marshal.Copy(nativeData, waveData, 0, length); // We can safely free the native data. Microsoft.MixedReality.Toolkit.Speech.Windows.WinRTTextToSpeechPInvokes.FreeSynthesizedData(nativeData); diff --git a/org.mixedrealitytoolkit.windowsspeech/package.json b/org.mixedrealitytoolkit.windowsspeech/package.json index 2f287bb69..ffe43dc7f 100644 --- a/org.mixedrealitytoolkit.windowsspeech/package.json +++ b/org.mixedrealitytoolkit.windowsspeech/package.json @@ -1,6 +1,6 @@ { "name": "org.mixedrealitytoolkit.windowsspeech", - "version": "3.0.4-development", + "version": "3.1.0-development", "description": "Speech subsystem implementation for native Windows speech APIs enables native Windows text-to-speech and speech recognition features, producing events to drive XRI interactions using speech.", "displayName": "MRTK Windows Speech", "msftFeatureCategory": "MRTK3", @@ -17,7 +17,6 @@ "unityRelease": "26f1", "documentationUrl": "https://www.mixedrealitytoolkit.org", "dependencies": { - "com.microsoft.mrtk.tts.windows": "1.0.4", "org.mixedrealitytoolkit.core": "3.2.2" } } \ No newline at end of file