MSRS changes

This commit is contained in:
Applevangelist 2024-01-09 17:47:14 +01:00
parent b315375ade
commit 30d6936f1d
5 changed files with 27 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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")