From a49e996e1be50906b5968cb28c70e0f454d63e06 Mon Sep 17 00:00:00 2001 From: hkc Date: Sun, 15 Sep 2024 03:41:47 +0300 Subject: [PATCH] Added settings support --- video.lua | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/video.lua b/video.lua index 597ade4..442a9a9 100644 --- a/video.lua +++ b/video.lua @@ -2,11 +2,33 @@ local args = { ... } local dfpwm = require("cc.audio.dfpwm") local ccpi = require("ccpi") -local monitor = peripheral.find("monitor") +settings.define("video.speaker.left", { + description = "Speaker ID for left audio channel", + default = peripheral.getName(peripheral.find("speaker")), + type = "string" +}) + +settings.define("video.speaker.right", { + description = "Speaker ID for right audio channel", + default = nil, + type = "string" +}) + +settings.define("video.monitor", { + description = "Monitor to draw frames on", + default = peripheral.getName(peripheral.find("monitor")), + type = "string" +}) + +local monitor = peripheral.wrap(settings.get("video.monitor")) local speakers = { - l = peripheral.find("speaker"), + l = peripheral.wrap(settings.get("video.speaker.left")), r = nil } +local r_spk_id = settings.get("video.speaker.right") +if r_spk_id then + speakers.r = peripheral.wrap(r_spk_id) +end local delay = 0 local loading_concurrency = 8