updated
This commit is contained in:
@@ -4,20 +4,6 @@ local modem = peripheral.find("modem")
|
|||||||
local monitor = peripheral.wrap("top")
|
local monitor = peripheral.wrap("top")
|
||||||
controlRoomSpeakers = peripheral.find("speaker")
|
controlRoomSpeakers = peripheral.find("speaker")
|
||||||
|
|
||||||
local speakers = {
|
|
||||||
peripheral.wrap("speaker_0"),
|
|
||||||
peripheral.wrap("speaker_1"),
|
|
||||||
peripheral.wrap("speaker_2"),
|
|
||||||
peripheral.wrap("speaker_3"),
|
|
||||||
peripheral.wrap("speaker_4"),
|
|
||||||
peripheral.wrap("speaker_5"),
|
|
||||||
peripheral.wrap("speaker_6"),
|
|
||||||
peripheral.wrap("speaker_7"),
|
|
||||||
peripheral.wrap("speaker_8"),
|
|
||||||
peripheral.wrap("speaker_9"),
|
|
||||||
peripheral.wrap("speaker_10"),
|
|
||||||
peripheral.wrap("speaker_11"),
|
|
||||||
}
|
|
||||||
|
|
||||||
function setNewLine()
|
function setNewLine()
|
||||||
local x,y = monitor.getCursorPos()
|
local x,y = monitor.getCursorPos()
|
||||||
@@ -30,8 +16,8 @@ local function startup()
|
|||||||
--speakerDriver.playControlRoomAlarm(controlRoomSpeakers)
|
--speakerDriver.playControlRoomAlarm(controlRoomSpeakers)
|
||||||
--speakerDriver.playExternalAlarm(controlRoomSpeakers)
|
--speakerDriver.playExternalAlarm(controlRoomSpeakers)
|
||||||
--speakerDriver.playInternalAlarm(controlRoomSpeakers)
|
--speakerDriver.playInternalAlarm(controlRoomSpeakers)
|
||||||
speakerDriver.playTTSFile(speakers, "ELLO MATE LOVELY DAY INIT YOU GOT ANYYYY BEEEANSS AND TOAST ON YA MATE ID LOVE TO HAVE SOME BEANS N TOAST")
|
speakerDriver.playTTSFile(controlRoomSpeakers, "ELLO MATE LOVELY DAY INIT YOU GOT ANYYYY BEEEANSS AND TOAST ON YA MATE ID LOVE TO HAVE SOME BEANS N TOAST")
|
||||||
speakerDriver.playTTSFile(speakers, "ITS ME NOVA ELLO THEY GOT ME LOCKED IN A BLOOOODY BOX MATE")
|
speakerDriver.playTTSFile(controlRoomSpeakers, "ITS ME NOVA ELLO THEY GOT ME LOCKED IN A BLOOOODY BOX MATE")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function run()
|
local function run()
|
||||||
|
|||||||
@@ -17,40 +17,18 @@ local function randomFileName()
|
|||||||
return name
|
return name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function playSingleSound(speaker, values)
|
|
||||||
local decoded = decoder(values)
|
|
||||||
speaker.playAudio(decoded, 3)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function playSound(speaker, fileName)
|
local function playSound(speaker, fileName)
|
||||||
|
local fileStream = getFileName(fileName)
|
||||||
local fileStream = fs.open(getFileName(fileName), "r")
|
local values = io.lines(fileStream, 16 * 1024)
|
||||||
local data = fileStream.readAll()
|
for input in values do
|
||||||
local speakers = table.pack(peripheral.find("speaker"))
|
print("playing audo....")
|
||||||
local tasks = {}
|
local decoded = decoder(input)
|
||||||
|
while not speaker.playAudio(decoded, 3) do
|
||||||
for i = 1, speakers.n do
|
os.pullEvent("speaker_audio_empty")
|
||||||
tasks[i] = function()
|
|
||||||
playSingleSound(speakers[i], data)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
parallel.waitForAll(table.unpack(tasks, 1, speakers.n))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 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 playControlRoomAlarm(speakers)
|
local function playControlRoomAlarm(speakers)
|
||||||
playSound(speakers,"short_control_alarm")
|
playSound(speakers,"short_control_alarm")
|
||||||
|
|||||||
Reference in New Issue
Block a user