From 30d6936f1d24afbe8336a2fc7bb6a7b21fa03cdb Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 9 Jan 2024 17:47:14 +0100 Subject: [PATCH] MSRS changes --- Moose Development/Moose/Functional/AICSAR.lua | 23 ++++++++++--------- .../Moose/Functional/Autolase.lua | 13 ++++++----- Moose Development/Moose/Functional/Range.lua | 6 +++-- Moose Development/Moose/Ops/Airboss.lua | 3 ++- Moose Development/Moose/Ops/CSAR.lua | 3 ++- 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Moose Development/Moose/Functional/AICSAR.lua b/Moose Development/Moose/Functional/AICSAR.lua index 2dedc74c2..a05f47127 100644 --- a/Moose Development/Moose/Functional/AICSAR.lua +++ b/Moose Development/Moose/Functional/AICSAR.lua @@ -527,7 +527,7 @@ end --- [User] Switch sound output on and use SRS output for sound files. -- @param #AICSAR self -- @param #boolean OnOff Switch on (true) or off (false). --- @param #string Path Path to your SRS Server Component, e.g. "E:\\\\Program Files\\\\DCS-SimpleRadio-Standalone" +-- @param #string Path Path to your SRS Server Component, e.g. "C:\\\\Program Files\\\\DCS-SimpleRadio-Standalone" -- @param #number Frequency Defaults to 243 (guard) -- @param #number Modulation Radio modulation. Defaults to radio.modulation.AM -- @param #string SoundPath Where to find the audio files. Defaults to nil, i.e. add messages via "Sound to..." in the Mission Editor. @@ -538,13 +538,13 @@ function AICSAR:SetSRSRadio(OnOff,Path,Frequency,Modulation,SoundPath,Port) self.SRSRadio = OnOff and true self.SRSTTSRadio = false self.SRSFrequency = Frequency or 243 - self.SRSPath = Path or "c:\\" + self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" self.SRS:SetLabel("ACSR") self.SRS:SetCoalition(self.coalition) self.SRSModulation = Modulation or radio.modulation.AM local soundpath = os.getenv('TMP') .. "\\DCS\\Mission\\l10n\\DEFAULT" -- defaults to "l10n/DEFAULT/", i.e. add messages by "Sound to..." in the ME self.SRSSoundPath = SoundPath or soundpath - self.SRSPort = Port or 5002 + self.SRSPort = Port or MSRS.port or 5002 if OnOff then self.SRS = MSRS:New(Path,Frequency,Modulation) self.SRS:SetPort(self.SRSPort) @@ -570,11 +570,11 @@ function AICSAR:SetSRSTTSRadio(OnOff,Path,Frequency,Modulation,Port,Voice,Cultur self.SRSTTSRadio = OnOff and true self.SRSRadio = false self.SRSFrequency = Frequency or 243 - self.SRSPath = Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" + self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" self.SRSModulation = Modulation or radio.modulation.AM - self.SRSPort = Port or 5002 + self.SRSPort = Port or MSRS.port or 5002 if OnOff then - self.SRS = MSRS:New(Path,Frequency,Modulation) + self.SRS = MSRS:New(self.SRSPath,Frequency,Modulation) self.SRS:SetPort(self.SRSPort) self.SRS:SetCoalition(self.coalition) self.SRS:SetLabel("ACSR") @@ -582,7 +582,8 @@ function AICSAR:SetSRSTTSRadio(OnOff,Path,Frequency,Modulation,Port,Voice,Cultur self.SRS:SetCulture(Culture) self.SRS:SetGender(Gender) if GoogleCredentials then - self.SRS:SetGoogle(GoogleCredentials) + self.SRS:SetProviderOptionsGoogle(GoogleCredentials,GoogleCredentials) + self.SRS:SetProvider(MSRS.Provider.GOOGLE) self.SRSGoogle = true end self.SRSQ = MSRSQUEUE:New(self.alias) @@ -608,8 +609,8 @@ function AICSAR:SetPilotTTSVoice(Voice,Culture,Gender) self.SRSPilot:SetLabel("PILOT") if self.SRSGoogle then local poptions = self.SRS:GetProviderOptions(MSRS.Provider.GOOGLE) -- Sound.SRS#MSRS.ProviderOptions - self.SRSPilot:SetGoogle(poptions.credentials) - self.SRSPilot:SetGoogleAPIKey(poptions.key) + self.SRSPilot:SetProviderOptionsGoogle(poptions.credentials,poptions.key) + self.SRSPilot:SetProvider(MSRS.Provider.GOOGLE) end return self end @@ -632,8 +633,8 @@ function AICSAR:SetOperatorTTSVoice(Voice,Culture,Gender) self.SRSOperator:SetLabel("RESCUE") if self.SRSGoogle then local poptions = self.SRS:GetProviderOptions(MSRS.Provider.GOOGLE) -- Sound.SRS#MSRS.ProviderOptions - self.SRSOperator:SetGoogle(poptions.credentials) - self.SRSOperator:SetGoogleAPIKey(poptions.key) + self.SRSOperator:SetProviderOptionsGoogle(poptions.credentials,poptions.key) + self.SRSOperator:SetProvider(MSRS.Provider.GOOGLE) end return self end diff --git a/Moose Development/Moose/Functional/Autolase.lua b/Moose Development/Moose/Functional/Autolase.lua index 735706150..e4672fccc 100644 --- a/Moose Development/Moose/Functional/Autolase.lua +++ b/Moose Development/Moose/Functional/Autolase.lua @@ -451,12 +451,12 @@ end function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey) if OnOff then self.useSRS = true - self.SRSPath = Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" + self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone" self.SRSFreq = Frequency or 271 self.SRSMod = Modulation or radio.modulation.AM - self.Gender = Gender or "male" - self.Culture = Culture or "en-US" - self.Port = Port or 5002 + self.Gender = Gender or MSRS.gender or "male" + self.Culture = Culture or MSRS.culture or "en-US" + self.Port = Port or MSRS.port or 5002 self.Voice = Voice self.PathToGoogleKey = PathToGoogleKey self.Volume = Volume or 1.0 @@ -470,9 +470,10 @@ function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Cultu self.SRS:SetPort(self.Port) self.SRS:SetVoice(self.Voice) self.SRS:SetCoalition(self.coalition) - self.SRS:SetVolume(Volume) + self.SRS:SetVolume(self.Volume) if self.PathToGoogleKey then - self.SRS:SetGoogle(self.PathToGoogleKey) + self.SRS:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey) + self.SRS:SetProvider(MSRS.Provider.GOOGLE) end self.SRSQueue = MSRSQUEUE:New(self.alias) else diff --git a/Moose Development/Moose/Functional/Range.lua b/Moose Development/Moose/Functional/Range.lua index 3019fe29c..bcc11cfd1 100644 --- a/Moose Development/Moose/Functional/Range.lua +++ b/Moose Development/Moose/Functional/Range.lua @@ -1226,8 +1226,10 @@ function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume, self.instructsrsQ = MSRSQUEUE:New("INSTRUCT") if PathToGoogleKey then - self.controlmsrs:SetGoogle(PathToGoogleKey) - self.instructmsrs:SetGoogle(PathToGoogleKey) + self.controlmsrs:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey) + self.controlmsrs:SetProvider(MSRS.Provider.GOOGLE) + self.instructmsrs:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey) + self.instructmsrs:SetProvider(MSRS.Provider.GOOGLE) end else diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 28ccad0c9..d19a05e6e 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -3075,7 +3075,8 @@ function AIRBOSS:EnableSRS(PathToSRS,Port,Culture,Gender,Voice,GoogleCreds,Volum self.SRS:SetVolume(Volume) --self.SRS:SetModulations(Modulations) if GoogleCreds then - self.SRS:SetGoogle(GoogleCreds) + self.SRS:SetProviderOptionsGoogle(GoogleCreds,GoogleCreds) + self.SRS:SetProvider(MSRS.Provider.GOOGLE) end if Voice then self.SRS:SetVoice(Voice) diff --git a/Moose Development/Moose/Ops/CSAR.lua b/Moose Development/Moose/Ops/CSAR.lua index 147b742f8..22cf439f0 100644 --- a/Moose Development/Moose/Ops/CSAR.lua +++ b/Moose Development/Moose/Ops/CSAR.lua @@ -2310,7 +2310,8 @@ function CSAR:onafterStart(From, Event, To) self.msrs:SetVoice(self.SRSVoice) self.msrs:SetGender(self.SRSGender) if self.SRSGPathToCredentials then - self.msrs:SetGoogle(self.SRSGPathToCredentials) + self.msrs:SetProviderOptionsGoogle(self.SRSGPathToCredentials,self.SRSGPathToCredentials) + self.msrs:SetProvider(MSRS.Provider.GOOGLE) end self.msrs:SetVolume(self.SRSVolume) self.msrs:SetLabel("CSAR")