From 0422eee9afcac916d113515071cf4afc8f0670b7 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 13 May 2022 16:38:10 +0200 Subject: [PATCH] SRS - added hints on using Google with TTS --- Moose Development/Moose/Ops/Awacs.lua | 42 ++++++++++++++++++++++----- Moose Development/Moose/Sound/SRS.lua | 8 +++++ 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/Moose Development/Moose/Ops/Awacs.lua b/Moose Development/Moose/Ops/Awacs.lua index b9c4ff1ec..9df72ba30 100644 --- a/Moose Development/Moose/Ops/Awacs.lua +++ b/Moose Development/Moose/Ops/Awacs.lua @@ -463,12 +463,14 @@ AWACS.TaskStatus = { -- TODO - System for Players to VID contacts? And put data into contacst fifo -- TODO - Task reassignment - if a player reject a task, don't choose him again for x minutes -- DEBUG - WIP - Player tasking +-- TODO -- Maybe check in AI only when airborne +-- TODO -- remove SSL tag when not on google (currently sometimes spoken) -- TODO - Localization -- TODO - (LOW) LotATC / IFF --- -- TODO - SW Optimizer -- -- DONE - added SSML tags to make google readouts nicer +-- DONE - 2nd audio queue for priority messages -- DONE - (WIP) Missile launch callout -- DONE - Event detection, Player joining, eject, crash, dead, leaving; AI shot -> DEFEND -- DONE - AI Tasking @@ -1699,8 +1701,13 @@ function AWACS:_CreatePicture(AO,Callsign,GID,MaxEntries,IsGeneral) textScreen = textScreen .. " "..refBRAA.." miles, "..alt.." thousand." -- Alpha Group, Bullseye 021, 16 miles, 25 thousand, else -- pilot reference - refBRAA = coordinate:ToStringBRAANATO(groupcoord,true,true) -- Charlie group, BRAA 045, 105 miles, Angels 41, Flanking, Track North-East, Bogey, Spades. - refBRAATTS = coordinate:ToStringBRAANATO(groupcoord,true,true,true) + refBRAA = coordinate:ToStringBRAANATO(groupcoord,true,true) + refBRAATTS = string.gsub(refBRAA,"BRAA","brah") + refBRAATTS = string.gsub(refBRAATTS,"BRA","brah") + -- Charlie group, BRAA 045, 105 miles, Angels 41, Flanking, Track North-East, Bogey, Spades. + if self.PathToGoogleKey then + refBRAATTS = coordinate:ToStringBRAANATO(groupcoord,true,true,true) + end text = text .. " "..refBRAATTS textScreen = textScreen .." "..refBRAA end @@ -2928,8 +2935,13 @@ function AWACS:_ToStringBR(FromCoordinate,ToCoordinate) local AngleDegrees = UTILS.Round( UTILS.ToDegree( AngleRadians ), 0 ) -- degrees local AngleDegText = string.format("%03d",AngleDegrees) -- 051 - local AngleDegTextTTS = string.format("%s",AngleDegText) + local AngleDegTextTTS = "" + if self.PathToGoogleKey then + AngleDegTextTTS = string.format("%s",AngleDegText) + else + AngleDegTextTTS = string.format("%s",AngleDegText) + end AngleDegText = string.gsub(AngleDegText,"%d","%1 ") -- "0 5 1 " AngleDegText = string.gsub(AngleDegText," $","") -- "0 5 1" @@ -3504,7 +3516,11 @@ function AWACS:_AnnounceContact(Contact,IsNew,Group,IsBogeyDope,Tag,IsPopup,Repo if isGroup then BRAfromBulls = clustercoordinate:ToStringBRAANATO(Group:GetCoordinate(),true,true) - BRAfromBullsTTS = clustercoordinate:ToStringBRAANATO(Group:GetCoordinate(),true,true,true) + BRAfromBullsTTS = string.gsub(BRAfromBulls,"BRAA","brah") + BRAfromBullsTTS = string.gsub(BRAfromBullsTTS,"BRA","brah") + if self.PathToGoogleKey then + BRAfromBullsTTS = clustercoordinate:ToStringBRAANATO(Group:GetCoordinate(),true,true,true) + end end -- "Uzi 1-1, Magic, BRA, 183 for 10 at 2000, hot" @@ -3915,8 +3931,13 @@ function AWACS:_MeldRangeCall(GID,Contact) local contacttag = Contact.TargetGroupNaming if contact and not Contact.MeldCallDone then local position = contact.position -- Core.Point#COORDINATE - if position then - local BRATExt = position:ToStringBRAANATO(flightpos,false,false,true) + if position then + local BRATExt = "" + if self.PathToGoogleKey then + BRATExt = position:ToStringBRAANATO(flightpos,false,false,true) + else + BRATExt = position:ToStringBRAANATO(flightpos,false,false) + end local text = string.format("%s. %s. %s group, %s",self.callsigntxt,pilotcallsign,contacttag,BRATExt) self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true) self:_UpdateContactEngagementTag(Contact.CID,Contact.EngagementTag,true,true,AWACS.TaskStatus.EXECUTING) @@ -3939,7 +3960,12 @@ function AWACS:_ThreatRangeCall(GID,Contact) if contact then local position = contact.position or contact.group:GetCoordinate() -- Core.Point#COORDINATE if position then - local BRATExt = position:ToStringBRAANATO(flightpos,false,false,true) + local BRATExt = "" + if self.PathToGoogleKey then + BRATExt = position:ToStringBRAANATO(flightpos,false,false,true) + else + BRATExt = position:ToStringBRAANATO(flightpos,false,false) + end local text = string.format("%s. %s. %s group, Threat. %s",self.callsigntxt,pilotcallsign,contacttag,BRATExt) self:_NewRadioEntry(text,text,GID,true,self.debug,true,false,true) end diff --git a/Moose Development/Moose/Sound/SRS.lua b/Moose Development/Moose/Sound/SRS.lua index eabaad197..cafb49c7c 100644 --- a/Moose Development/Moose/Sound/SRS.lua +++ b/Moose Development/Moose/Sound/SRS.lua @@ -96,6 +96,14 @@ -- For more information on setting up a cloud account, visit: https://cloud.google.com/text-to-speech -- Google's supported SSML reference: https://cloud.google.com/text-to-speech/docs/ssml -- +-- **NOTE on using GOOGLE TTS with SRS:** You need to have the C# library installed in your SRS folder for Google to work. +-- You can obtain it e.g. here: [NuGet](https://www.nuget.org/packages/Grpc.Core) +-- +-- **Pro-Tipp** - use the command line with power shell to call DCS-SR-ExternalAudio.exe - it will tell you what is missing. +-- and also the Google Console error, in case you have missed a step in setting up your Google TTS. +-- E.g. `.\DCS-SR-ExternalAudio.exe -t "Text Message" -f 255 -m AM -c 2 -s 2 -z -G "Path_To_You_Google.Json"` +-- Plays a message on 255AM for the blue coalition in-game. +-- -- ## Set Voice -- -- Use a specifc voice with the @{#MSRS.SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`.