updated sound
This commit is contained in:
@@ -8,22 +8,9 @@ local function getFileName(name)
|
||||
return fullFile
|
||||
end
|
||||
|
||||
local function getSoundUrl(fileName)
|
||||
local baseRoute = "https://git.astrocore.space/root/NovaCorpLLC/raw/branch/main/"
|
||||
local name = getFileName(fileName)
|
||||
local fullPath = baseRoute .. name
|
||||
return fullPath
|
||||
end
|
||||
|
||||
local function getSoundStream(fileName)
|
||||
print("Getting sound stream for: " .. fileName)
|
||||
local request = http.get(getSoundUrl(fileName))
|
||||
print(textutils.serialize(request.getResponseHeaders()))
|
||||
request.close()
|
||||
end
|
||||
|
||||
local function playSound(speaker, fileName)
|
||||
--local fileStream = getSoundStream(fileName)
|
||||
local fileStream = getFileName(fileName)
|
||||
local values = io.lines(fileStream, 16 * 1024)
|
||||
for input in values do
|
||||
@@ -41,15 +28,26 @@ local function playControlRoomAlarm(speakers)
|
||||
playSound(speakers,"short_control_alarm")
|
||||
end
|
||||
|
||||
local function createSoundFile(fileName)
|
||||
|
||||
local baseRoute = "https://git.astrocore.space/root/NovaCorpLLC/raw/branch/main/"
|
||||
local name = getFileName(fileName)
|
||||
local fullPath = baseRoute .. name
|
||||
|
||||
shell.execute("rm", name)
|
||||
|
||||
local response = http.get(fullPath)
|
||||
local fileData = response.readAll()
|
||||
local file = fs.open(name,"w")
|
||||
file.write(fileData)
|
||||
file.close()
|
||||
response.close()
|
||||
end
|
||||
|
||||
|
||||
|
||||
function addSoundFile(fileName)
|
||||
local baseRoute = "https://git.astrocore.space/root/NovaCorpLLC/raw/branch/main/"
|
||||
local name = getFileName(fileName)
|
||||
local fullPath = baseRoute .. name
|
||||
shell.execute("rm", name)
|
||||
shell.execute("wget", fullPath)
|
||||
createSoundFile(fileName)
|
||||
end
|
||||
|
||||
local function watch()
|
||||
@@ -59,7 +57,7 @@ end
|
||||
|
||||
local function startup()
|
||||
local sounds = {
|
||||
{ fileName = "control_alarm" }
|
||||
{ fileName = "short_control_alarm" }
|
||||
}
|
||||
|
||||
for i, item in ipairs(sounds) do
|
||||
|
||||
Reference in New Issue
Block a user