testing with voices!

This commit is contained in:
2026-09-22 20:36:03 -06:00
parent 1fac678a79
commit 8834269fee
3 changed files with 86 additions and 4 deletions
+50 -2
View File
@@ -1,5 +1,6 @@
local window_width, window_height = love.graphics.getDimensions()
-- local filament = require "lib.filament"
local log = require "lib.log"
local lovebird = require "lib.lovebird"
local progress_bar = require "lib.progress_bar"
@@ -9,13 +10,54 @@ local utility = require "lib.utility"
lovebird.whitelist[#lovebird.whitelist + 1] = "192.168.*.*" -- LAN access
log{
testing = true,
debug = true,
}
local constants = require "data.constants"
local classes, class_names = require "data.classes"
local races, race_names = require "data.races"
local voices = utility.load_data("macos_say-en.json")
local voice_int = 0
local send_test_message = function()
-- local selected_voice = voices[math.random(1, #voices)]
voice_int = voice_int + 1
if voice_int > #voices then voice_int = 1 end
local selected_voice = voices[voice_int]
local test_channel = love.thread.getChannel("say")
local line = "Hello, my name is " .. selected_voice .. "."
test_channel:push({
voice = selected_voice:enquote(),
line = line:enquote(),
})
log("debug", selected_voice, line)
end
send_test_message()
-- filament.run(function()
-- local line = "Hello, my name is " .. selected_voice .. "."
-- os.execute("say -v " .. selected_voice:enquote() .. " " .. line:enquote())
-- end)
-- local test_thread = love.thread.newThread([[
-- -- local utility = require "lib.utility"
-- -- local voices = utility.load_data("macos_say-en.json")
-- -- local selected_voice = voices[math.random(1, #voices)]
-- local selected_voice = "Bells"
-- local line = "Hello, my name is " .. selected_voice .. "."
-- os.execute("say -v \"" .. selected_voice .. "\" \"" .. line .. "\"")
-- ]])
local test_thread = love.thread.newThread([[
local channel = love.thread.getChannel("say")
while true do
local message = channel:demand()
if message then
os.execute("say -v " .. message.voice .. " " .. message.line)
end
end
]])
test_thread:start()
local new_character = function(name)
local base_stat_roll = function()
return 3 + math.random(1, 6) + math.random(1, 6) + math.random(1, 6)
@@ -74,7 +116,7 @@ local test_bar = progress_bar(0, window_height - constants.progress_bar_height *
local test_message = "This is a test text string of significant length. It exists to test printing over a progress bar."
test_bar:set_text(test_message)
local test_timer = timer.every(#test_message * constants.reading_time_multiplier, function() log("testing", "The timer completed.") end) -- TODO consider making timer not need a function; cause I don't here!
local test_timer = timer.every(#test_message * constants.reading_time_multiplier, function() log("debug", "The timer completed.") end) -- TODO consider making timer not need a function; cause I don't here!
local task_queue
task_queue = {
@@ -99,6 +141,10 @@ love.update = function(dt)
timer.update(dt)
test_bar:set_progress(test_timer.run_time / test_timer:get_interval())
local thread_error = test_thread:getError()
if thread_error then
log("debug", thread_error)
end
end
love.draw = function()
@@ -116,5 +162,7 @@ love.keypressed = function(key)
update_book_progress(-1)
elseif key == "right" then
update_book_progress(1)
elseif key == "v" then
send_test_message()
end
end