Posted 30 May 2014 - 12:02 PM
I would like that this program detect the sound lenght and then play the music repeatedly but idk why it doest, a little help please ? :)/>
term = peripheral.wrap("top")
local C,Y = term.getCursorPos()
term.setTextScale(1.5)
term.setBackgroundColor(colors.gray)
term.setTextColor(colors.yellow)
term.clear()
term.setCursorPos(1, 1)
term.write("Playing:")
term.setCursorPos(1, 2)
term.write(disk.getLabel("left"))
local name = disk.getLabel("left")
local timer = os.startTimer(0)
while true do
disk.playAudio("left")
os.pullEvent("timer")
local name = disk.getLabel("left")
if name == 13 then
lenght =178
elseif name == cat or chirp then
lenght = 185
elseif name == blocks then
lenght = 345
elseif name == far then
lenght = 174
elseif name == mall then
lenght = 197
elseif name == mellohi then
lenght = 96
elseif name == stal or "portalgun:wantyougone" then
lenght = 150
elseif name == strad then
lenght = 183
elseif name == ward then
lenght = 251
elseif name == 11 then
lenght = 71
elseif name == wait then
lenght = 238
elseif name == "portalgun:stillalive" then
lenght = 176
elseif name == "portalgun:radioloop" then
lenght = 22
end
term.clear()
term.setCursorPos(1, 1)
term.write("Playing:")
term.setCursorPos(1, 2)
term.write(disk.getLabel("left"))
os.startTimer(lenght)
end
Edited on 30 May 2014 - 01:48 PM