Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- verze = "20.1223.R3"
- local speaker = nil
- local tArgs = { ... }
- local n = {}
- local s = {}
- local nastroj = {}
- local ton = 0
- nastroje = {
- [1] = "harp",
- [2] = "bass",
- [3] = "basedrum",
- [4] = "bell",
- [5] = "chime",
- [6] = "flute",
- [7] = "hat",
- [8] = "snare",
- [9] = "xylophone",
- }
- local function load(name)
- local file = fs.open(name,"r")
- local data = file.readAll()
- file.close()
- return textutils.unserialize(data)
- end
- if fs.exists("/C/system/RAM/devices/speaker.tmp") then
- speakers = {}
- speakers = load("/C/system/RAM/devices/speaker.tmp")
- speaker = peripheral.wrap(tostring(speakers[0]))
- if speaker == nil then speaker = peripheral.wrap(tostring(speakers[1])) end
- else
- speaker = peripheral.find("speaker")
- end
- function p(note,s,nas,tonina)
- if tonina > 0 then nas = tonina end
- if (nas == nil) then nas = 1 end
- speaker.playNote(nastroje[nas],1,note)
- sleep(0.15*s)
- end
- function sound(type)
- if type == "startup" then n = {2,21,2,9,2,16,14,21,4,16} s = {0.5,1.2,1,1,0.5,1,1,2,0.5,1} nastroj ={2,1,2,1,2,1,1,1,2,1}
- elseif type == "shutdown" then n = {14,9,2,4,4} s = {1,1,1,0.5,2} nastroj ={1,1,1,2,1}
- elseif type == "logout" then n = {16, 9, 9} s = {1,0.5,2} nastroj ={1,2,1}
- elseif type == "login" then n = {9, 9,16} s = {1,0.5,2} nastroj ={1,2,1}
- elseif type == "error" then n = {14,9,21} s = {0,0,0}
- elseif type == "stop" then n = {1,6,13} s = {0,0,2} ton = 2
- elseif type == "info" then n = {14,14,9,21} s = {0.3,0.1,0.1,0.1} ton = 6
- elseif type == "hwout" then n = {16, 9} s = {1,0.3} ton = 2
- elseif type == "hwin" then n = {9, 16} s = {1,0.3} ton = 2
- elseif type == "trash" then n = {21,1,4} s = {1,0.5,1} ton = 8
- elseif type == "folder" then n = {21} s = {1} ton = 8
- elseif type == "print" then n = {9,4,16} s = {1,1,1} ton = 6
- else n = {} s = {}
- end
- for i=1, #n do
- p(n[i],s[i], nastroj[i], ton)
- end
- ton = 0
- nastroj ={}
- end
- if #tArgs > 0 then
- sound(tArgs[1])
- end
Add Comment
Please, Sign In to add comment