(feat/TTS) Add Text-to-speech via awesome_wotlk

This commit is contained in:
NoM0Re
2025-08-25 21:41:59 +02:00
committed by GitHub
parent 2257d236a5
commit 2752f0a53c
10 changed files with 248 additions and 48 deletions
@@ -431,7 +431,9 @@ local function IsParentRecursive(needle, parent)
end
local tabsForWarning = {
tts_condition = "conditions",
sound_condition = "conditions",
tts_action = "action",
sound_action = "action",
spammy_event_warning = "trigger"
}
@@ -1425,16 +1427,20 @@ local methods = {
end,
["UpdateWarning"] = function(self)
local warnings = OptionsPrivate.Private.AuraWarnings.GetAllWarnings(self.data.uid)
local warningTypes = {"info", "sound", "warning", "error"}
local warningTypes = {"info", "sound", "tts", "warning", "error"}
for _, key in ipairs(warningTypes) do
self:ClearStatusIcon(key)
end
if warnings then
for severity, warning in pairs(warnings) do
local onClick
if severity == "sound" then
if severity == "sound" or severity == "tts" then
local soundText = L["Show Sound Setting"]
local removeText = L["Remove All Sounds"]
if severity == "tts" then
soundText = L["Show Text To Speech Setting"]
removeText = L["Remove All Text To Speech"]
end
onClick = function()
local menu = {
{
@@ -1446,7 +1452,7 @@ local methods = {
{
text = removeText,
func = function()
OptionsPrivate.Private.ClearSounds(self.data.uid)
OptionsPrivate.Private.ClearSounds(self.data.uid, severity)
end
}
}
+56
View File
@@ -208,6 +208,16 @@ function OptionsPrivate.GetActionOptions(data)
return data.actions.start.message_type ~= "WHISPER"
end
},
start_message_tts_voice = {
type = "select",
width = WeakAuras.doubleWidth,
name = L["Voice"],
order = 3.2,
disabled = function() return WeakAuras.IsAwesomeEnabled() ~= 2 or not data.actions.start.do_message end,
hidden = function() return WeakAuras.IsAwesomeEnabled() ~= 2 or data.actions.start.message_type ~= "TTS" end,
values = OptionsPrivate.Private.tts_voices,
desc = L["Available Voices are system specific"]
},
start_message = {
type = "input",
width = WeakAuras.doubleWidth - 0.15,
@@ -713,6 +723,16 @@ function OptionsPrivate.GetActionOptions(data)
return data.actions.finish.message_type ~= "WHISPER"
end
},
finish_message_tts_voice = {
type = "select",
width = WeakAuras.doubleWidth,
name = L["Voice"],
order = 23.2,
disabled = function() return WeakAuras.IsAwesomeEnabled() ~= 2 or not data.actions.finish.do_message end,
hidden = function() return WeakAuras.IsAwesomeEnabled() ~= 2 or data.actions.finish.message_type ~= "TTS" end,
values = OptionsPrivate.Private.tts_voices,
desc = L["Available Voices are system specific"]
},
finish_message = {
type = "input",
width = WeakAuras.doubleWidth - 0.15,
@@ -794,6 +814,42 @@ function OptionsPrivate.GetActionOptions(data)
hidden = function() return data.actions.finish.sound ~= " KitID" end,
disabled = function() return not data.actions.finish.do_sound end
},
finish_stop_sound = {
type = "toggle",
width = WeakAuras.doubleWidth,
name = L["Stop Sound"],
order = 29.1,
hidden = function() return not StopSound end,
disabled = function() return not StopSound end,
},
finish_do_sound_fade = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Fadeout Sound"],
order = 29.2,
hidden = function() return not StopSound end,
disabled = function() return not StopSound or not data.actions.finish.stop_sound end,
},
finish_stop_sound_fade = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Fadeout Time (seconds)"],
order = 29.3,
hidden = function() return not StopSound or not data.actions.finish.do_sound_fade end,
disabled = function() return not StopSound or not data.actions.finish.stop_sound end,
min = 0,
softMax = 10,
bigStep = 1,
},
finish_stop_sound_fade_space = {
type = "description",
width = WeakAuras.doubleWidth,
order = 29.4,
name = "",
hidden = function() return not StopSound end,
disabled = function() return not StopSound end,
},
finish_do_glow = {
type = "toggle",
width = WeakAuras.normalWidth,
+49 -1
View File
@@ -846,6 +846,35 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
}
order = order + 1;
if StopSound then
args["condition" .. i .. "value" .. j .. "sound_fade"] = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
min = 0,
softMax = 10,
bigStep = 1,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "sound_fade", L["Fadeout Time (seconds)"], L["Fadeout Time (seconds)"]),
desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound_fade", propertyType),
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.sound_fade;
end,
set = setValueComplex("sound_fade"),
disabled = function() return not anySoundType("Stop") end,
hidden = function() return not (anySoundType("Stop")) end
}
order = order + 1;
args["condition" .. i .. "value" .. j .. "sound_fade_space"] = {
type = "description",
width = WeakAuras.normalWidth,
name = "",
order = order,
hidden = function() return not (anySoundType("Stop")) end
}
order = order + 1;
end
elseif (propertyType == "chat") then
args["condition" .. i .. "value" .. j .. "message type"] = {
@@ -987,6 +1016,25 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
}
order = order + 1;
if WeakAuras.IsAwesomeEnabled() == 2 then
args["condition" .. i .. "value" .. j .. "message voice"] = {
type = "select",
width = WeakAuras.doubleWidth,
name = blueIfNoValue2(data, conditions[i].changes[j], "value", "message_voice", L["Voice"], L["Voice"]),
desc = (descIfNoValue2(data, conditions[i].changes[j], "value", "message_voice", propertyType, OptionsPrivate.Private.tts_voices) or "") .. "\n" .. L["Available Voices are system specific"],
values = OptionsPrivate.Private.tts_voices,
order = order,
get = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message_voice;
end,
set = setValueComplex("message_voice"),
hidden = function()
return not anyMessageType("TTS");
end,
}
order = order + 1;
end
local message_getter = function()
return type(conditions[i].changes[j].value) == "table" and conditions[i].changes[j].value.message;
end
@@ -2871,7 +2919,7 @@ local function SubPropertiesForChange(change)
"glow_scale", "glow_border"
}
elseif change.property == "chat" then
local result = { "message_type", "message_dest", "message_channel", "message_color", "message", "custom" }
local result = { "message_type", "message_dest", "message_channel", "message_color", "message", "custom", "message_voice" }
local input = change.value and change.value.message
if input then
local getter = function(key)