This commit is contained in:
2025-06-16 20:24:03 -04:00
parent e3970ac4ce
commit e4a91a47a6

View File

@@ -53,15 +53,17 @@ local function playFullFile(speaker, fileName)
file.close()
end
local function playSound(speakers, fileName)
local function playSound(placeholder,fileName)
local speakers = table.pack(peripheral.find("speaker"))
local tasks = {}
for _, speaker in ipairs(speakers) do
table.insert(tasks, function()
playFullFile(speaker, fileName)
end)
for i = 1, speakers.n do
tasks[i] = function()
playFullFile(speakers[i], fileName)
end
end
parallel.waitForAll(table.unpack(tasks))
parallel.waitForAll(table.unpack(tasks, 1, speakers.n))
end