updated speaker driver

This commit is contained in:
2025-06-15 18:50:52 -04:00
parent 605326a3bf
commit 072e5f0ac5

View File

@@ -8,9 +8,23 @@ 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)
local request = http.get(getSoundUrl(fileName))
print(textutils.serialize(request.getResponseHeaders()))
request.close()
end
local function playSound(speaker, fileName)
for input in io.lines(getFileName(fileName), 16 * 1024) do
local decoded = decoder(input)
local values = io.lines(getSoundStream(fileName), 16 * 1024)
for input in values do
local decoded = decoder(input)
while not speaker.playAudio(decoded) do
os.pullEvent("speaker_audio_empty")
end
@@ -27,6 +41,7 @@ end
function addSoundFile(fileName)
local baseRoute = "https://git.astrocore.space/root/NovaCorpLLC/raw/branch/main/"
local name = getFileName(fileName)