diff --git a/Moose Development/Moose/Core/Message.lua b/Moose Development/Moose/Core/Message.lua index aeae8b95e..4f4a40e50 100644 --- a/Moose Development/Moose/Core/Message.lua +++ b/Moose Development/Moose/Core/Message.lua @@ -465,7 +465,7 @@ _MESSAGESRS = {} -- @param #string PathToCredentials (optional) Path to credentials file for e.g. Google. -- @param #number Frequency Frequency in MHz. Can also be given as a #table of frequencies. -- @param #number Modulation Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. --- @param #string Gender (optional) Gender, i.e. "male" or "female", defaults to "male". +-- @param #string Gender (optional) Gender, i.e. "male" or "female", defaults to "female". -- @param #string Culture (optional) Culture, e.g. "en-US", defaults to "en-GB" -- @param #string Voice (optional) Voice. Will override gender and culture settings, e.g. MSRS.Voices.Microsoft.Hazel or MSRS.Voices.Google.Standard.de_DE_Standard_D. Hint on Microsoft voices - working voices are limited to Hedda, Hazel, David, Zira and Hortense. **Must** be installed on your Desktop or Server! -- @param #number Coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Defaults to coalition.side.NEUTRAL. @@ -480,24 +480,42 @@ _MESSAGESRS = {} -- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS() -- function MESSAGE.SetMSRS(PathToSRS,Port,PathToCredentials,Frequency,Modulation,Gender,Culture,Voice,Coalition,Volume,Label,Coordinate) - _MESSAGESRS.MSRS = MSRS:New(PathToSRS,Frequency,Modulation,Volume) - _MESSAGESRS.MSRS:SetCoalition(Coalition) + _MESSAGESRS.MSRS = MSRS:New(PathToSRS,Frequency or 243,Modulation or radio.modulation.AM,Volume) + + _MESSAGESRS.frequency = Frequency + _MESSAGESRS.modulation = Modulation or radio.modulation.AM + + _MESSAGESRS.MSRS:SetCoalition(Coalition or coalition.side.NEUTRAL) + _MESSAGESRS.coalition = Coalition or coalition.side.NEUTRAL + + _MESSAGESRS.coordinate = Coordinate _MESSAGESRS.MSRS:SetCoordinate(Coordinate) + _MESSAGESRS.MSRS:SetCulture(Culture) - _MESSAGESRS.Culture = Culture - --_MESSAGESRS.MSRS:SetFrequencies(Frequency) + _MESSAGESRS.Culture = Culture or "en-GB" + _MESSAGESRS.MSRS:SetGender(Gender) - _MESSAGESRS.Gender = Gender + _MESSAGESRS.Gender = Gender or "female" + _MESSAGESRS.MSRS:SetGoogle(PathToCredentials) + _MESSAGESRS.google = PathToCredentials + _MESSAGESRS.MSRS:SetLabel(Label or "MESSAGE") - --_MESSAGESRS.MSRS:SetModulations(Modulation) - --_MESSAGESRS.MSRS:SetPath(PathToSRS) - _MESSAGESRS.MSRS:SetPort(Port) - -- _MESSAGESRS.MSRS:SetVolume(Volume) - _MESSAGESRS.MSRS:SetVoice(Voice) - _MESSAGESRS.Voice = Voice + _MESSAGESRS.label = Label or "MESSAGE" + + _MESSAGESRS.MSRS:SetPort(Port or 5002) + _MESSAGESRS.port = Port or 5002 + + _MESSAGESRS.volume = Volume or 1 + _MESSAGESRS.MSRS:SetVolume(_MESSAGESRS.volume) + + if Voice then _MESSAGESRS.MSRS:SetVoice(Voice) end + + _MESSAGESRS.voice = Voice --or MSRS.Voices.Microsoft.Hedda + --if _MESSAGESRS.google and not Voice then _MESSAGESRS.Voice = MSRS.Voices.Google.Standard.en_GB_Standard_A end + --_MESSAGESRS.MSRS:SetVoice(Voice or _MESSAGESRS.voice) + _MESSAGESRS.SRSQ = MSRSQUEUE:New(Label or "MESSAGE") - env.info(_MESSAGESRS.MSRS.provider,false) end --- Sends a message via SRS. @@ -505,7 +523,7 @@ end -- @param #number frequency (optional) Frequency in MHz. Can also be given as a #table of frequencies. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting. -- @param #number modulation (optional) Modulation, i.e. radio.modulation.AM or radio.modulation.FM. Can also be given as a #table of modulations. Only needed if you want to override defaults set with `MESSAGE.SetMSRS()` for this one setting. -- @param #string gender (optional) Gender, i.e. "male" or "female". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`. --- @param #string culture (optional) Culture, e.g. "en-US. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`. +-- @param #string culture (optional) Culture, e.g. "en-US". Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`. -- @param #string voice (optional) Voice. Will override gender and culture settings. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`. -- @param #number coalition (optional) Coalition, can be coalition.side.RED, coalition.side.BLUE or coalition.side.NEUTRAL. Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`. -- @param #number volume (optional) Volume, can be between 0.0 and 1.0 (loudest). Only needed if you want to change defaults set with `MESSAGE.SetMSRS()`. @@ -519,13 +537,16 @@ end -- MESSAGE:New("Test message!",15,"SPAWN"):ToSRS() -- function MESSAGE:ToSRS(frequency,modulation,gender,culture,voice,coalition,volume,coordinate) + local tgender = gender or _MESSAGESRS.Gender if _MESSAGESRS.SRSQ then - _MESSAGESRS.MSRS:SetVoice(voice or _MESSAGESRS.Voice) + if voice then + _MESSAGESRS.MSRS:SetVoice(voice or _MESSAGESRS.voice) + end if coordinate then _MESSAGESRS.MSRS:SetCoordinate(coordinate) end local category = string.gsub(self.MessageCategory,":","") - _MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,nil,nil,nil,nil,nil,frequency,modulation,gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,voice or _MESSAGESRS.Voice,volume,category,coordinate) + _MESSAGESRS.SRSQ:NewTransmission(self.MessageText,nil,_MESSAGESRS.MSRS,nil,nil,nil,nil,nil,frequency or _MESSAGESRS.frequency,modulation or _MESSAGESRS.modulation, gender or _MESSAGESRS.Gender,culture or _MESSAGESRS.Culture,nil,volume or _MESSAGESRS.volume,category,coordinate or _MESSAGESRS.coordinate) end return self end diff --git a/Moose Development/Moose/Sound/SRS.lua b/Moose Development/Moose/Sound/SRS.lua index 57e3fddcc..856595d0b 100644 --- a/Moose Development/Moose/Sound/SRS.lua +++ b/Moose Development/Moose/Sound/SRS.lua @@ -1119,7 +1119,7 @@ function MSRS:_GetCommand(freqs, modus, coal, gender, voice, culture, volume, sp end -- Debug output. - self:T("MSRS command="..command) + self:I("MSRS command="..command) return command end @@ -1243,7 +1243,7 @@ function MSRS:LoadConfigFile(Path,Filename,ConfigLoaded) self.gender = MSRS_Config.Gender or "male" self.google = MSRS_Config.Google self.Label = MSRS_Config.Label or "MSRS" - self.voice = MSRS_Config.Voice or MSRS.Voices.Microsoft.Hazel + self.voice = MSRS_Config.Voice --or MSRS.Voices.Microsoft.Hazel if MSRS_Config.GRPC then self.provider = MSRS_Config.GRPC.DefaultProvider if MSRS_Config.GRPC[MSRS_Config.GRPC.DefaultProvider] then @@ -1267,7 +1267,7 @@ function MSRS:LoadConfigFile(Path,Filename,ConfigLoaded) MSRS.gender = MSRS_Config.Gender or "male" MSRS.google = MSRS_Config.Google MSRS.Label = MSRS_Config.Label or "MSRS" - MSRS.voice = MSRS_Config.Voice or MSRS.Voices.Microsoft.Hazel + MSRS.voice = MSRS_Config.Voice --or MSRS.Voices.Microsoft.Hazel if MSRS_Config.GRPC then MSRS.provider = MSRS_Config.GRPC.DefaultProvider if MSRS_Config.GRPC[MSRS_Config.GRPC.DefaultProvider] then @@ -1695,7 +1695,7 @@ end -- @param #MSRSQUEUE self -- @return #MSRSQUEUE self The MSRSQUEUE object. function MSRSQUEUE:Clear() - self:I(self.lid.."Clearning MSRSQUEUE") + self:I(self.lid.."Clearing MSRSQUEUE") self.queue={} return self end @@ -1796,7 +1796,7 @@ function MSRSQUEUE:NewTransmission(text, duration, msrs, tstart, interval, subgr transmission.gender = gender transmission.culture = culture transmission.voice = voice - transmission.gender = volume + transmission.volume = volume transmission.label = label transmission.coordinate = coordinate @@ -1810,7 +1810,7 @@ end -- @param #MSRSQUEUE self -- @param #MSRSQUEUE.Transmission transmission The transmission. function MSRSQUEUE:Broadcast(transmission) - + if transmission.frequency then transmission.msrs:PlayTextExt(transmission.text, nil, transmission.frequency, transmission.modulation, transmission.gender, transmission.culture, transmission.voice, transmission.volume, transmission.label, transmission.coordinate) else