updated
This commit is contained in:
@@ -4,6 +4,21 @@ local modem = peripheral.find("modem")
|
||||
local monitor = peripheral.wrap("top")
|
||||
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()
|
||||
local x,y = monitor.getCursorPos()
|
||||
monitor.setCursorPos(1, y + 1)
|
||||
@@ -15,8 +30,8 @@ local function startup()
|
||||
--speakerDriver.playControlRoomAlarm(controlRoomSpeakers)
|
||||
--speakerDriver.playExternalAlarm(controlRoomSpeakers)
|
||||
--speakerDriver.playInternalAlarm(controlRoomSpeakers)
|
||||
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(controlRoomSpeakers, "ITS ME NOVA ELLO THEY GOT ME LOCKED IN A BLOOOODY BOX MATE")
|
||||
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(speakers, "ITS ME NOVA ELLO THEY GOT ME LOCKED IN A BLOOOODY BOX MATE")
|
||||
end
|
||||
|
||||
local function run()
|
||||
|
||||
@@ -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