From 072e5f0ac5dafd5ac57319096f6fe7ebee287a29 Mon Sep 17 00:00:00 2001 From: itzmarkoni Date: Sun, 15 Jun 2025 18:50:52 -0400 Subject: [PATCH] updated speaker driver --- speaker_driver.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/speaker_driver.lua b/speaker_driver.lua index 2291384..3ca4f10 100644 --- a/speaker_driver.lua +++ b/speaker_driver.lua @@ -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)