Merge remote-tracking branch 'origin/master-ng' into branch

# Conflicts:
#	Moose Development/Moose/Sound/SRS.lua
This commit is contained in:
Applevangelist
2026-03-07 12:08:24 +01:00
11 changed files with 137 additions and 71 deletions
@@ -579,8 +579,9 @@ end
-- @param #string Culture (Optional) The culture to be used, defaults to "en-GB"
-- @param #string Gender (Optional) The gender to be used, defaults to "male"
-- @param #string GoogleCredentials (Optional) Path to google credentials
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #AICSAR self
function AICSAR:SetSRSTTSRadio(OnOff,Path,Frequency,Modulation,Port,Voice,Culture,Gender,GoogleCredentials)
function AICSAR:SetSRSTTSRadio(OnOff,Path,Frequency,Modulation,Port,Voice,Culture,Gender,GoogleCredentials,Provider)
self:T(self.lid .. "SetSRSTTSRadio")
self.SRSTTSRadio = OnOff and true
self.SRSRadio = false
@@ -596,11 +597,14 @@ function AICSAR:SetSRSTTSRadio(OnOff,Path,Frequency,Modulation,Port,Voice,Cultur
self.SRS:SetVoice(Voice)
self.SRS:SetCulture(Culture)
self.SRS:SetGender(Gender)
if GoogleCredentials then
if GoogleCredentials and not Provider then
self.SRS:SetProviderOptionsGoogle(GoogleCredentials,GoogleCredentials)
self.SRS:SetProvider(MSRS.Provider.GOOGLE)
self.SRSGoogle = true
end
if Provider then
self.SRS:SetProvider(Provider)
end
self.SRSQ = MSRSQUEUE:New(self.alias)
end
return self
@@ -502,10 +502,11 @@ end
-- @param #number Port (Optional) Defaults to 5002
-- @param #string Voice (Optional) Use a specifc voice with the @{Sound.SRS#SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`.
-- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.
-- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest)
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS
-- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest).
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS.
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #AUTOLASE self
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey)
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,Provider)
if OnOff then
self.useSRS = true
self.SRSPath = Path or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
@@ -528,10 +529,13 @@ function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Cultu
self.SRS:SetVoice(self.Voice)
self.SRS:SetCoalition(self.coalition)
self.SRS:SetVolume(self.Volume)
if self.PathToGoogleKey then
if self.PathToGoogleKey and not Provider then
self.SRS:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey)
self.SRS:SetProvider(MSRS.Provider.GOOGLE)
end
if Provider then
self.SRS:SetProvider(Provider)
end
self.SRSQueue = MSRSQUEUE:New(self.alias)
else
self.useSRS = false
+6 -2
View File
@@ -1258,8 +1258,9 @@ end
-- @param #number Modulation (Optional) Modulation to use, defaults to radio.modulation.AM
-- @param #number Volume (Optional) Volume, between 0.0 and 1.0. Defaults to 1.0
-- @param #string PathToGoogleKey Path to Google TTS credentials.
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #RANGE self
function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume, PathToGoogleKey)
function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume, PathToGoogleKey,Provider)
if PathToSRS or MSRS.path then
@@ -1291,7 +1292,10 @@ function RANGE:SetSRS(PathToSRS, Port, Coalition, Frequency, Modulation, Volume,
self.instructmsrs:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey)
self.instructmsrs:SetProvider(MSRS.Provider.GOOGLE)
end
if Provider then
self.controlmsrs:SetProvider(Provider)
self.instructmsrs:SetProvider(Provider)
end
else
self:E(self.lid..string.format("ERROR: No SRS path specified!"))
end
+6 -2
View File
@@ -1672,9 +1672,10 @@ end
-- @param #string Culture (Optional) Culture, e.g. "en-GB" (default).
-- @param #string Voice (Optional) Specific voice. Overrides `Gender` and `Culture`.
-- @param #number Port (Optional) SRS port. Default 5002.
-- @param #string GoogleKey Path to Google JSON-Key (SRS exe backend) or Google API key (DCS-gRPC backend).
-- @param #string GoogleKey (Optional) Path to Google JSON-Key (SRS exe backend) or Google API key (DCS-gRPC backend).
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #ATIS self
function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port, GoogleKey)
function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port, GoogleKey,Provider)
--if PathToSRS or MSRS.path then
self.useSRS=true
@@ -1700,6 +1701,9 @@ function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port, GoogleKey)
end
self.msrs:SetVoice(voice)
self.msrs:SetCoordinate(self.airbase:GetCoordinate())
if Provider then
self.msrs:SetProvider(Provider)
end
self.msrsQ = MSRSQUEUE:New("ATIS")
self.msrsQ:SetTransmitOnlyWithPlayers(self.TransmitOnlyWithPlayers)
if self.dTQueueCheck<=10 then
+11 -3
View File
@@ -1415,11 +1415,12 @@ end
-- @param #number Modulation (Optional) Modulation to use, defaults to radio.modulation.AM.
-- @param #number Interval Seconds between each update call.
-- @param #number Number Number of Frequencies to create, can be 1..10.
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #AWACS self
function AWACS:SetTacticalRadios(BaseFreq,Increase,Modulation,Interval,Number)
function AWACS:SetTacticalRadios(BaseFreq,Increase,Modulation,Interval,Number,Provider)
self:T(self.lid.."SetTacticalRadios")
if not self.AwacsSRS then
MESSAGE:New("AWACS: Setup SRS in your code BEFORE trying to add tac radios please!",30,"ERROR",true):ToLog():ToAll()
MESSAGE:New("AWACS: Setup SRS in your code BEFORE trying to add tactical radios please!",30,"ERROR",true):ToLog():ToAll()
return self
end
self.TacticalMenu = true
@@ -1448,6 +1449,9 @@ function AWACS:SetTacticalRadios(BaseFreq,Increase,Modulation,Interval,Number)
self.TacticalSRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey)
self.TacticalSRS:SetProvider(MSRS.Provider.GOOGLE)
end
if Provider then
self.TacticalSRS:SetProvider(Provider)
end
self.TacticalSRSQ = MSRSQUEUE:New("Tactical AWACS")
end
return self
@@ -2186,8 +2190,9 @@ end
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS; if you use a config file for MSRS, hand in nil here.
-- @param #string AccessKey (Optional) Your Google API access key. This is necessary if DCS-gRPC is used as backend; if you use a config file for MSRS, hand in nil here.
-- @param #string Backend (Optional) Your MSRS Backend if different from your config file settings, e.g. MSRS.Backend.SRSEXE or MSRS.Backend.GRPC
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #AWACS self
function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Backend)
function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Backend,Provider)
self:T(self.lid.."SetSRS")
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio"
self.Gender = Gender or MSRS.gender or "male"
@@ -2210,6 +2215,9 @@ function AWACS:SetSRS(PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey
--self.AwacsSRS:SetGoogle(self.PathToGoogleKey)
self.AwacsSRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.AccessKey)
self.AwacsSRS:SetProvider(MSRS.Provider.GOOGLE)
end
if Provider then
self.AwacsSRS:SetProvider(Provider)
end
-- Pre-configured Google?
if (not PathToGoogleKey) and self.AwacsSRS:GetProvider() == MSRS.Provider.GOOGLE then
+42 -23
View File
@@ -200,7 +200,7 @@ do
-- my_ctld.loadSavedCrates = true -- Load back crates (STATIC) from the save file. Useful for mission restart cleanup. (Default is true)
-- my_ctld.UseC130LoadAndUnload = false -- When set to true, forces the C-130 player to use the C-130J built system to load the cargo onboard and to unload. (Default is false)
-- my_ctld.UseC130DynamicCargoAutoBuild = false -- When true (and UseC130LoadAndUnload is true), C-130 DynamicCargo unload completion is bridged to CTLD engineer-path auto-build.
-- my_ctld.C130DynamicCargoAutoBuildMergeSeconds = 10 -- Merge window in seconds for C-130 auto-build handoff; ready sets from same C-130 are batched into one engineer build call.
-- my_ctld.C130DynamicCargoAutoBuildMergeSeconds = 0 -- Merge window in seconds for C-130 auto-build handoff; set to 0 to disable batching (default).
-- my_ctld.locale = "en" -- Language locale to use, available are "en" (default), "de" and "fr"
--
-- ## 2.1 CH-47 Chinook support
@@ -253,7 +253,7 @@ do
-- After a valid airdrop and landing, CTLD automatically starts the build.
--
-- If multiple compatible cargo sets are dropped close together, CTLD waits briefly
-- (10 seconds by default) and then processes them together.
-- and then processes them together (C130DynamicCargoAutoBuildMergeSeconds; default 0 = no merge delay).
--
-- ### Required settings
--
@@ -722,7 +722,7 @@ CTLD = {
pickupZones = {},
DynamicCargo = {},
UseC130DynamicCargoAutoBuild = false,
C130DynamicCargoAutoBuildMergeSeconds = 10,
C130DynamicCargoAutoBuildMergeSeconds = 0,
ChinookTroopCircleRadius = 5,
TroopUnloadDistGround = 5,
TroopUnloadDistGroundHerc = 25,
@@ -1096,7 +1096,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
self.UseC130DynamicCargoAutoBuild = false
-- merge ready C-130 auto-build sets from the same aircraft for this many seconds.
self.C130DynamicCargoAutoBuildMergeSeconds = 10
self.C130DynamicCargoAutoBuildMergeSeconds = 0
-- Smokes and Flares
self.SmokeColor = SMOKECOLOR.Red
@@ -2273,7 +2273,7 @@ function CTLD:_C130DcAutoQueueReadySet(SetId)
if setData.completed or setData.buildStarted or setData.handoffClaimed then return true end
local ownerKey = self:_C130DcAutoGetOwnerKey(setData) or SetId
local window = tonumber(self.C130DynamicCargoAutoBuildMergeSeconds) or 10
local window = self.C130DynamicCargoAutoBuildMergeSeconds or 0
if window < 0 then
window = 0
end
@@ -2671,9 +2671,11 @@ function CTLD:_EventHandler(EventData)
self.Loaded_Cargo[unitname] = loaded
end
local Group = client:GetGroup()
if not self:IsC130J(client, true) then
local msg = self.gettext:GetEntry("CRATE_UNLOADED_GROUNDCREW",self.locale)
msg = string.format(msg,event.IniDynamicCargoName)
self:_SendMessage(msg, 10, false, Group)
end
--self:_SendMessage(string.format("Crate %s unloaded by ground crew!",event.IniDynamicCargoName), 10, false, Group)
self:__CratesDropped(1,Group,client,{dcargo})
self:_RefreshCrateQuantityMenus(Group, client, nil)
@@ -5331,6 +5333,7 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop,NotifyGroup)
end
local crates,number = self:_FindCratesNearby(Group,Unit,finddist,true,true,not Engineering) -- #table
local activeSetId = Engineering and self._c130DcAutoActiveSetId or nil
local isC130Auto = Engineering and activeSetId ~= nil
local notifyGroup = (not Engineering) and Group or nil
if activeSetId then
crates, number = self:_C130DcAutoFilterCrates(crates, activeSetId)
@@ -5417,6 +5420,7 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop,NotifyGroup)
end -- end dropped
end -- end crate loop
-- ok let\'s list what we have
if not isC130Auto then
local report = REPORT:New("Checklist Buildable Crates")
report:Add("------------------------------------------------------------")
for _,_build in pairs(buildables) do
@@ -5446,9 +5450,32 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop,NotifyGroup)
else
self:T(text)
end
end
-- let\'s get going
if canbuild then
local notified=false
local function notifyBuildStarted(buildName, etaSeconds)
if notified then return end
local startMsgGroup = (not Engineering and (notifyGroup or Group)) or notifyGroup
if isC130Auto then
if startMsgGroup then
local msg
if etaSeconds and etaSeconds > 0 then
msg = string.format("CTLD: Building %s (ETA %ds).", tostring(buildName), math.floor(etaSeconds))
else
msg = string.format("CTLD: Building %s.", tostring(buildName))
end
self:_SendMessage(msg, 15, false, startMsgGroup)
end
else
local msg = self.gettext:GetEntry("BUILD_STARTED",self.locale)
msg = string.format(msg,self.buildtime)
if startMsgGroup then
self:_SendMessage(msg, 15, false, startMsgGroup)
end
end
notified=true
end
-- loop again
for _,_build in pairs(buildables) do
local build = _build -- #CTLD.Buildable
@@ -5473,16 +5500,13 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop,NotifyGroup)
if self.buildtime and self.buildtime > 0 then
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,build,false,Group:GetCoordinate(),MultiDrop)
buildtimer:Start(self.buildtime)
if not notified then
local msg = self.gettext:GetEntry("BUILD_STARTED",self.locale)
msg = string.format(msg,self.buildtime)
local startMsgGroup = (not Engineering and (notifyGroup or Group)) or notifyGroup
self:_SendMessage(msg, 15, false, startMsgGroup)
--self:_SendMessage(string.format("Build started, ready in %d seconds!",self.buildtime),15,false,Group)
notified=true
end
notifyBuildStarted(build.Name, self.buildtime)
self:__CratesBuildStarted(1,Group,Unit,build.Name)
else
if isC130Auto then
notifyBuildStarted(build.Name, nil)
end
self:_BuildObjectFromCrates(Group,Unit,build,false,nil,MultiDrop)
end
else
@@ -5500,18 +5524,13 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop,NotifyGroup)
if self.buildtime and self.buildtime > 0 then
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,b,false,Group:GetCoordinate(),MultiDrop)
buildtimer:Start(self.buildtime)
if not notified then
local msg = self.gettext:GetEntry("BUILD_STARTED",self.locale)
msg = string.format(msg,self.buildtime)
local startMsgGroup = (not Engineering and (notifyGroup or Group)) or notifyGroup
if startMsgGroup then
self:_SendMessage(msg, 15, false, startMsgGroup)
end
--self:_SendMessage(string.format("Build started, ready in %d seconds!",self.buildtime),15,false,Group)
notified=true
end
notifyBuildStarted(build.Name, self.buildtime)
self:__CratesBuildStarted(1,Group,Unit,build.Name)
else
if isC130Auto then
notifyBuildStarted(build.Name, nil)
end
self:_BuildObjectFromCrates(Group,Unit,b,false,nil,MultiDrop)
end
end
@@ -364,8 +364,9 @@ FLIGHTCONTROL.version="0.7.7"
-- @param #string PathToSRS (Optional) Path to the directory, where SRS is located.
-- @param #number Port (Optional) Port of SRS Server, defaults to 5002
-- @param #string GoogleKey (Optional) Path to the Google JSON-Key.
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #FLIGHTCONTROL self
function FLIGHTCONTROL:New(AirbaseName, Frequency, Modulation, PathToSRS, Port, GoogleKey)
function FLIGHTCONTROL:New(AirbaseName, Frequency, Modulation, PathToSRS, Port, GoogleKey,Provider)
-- Inherit everything from FSM class.
local self=BASE:Inherit(self, FSM:New()) -- #FLIGHTCONTROL
@@ -436,6 +437,9 @@ function FLIGHTCONTROL:New(AirbaseName, Frequency, Modulation, PathToSRS, Port,
if GoogleKey then
self.msrsTower:SetProviderOptionsGoogle(GoogleKey,GoogleKey)
self.msrsTower:SetProvider(MSRS.Provider.GOOGLE)
end
if Provider then
self.msrsTower:SetProvider(Provider)
end
self.msrsTower:SetCoordinate(self:GetCoordinate())
self:SetSRSTower()
@@ -446,6 +450,9 @@ function FLIGHTCONTROL:New(AirbaseName, Frequency, Modulation, PathToSRS, Port,
if GoogleKey then
self.msrsPilot:SetProviderOptionsGoogle(GoogleKey,GoogleKey)
self.msrsPilot:SetProvider(MSRS.Provider.GOOGLE)
end
if Provider then
self.msrsPilot:SetProvider(Provider)
end
self.msrsTower:SetCoordinate(self:GetCoordinate())
self:SetSRSPilot()
+5 -1
View File
@@ -2355,8 +2355,9 @@ end
-- @param #string PathToGoogleKey (Optional) Full path to the google credentials JSON file, e.g. `"C:\Users\myUsername\Downloads\key.json"`.
-- @param #string Label (Optional) Label of the SRS comms for the SRS Radio overlay. Defaults to "ROBOT". No spaces allowed!
-- @param #number Volume (Optional) Volume to be set, 0.0 = silent, 1.0 = loudest. Defaults to 1.0
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #OPSGROUP self
function OPSGROUP:SetSRS(PathToSRS, Gender, Culture, Voice, Port, PathToGoogleKey, Label, Volume)
function OPSGROUP:SetSRS(PathToSRS, Gender, Culture, Voice, Port, PathToGoogleKey, Label, Volume,Provider)
self.useSRS=true
local path = PathToSRS or MSRS.path
local port = Port or MSRS.port
@@ -2370,6 +2371,9 @@ function OPSGROUP:SetSRS(PathToSRS, Gender, Culture, Voice, Port, PathToGoogleKe
self.msrs:SetProviderOptionsGoogle(PathToGoogleKey,PathToGoogleKey)
self.msrs:SetProvider(MSRS.Provider.GOOGLE)
end
if Provider then
self.msrs:SetProvider(Provider)
end
self.msrs:SetCoalition(self:GetCoalition())
self.msrs:SetVolume(Volume)
return self
+6 -2
View File
@@ -1552,9 +1552,10 @@ end
-- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.
-- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest)
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS
-- @param #string Backend (optional) Backend to be used, can be MSRS.Backend.SRSEXE or MSRS.Backend.GRPC
-- @param #string Backend (optional) Backend to be used, can be MSRS.Backend.SRSEXE or MSRS.Backend.GRPC etc
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #PLAYERRECCE self
function PLAYERRECCE:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,Backend)
function PLAYERRECCE:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,Backend,Provider)
self:T(self.lid.."SetSRS")
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio" --
self.Gender = Gender or MSRS.gender or "male" --
@@ -1582,6 +1583,9 @@ function PLAYERRECCE:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,V
if self.PathToGoogleKey then
self.SRS:SetProviderOptionsGoogle(self.PathToGoogleKey,self.PathToGoogleKey)
self.SRS:SetProvider(MSRS.Provider.GOOGLE)
end
if Provider then
self.SRS:SetProvider(Provider)
end
-- Pre-configured Google?
if (not PathToGoogleKey) and self.SRS:GetProvider() == MSRS.Provider.GOOGLE then
+7 -3
View File
@@ -4908,11 +4908,12 @@ end
-- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.
-- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest)
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS; if you use a config file for MSRS, hand in nil here.
-- @param #string AccessKey (Optional) Your Google API access key. This is necessary if DCS-gRPC is used as backend; if you use a config file for MSRS, hand in nil here.
-- @param #string AccessKey (Optional) Your Google API access key. This is necessary if DCS-gRPC is used as backend; if you use a config file for MSRS, you can hand in nil here.
-- @param Core.Point#COORDINATE Coordinate (Optional) Coordinate from which the controller radio is sending
-- @param #string Backend (Optional) MSRS Backend to be used, can be MSRS.Backend.SRSEXE or MSRS.Backend.GRPC; if you use a config file for MSRS, hand in nil here.
-- @param #string Backend (Optional) MSRS Backend to be used, can be MSRS.Backend.SRSEXE or MSRS.Backend.GRPC; if you use a config file for MSRS, you can hand in nil here.
-- @param #string Provider (Optional) TTS Provider to be used.
-- @return #PLAYERTASKCONTROLLER self
function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Coordinate,Backend)
function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Culture,Port,Voice,Volume,PathToGoogleKey,AccessKey,Coordinate,Backend,Provider)
self:T(self.lid.."SetSRS")
self.PathToSRS = PathToSRS or MSRS.path or "C:\\Program Files\\DCS-SimpleRadio-Standalone\\ExternalAudio" --
self.Gender = Gender or MSRS.gender or "male" --
@@ -4946,6 +4947,9 @@ function PLAYERTASKCONTROLLER:SetSRS(Frequency,Modulation,PathToSRS,Gender,Cultu
self.Voice = Voice or MSRS.poptions.gcloud.voice
self.AccessKey = AccessKey or MSRS.poptions.gcloud.key
end
if Provider then
self.SRS:SetProvider(Provider)
end
if Coordinate then
self.SRS:SetCoordinate(Coordinate)
end
+32 -28
View File
@@ -1199,13 +1199,13 @@ function MSRS:SetVoicePiper(Voice)
return self
end
--- Set to use a specific voice if Kitten is used as provider (only Hound-TTS backend). Note that this will override any gender and culture settings.
--- Set to use a specific speaker for a voice if Piper is used as provider (only Hound-TTS backend).
-- @param #MSRS self
-- @param #string Voice (Optional) [Kitten Voices](https://github.com/uriba107/HoundTTS#installation). Default `"Bella"`.
-- @param #string Speaker (Optional) [Piper Voices](https://rhasspy.github.io/piper-samples/). Some have speakers as sub-voices.
-- @return #MSRS self
function MSRS:SetVoiceKitten(Voice)
self:F( {Voice=Voice} )
self:SetVoiceProvider(Voice or "Bella", MSRS.Provider.KITTEN)
function MSRS:SetSpeakerPiper(Speaker)
self:F( {Speaker=Speaker} )
self.Speaker = Speaker
return self
end
@@ -1591,14 +1591,16 @@ function MSRS:PlayText(Text, Delay, Coordinate, Speed, Speaker)
self:ScheduleOnce(Delay, MSRS.PlayText, self, Text, nil, Coordinate, Speed, Speaker)
else
if self.backend==MSRS.Backend.GRPC then
self:T(self.lid.."Transmitting")
self:_DCSgRPCtts(Text, nil, nil , nil, nil, nil, nil, Coordinate)
elseif self.backend==MSRS.Backend.HOUND then
self:_HoundTextToSpeech(Text,nil,nil,nil,nil,nil,Coordinate,Speed,nil,Speaker)
else
self:PlayTextExt(Text, Delay, nil, nil, nil, nil, nil, nil, nil, Coordinate, Speed, Speaker)
end
local speaker = Speaker or self.Speaker
if self.backend==MSRS.Backend.GRPC then
self:T(self.lid.."Transmitting")
self:_DCSgRPCtts(Text, nil, nil , nil, nil, nil, nil, Coordinate)
elseif self.backend==MSRS.Backend.HOUND then
self:_HoundTextToSpeech(Text,nil,nil,nil,nil,nil,Coordinate,Speed,nil,speaker)
else
self:PlayTextExt(Text, Delay, nil, nil, nil, nil, nil, nil, nil, Coordinate, Speed, speaker)
end
end
@@ -1621,10 +1623,10 @@ end
-- @param #string Speaker Speaker (Sub-Voice) for PIPER only
-- @return #MSRS self
function MSRS:PlayTextExt(Text, Delay, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate,Speed,Speaker)
self:T({Text, Delay, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate, Speed} )
self:T({Text, Delay, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate, Speed, Speaker} )
if Delay and Delay>0 then
self:ScheduleOnce(Delay, self.PlayTextExt, self, Text, 0, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate, Speed)
self:ScheduleOnce(Delay, self.PlayTextExt, self, Text, 0, Frequencies, Modulations, Gender, Culture, Voice, Volume, Label, Coordinate, Speed, Speaker)
else
Frequencies = Frequencies or self:GetFrequencies()
@@ -1649,9 +1651,11 @@ function MSRS:PlayTextExt(Text, Delay, Frequencies, Modulations, Gender, Culture
elseif self.backend==MSRS.Backend.HOUND then
-- BASE:I("MSRS.Backend.HOUND")
--local UseGoogle = (self.provider == MSRS.Provider.GOOGLE) and true or nil
local speaker = Speaker or self.Speaker
self:_HoundTextToSpeech(Text,Frequencies,Modulations,Volume,Label,self.coalition,Coordinate,Speed,Gender,Culture,Voice,nil,Speaker)
local UseGoogle = (self.provider == MSRS.Provider.GOOGLE) and true or nil
self:_HoundTextToSpeech(Text,Frequencies,Modulations,Volume,Label,self.coalition,Coordinate,Speed,Gender,Culture,Voice,UseGoogle,speaker)
end
@@ -2055,7 +2059,7 @@ end
-- @param #string Speaker Speaker (Sub-Voice) for PIPER only
-- @return SpeechTime Speech time in seconds.
function MSRS:_HoundTextToSpeech(Message,Frequencies,Modulations,Volume,Label,Coalition,Point,Speed,Gender,Culture,Voice,UseGoogle,Speaker)
self:I(self.lid.."_HoundTextToSpeech")
self:T(self.lid.."_HoundTextToSpeech")
Frequencies = UTILS.EnsureTable(Frequencies)
Modulations = UTILS.EnsureTable(Modulations)
@@ -2086,8 +2090,8 @@ function MSRS:_HoundTextToSpeech(Message,Frequencies,Modulations,Volume,Label,Co
modus=modus:gsub("0", "AM")
modus=modus:gsub("1", "FM")
--self:I({T=Message,F=freqs,M=modus,V=voice,Vx=volume,L=label,C=coal,GGL=tostring(UseGoogle)})
self:I({T=Message})
self:T({T=Message,F=freqs,M=modus,V=voice,Vx=volume,L=label,C=coal,GGL=tostring(UseGoogle)})
--if (UseGoogle ~= true) and self.provider == MSRS.Provider.GOOGLE then
--UseGoogle = true
--end
@@ -2111,12 +2115,9 @@ function MSRS:_HoundTextToSpeech(Message,Frequencies,Modulations,Volume,Label,Co
speed = speed,
culture = culture,
gender = gender,
speaker = Speaker,
speaker = Speaker or self.Speaker,
}
UTILS.PrintTableToLog(TransmissionP,indent,noprint,maxDepth,seen)
UTILS.PrintTableToLog(ProviderP,indent,noprint,maxDepth,seen)
local speechtime = HoundTTS.Transmit(Message, TransmissionP, ProviderP)
return speechtime
@@ -2154,8 +2155,8 @@ end
-- | speed | number | `1.0` | Speech rate (0.5 = half speed, 1.0 = normal, 2.0 = double speed) |
--
function MSRS:_HoundTransmit(Message, Transmission_params, Provider_params)
self:I(self.lid.."_HoundTransmit")
self:I({Message,Transmission_params,Provider_params})
self:T(self.lid.."_HoundTransmit")
self:T({Message,Transmission_params,Provider_params})
local speechtime = HoundTTS.Transmit(Message, Transmission_params, Provider_params)
return speechtime
end
@@ -2167,7 +2168,7 @@ end
-- @param #table Modulations The table of modulations to use.
-- @param #number Coalition The coalition to use.
function MSRS:_HoundTestTone(Frequencies, Modulations, Coalition)
self:I(self.lid.."_HoundTestTone")
self:T(self.lid.."_HoundTestTone")
Frequencies = UTILS.EnsureTable(Frequencies)
Modulations = UTILS.EnsureTable(Modulations)
@@ -2193,6 +2194,7 @@ end
-- @param #number Speed (Optional) The speed to use, defaults to 1.0.
-- @param #boolean UseGoogle (Optional) If to use google. Default: no.
function MSRS:_HoundSpeechTime(Message,Speed,UseGoogle)
self:T(self.lid.."_HoundSpeechTime")
local speed = Speed or 1.0
local speechtime = HoundTTS.getSpeechTime(Message, speed, UseGoogle)
return speechtime
@@ -2569,7 +2571,9 @@ function MSRSQUEUE:NewTransmission(text, duration, msrs, tstart, interval, subgr
transmission.coordinate = coordinate or msrs.coordinate
transmission.speed = speed or 1.0
if speaker then
transmission.speaker = speaker
transmission.speaker = speaker
elseif msrs.Speaker then
transmission.speaker = msrs.speaker
end
-- Add transmission to queue.
self:AddTransmission(transmission)