updated a bunch

This commit is contained in:
2025-06-17 17:09:57 -04:00
parent 4e57946e82
commit 2711d658ea
4 changed files with 31 additions and 30 deletions

View File

@@ -4,21 +4,6 @@ local modem = peripheral.find("modem")
local monitor = peripheral.wrap("top")
controlRoomSpeakers = peripheral.find("speaker")
local speakers = {
peripheral.find("speaker_0"),
peripheral.find("speaker_1"),
peripheral.find("speaker_2"),
peripheral.find("speaker_3"),
peripheral.find("speaker_4"),
peripheral.find("speaker_5"),
peripheral.find("speaker_6"),
peripheral.find("speaker_7"),
peripheral.find("speaker_8"),
peripheral.find("speaker_9"),
peripheral.find("speaker_10"),
peripheral.find("speaker_11"),
}
function setNewLine()
local x,y = monitor.getCursorPos()
monitor.setCursorPos(1, y + 1)
@@ -27,18 +12,8 @@ end
local function startup()
speakerDriver.startup()
--speakerDriver.playControlRoomAlarm(controlRoomSpeakers)
--speakerDriver.playExternalAlarm(controlRoomSpeakers)
--speakerDriver.playInternalAlarm(controlRoomSpeakers)
speakerDriver.playTTSFile(peripheral.wrap("left"), "ELLO MATE LOVELY DAY INIT YOU GOT ANYYYY BEEEANSS AND TOAST ON YA MATE ID LOVE TO HAVE SOME BEANS N TOAST")
speakerDriver.playTTSFile(peripheral.wrap("right"), "ELLO MATE LOVELY DAY INIT YOU GOT ANYYYY BEEEANSS AND TOAST ON YA MATE ID LOVE TO HAVE SOME BEANS N TOAST")
speakerDriver.playTTSFile(peripheral.wrap("speaker_13"), "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")
-- local names = peripheral.getNames()
-- for index, value in ipairs(names) do
-- print(index, value)
-- read()
-- end
end
local function run()

View File

@@ -29,7 +29,6 @@ local function playSound(speaker, fileName)
end
end
local function playControlRoomAlarm(speakers)
playSound(speakers,"short_control_alarm")
end
@@ -37,6 +36,7 @@ end
local function playExternalAlarm(speakers)
playSound(speakers,"external_alarm")
end
local function playInternalAlarm(speakers)
playSound(speakers,"internal_alarm")
end
@@ -85,14 +85,11 @@ local function createSoundFile(fileName)
local file = fs.open(name,"w")
file.write(fileData)
file.close()
handle.close()
end
function addSoundFile(fileName)
createSoundFile(fileName)
end

25
speaker_main.lua Normal file
View File

@@ -0,0 +1,25 @@
speaker = peripheral.find("speaker")
speakerDriver = kernel.addDriver("speaker_driver")
local function startup()
parallel.waitForAll(speakerDriver.startup)
end
local function shutDown()
parallel.waitForAll(speakerDriver.shutDown)
end
local function runSafe()
startup()
end
local function run()
local success, err = pcall(runSafe)
if not success then
os.reboot()
end
end
return { run = run }

4
speaker_startup.lua Normal file
View File

@@ -0,0 +1,4 @@
local kernel = require("kernel")
local main = kernel.addDriver("speaker_main")
sleep(5)
main.run()