From aef22987fa1321883f597f62ca13f61fb450b788 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Wed, 2 Jan 2019 23:56:01 -0500 Subject: [PATCH] stereo sound! --- sys/apis/sound.lua | 7 +++---- sys/apis/ui.lua | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/apis/sound.lua b/sys/apis/sound.lua index b4dab46..18dad1c 100644 --- a/sys/apis/sound.lua +++ b/sys/apis/sound.lua @@ -5,10 +5,9 @@ local Sound = { } function Sound.play(sound, vol) - local speaker = peripheral.find('speaker') - if speaker then - speaker.playSound('minecraft:' .. sound, vol or Sound._volume) - end + peripheral.find('speaker', function(_, s) + s.playSound('minecraft:' .. sound, vol or Sound._volume) + end) end function Sound.setVolume(volume) diff --git a/sys/apis/ui.lua b/sys/apis/ui.lua index 068b7d9..dcc0ae8 100644 --- a/sys/apis/ui.lua +++ b/sys/apis/ui.lua @@ -46,7 +46,7 @@ end local Manager = class() function Manager:init() self.devices = { } -_G._pp = self + local function keyFunction(event, code, held) local ie = Input:translate(event, code, held)