sound
Description
ComputerCraft OS
Installation
Copy one of these commands into your ComputerCraft terminal:
wget:
wget https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/modules/opus/sound.lua soundArchive:
wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-modules-opus-sound sound
Quick Install:
wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-modules-opus-sound sound
Usage
Run: sound
Tags
Source
View Original SourceCode Preview
local peripheral = _G.peripheral
local Sound = {
_volume = 1,
}
function Sound.play(sound, vol)
peripheral.find('speaker', function(_, s)
s.playSound('minecraft:' .. sound, vol or Sound._volume)
end)
end
function Sound.setVolume(volume)
Sound._volume = math.max(0, math.min(volume, 1))
end
return Sound