updated
This commit is contained in:
@@ -17,19 +17,46 @@ local function randomFileName()
|
||||
return name
|
||||
end
|
||||
|
||||
local function playSound(speaker, fileName)
|
||||
-- local function playSound(speaker, fileName)
|
||||
-- local fileStream = getFileName(fileName)
|
||||
-- local values = io.lines(fileStream, 16 * 1024)
|
||||
-- for input in values do
|
||||
-- print("playing audo....")
|
||||
-- local decoded = decoder(input)
|
||||
|
||||
|
||||
-- while not speaker.playAudio(decoded, 3) do
|
||||
-- os.pullEvent("speaker_audio_empty")
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
local function playSpeaker(speaker, data)
|
||||
while not speaker.playAudio(data, 3) do
|
||||
os.pullEvent("speaker_audio_empty")
|
||||
end
|
||||
end
|
||||
|
||||
local function playSound(speakers, fileName)
|
||||
local fileStream = getFileName(fileName)
|
||||
local values = io.lines(fileStream, 16 * 1024)
|
||||
for input in values do
|
||||
print("playing audo....")
|
||||
local decoded = decoder(input)
|
||||
while not speaker.playAudio(decoded, 3) do
|
||||
os.pullEvent("speaker_audio_empty")
|
||||
local tasks = {}
|
||||
for _, speaker in ipairs(speakers) do
|
||||
table.insert(tasks, function()
|
||||
playSpeaker(speaker, decoded)
|
||||
end)
|
||||
end
|
||||
|
||||
parallel.waitForAll(table.unpack(tasks))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local function playControlRoomAlarm(speakers)
|
||||
playSound(speakers,"short_control_alarm")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user