diff --git a/Moose Development/Moose/Ops/Awacs.lua b/Moose Development/Moose/Ops/Awacs.lua index 4202e253f..704f52f6f 100644 --- a/Moose Development/Moose/Ops/Awacs.lua +++ b/Moose Development/Moose/Ops/Awacs.lua @@ -1416,6 +1416,7 @@ function AWACS:SetTacticalRadios(BaseFreq,Increase,Modulation,Interval,Number) if self.PathToGoogleKey then --self.TacticalSRS:SetGoogle(self.PathToGoogleKey) self.TacticalSRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey) + self.TacticalSRS:SetProvider(MSRS.Provider.GOOGLE) end self.TacticalSRSQ = MSRSQUEUE:New("Tactical AWACS") end @@ -2104,9 +2105,10 @@ function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey if self.PathToGoogleKey then --self.AwacsSRS:SetGoogle(self.PathToGoogleKey) self.AwacsSRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey) + self.AwacsSRS:SetProvider(MSRS.Provider.GOOGLE) end -- Pre-configured Google? - if self.AwacsSRS:GetProvider() == MSRS.Provider.GOOGLE then + if (not PathToGoogleKey) and self.AwacsSRS:GetProvider() == MSRS.Provider.GOOGLE then self.PathToGoogleKey = MSRS.poptions.gcloud.credentials self.Voice = Voice or MSRS.poptions.gcloud.voice self.AccessKey = AccessKey or MSRS.poptions.gcloud.key @@ -3524,7 +3526,7 @@ function AWACS:_Showtask(Group) local targetstatus = currenttask.Target:GetState() local ToDo = currenttask.ToDo local description = currenttask.ScreenText - local descTTS = currenttask.ScreenText + local descTTS = currenttask.ScreenText local callsign = Callsign if self.debug then @@ -3545,7 +3547,7 @@ function AWACS:_Showtask(Group) local alti = currenttask.Cluster.altitude or currenttask.Contact.altitude or currenttask.Contact.group:GetAltitude() local direction, direcTTS = self:_ToStringBRA(pposition,targetpos,alti) description = description .. "\nBRA "..direction - descTTS = descTTS ..";BRA "..direcTTS + descTTS = descTTS ..";BRA "..direcTTS end elseif currenttask.ToDo == AWACS.TaskDescription.ANCHOR or currenttask.ToDo == AWACS.TaskDescription.REANCHOR then local targetpos = currenttask.Target:GetCoordinate() diff --git a/Moose Development/Moose/Ops/FlightControl.lua b/Moose Development/Moose/Ops/FlightControl.lua index 651c6dc27..d918956e1 100644 --- a/Moose Development/Moose/Ops/FlightControl.lua +++ b/Moose Development/Moose/Ops/FlightControl.lua @@ -411,26 +411,36 @@ function FLIGHTCONTROL:New(AirbaseName, Frequency, Modulation, PathToSRS, Port, self:SetRunwayRepairtime() self.nosubs = false - -- Set SRS Port - self:SetSRSPort(Port or 5002) - -- Set Callsign Options self:SetCallSignOptions(true,true) -- Init msrs queue. self.msrsqueue=MSRSQUEUE:New(self.alias) + -- Init msrs bases + local path = PathToSRS or MSRS.path + local port = Port or MSRS.port or 5002 + + -- Set SRS Port + self:SetSRSPort(port) + -- SRS for Tower. - self.msrsTower=MSRS:New(PathToSRS, Frequency, Modulation) - self.msrsTower:SetPort(self.Port) - self.msrsTower:SetGoogle(GoogleKey) + self.msrsTower=MSRS:New(path, Frequency, Modulation) + self.msrsTower:SetPort(port) + if GoogleKey then + self.msrsTower:SetProviderOptionsGoogle(GoogleKey,GoogleKey) + self.msrsTower:SetProvider(MSRS.Provider.GOOGLE) + end self.msrsTower:SetCoordinate(self:GetCoordinate()) self:SetSRSTower() -- SRS for Pilot. self.msrsPilot=MSRS:New(PathToSRS, Frequency, Modulation) self.msrsPilot:SetPort(self.Port) - self.msrsPilot:SetGoogle(GoogleKey) + if GoogleKey then + self.msrsPilot:SetProviderOptionsGoogle(GoogleKey,GoogleKey) + self.msrsPilot:SetProvider(MSRS.Provider.GOOGLE) + end self.msrsTower:SetCoordinate(self:GetCoordinate()) self:SetSRSPilot() @@ -633,7 +643,6 @@ function FLIGHTCONTROL:_SetSRSOptions(msrs, Gender, Culture, Voice, Volume, Labe msrs:SetVoice(Voice) msrs:SetVolume(Volume) msrs:SetLabel(Label) - msrs:SetGoogle(PathToGoogleCredentials) msrs:SetCoalition(self:GetCoalition()) msrs:SetPort(Port or self.Port or 5002) end @@ -648,12 +657,11 @@ end -- @param #string Voice Specific voice. Overrides `Gender` and `Culture`. See [Google Voices](https://cloud.google.com/text-to-speech/docs/voices). -- @param #number Volume Volume. Default 1.0. -- @param #string Label Name under which SRS transmits. Default `self.alias`. --- @param #string PathToGoogleCredentials Path to google credentials json file. -- @return #FLIGHTCONTROL self -function FLIGHTCONTROL:SetSRSTower(Gender, Culture, Voice, Volume, Label, PathToGoogleCredentials) +function FLIGHTCONTROL:SetSRSTower(Gender, Culture, Voice, Volume, Label) if self.msrsTower then - self:_SetSRSOptions(self.msrsTower, Gender or "female", Culture or "en-GB", Voice, Volume, Label or self.alias, PathToGoogleCredentials) + self:_SetSRSOptions(self.msrsTower, Gender or "female", Culture or "en-GB", Voice, Volume, Label or self.alias) end return self @@ -666,12 +674,11 @@ end -- @param #string Voice Specific voice. Overrides `Gender` and `Culture`. -- @param #number Volume Volume. Default 1.0. -- @param #string Label Name under which SRS transmits. Default "Pilot". --- @param #string PathToGoogleCredentials Path to google credentials json file. -- @return #FLIGHTCONTROL self -function FLIGHTCONTROL:SetSRSPilot(Gender, Culture, Voice, Volume, Label, PathToGoogleCredentials) +function FLIGHTCONTROL:SetSRSPilot(Gender, Culture, Voice, Volume, Label) if self.msrsPilot then - self:_SetSRSOptions(self.msrsPilot, Gender or "male", Culture or "en-US", Voice, Volume, Label or "Pilot", PathToGoogleCredentials) + self:_SetSRSOptions(self.msrsPilot, Gender or "male", Culture or "en-US", Voice, Volume, Label or "Pilot") end return self @@ -876,7 +883,7 @@ end --- Set ATIS. -- @param #FLIGHTCONTROL self --- @param Ops.ATIS#ATIS ATIS ATIS. +-- @param Ops.ATIS#ATIS Atis ATIS. -- @return #FLIGHTCONTROL self function FLIGHTCONTROL:SetATIS(Atis) self.atis=Atis diff --git a/Moose Development/Moose/Ops/OpsGroup.lua b/Moose Development/Moose/Ops/OpsGroup.lua index 1566e6634..fb9162521 100644 --- a/Moose Development/Moose/Ops/OpsGroup.lua +++ b/Moose Development/Moose/Ops/OpsGroup.lua @@ -2314,14 +2314,17 @@ end -- @return #OPSGROUP self function OPSGROUP:SetSRS(PathToSRS, Gender, Culture, Voice, Port, PathToGoogleKey, Label, Volume) self.useSRS=true - self.msrs=MSRS:New(PathToSRS, self.frequency, self.modulation) + local path = PathToSRS or MSRS.path + local port = Port or MSRS.port + self.msrs=MSRS:New(path, self.frequency, self.modulation) self.msrs:SetGender(Gender) self.msrs:SetCulture(Culture) self.msrs:SetVoice(Voice) - self.msrs:SetPort(Port) + self.msrs:SetPort(port) self.msrs:SetLabel(Label) if PathToGoogleKey then - self.msrs:SetGoogle(PathToGoogleKey) + self.msrs:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey) + self.msrs:SetProvider(MSRS.Provider.GOOGLE) end self.msrs:SetCoalition(self:GetCoalition()) self.msrs:SetVolume(Volume) diff --git a/Moose Development/Moose/Ops/PlayerRecce.lua b/Moose Development/Moose/Ops/PlayerRecce.lua index 5a87c3be1..7cac793b1 100644 --- a/Moose Development/Moose/Ops/PlayerRecce.lua +++ b/Moose Development/Moose/Ops/PlayerRecce.lua @@ -1517,7 +1517,13 @@ function PLAYERRECCE:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,V self.SRS:SetVoice(self.Voice) self.SRS:SetVolume(self.Volume) if self.PathToGoogleKey then - self.SRS:SetGoogle(self.PathToGoogleKey) + self.SRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.PathToGoogleKey) + self.SRS:SetProvider(MSRS.Provider.GOOGLE) + end + -- Pre-configured Google? + if (not PathToGoogleKey) and self.AwacsSRS:GetProvider() == MSRS.Provider.GOOGLE then + self.PathToGoogleKey = MSRS.poptions.gcloud.credentials + self.Voice = Voice or MSRS.poptions.gcloud.voice end self.SRSQueue = MSRSQUEUE:New(self.MenuName or self.Name) self.SRSQueue:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers) diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index 855b954ca..0b95512e4 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -4034,9 +4034,10 @@ function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Cultu if self.PathToGoogleKey then --self.SRS:SetGoogle(self.PathToGoogleKey) self.SRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey) + self.SRS:SetProvider(MSRS.Provider.GOOGLE) end -- Pre-configured Google? - if self.SRS:GetProvider() == MSRS.Provider.GOOGLE then + if (not PathToGoogleKey) and self.SRS:GetProvider() == MSRS.Provider.GOOGLE then self.PathToGoogleKey = MSRS.poptions.gcloud.credentials self.Voice = Voice or MSRS.poptions.gcloud.voice self.AccessKey = AccessKey or MSRS.poptions.gcloud.key