Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------
- ---ThinkInvisible's-----------------
- ------------------------------------
- -- --
- -- /---- --
- -- | --
- -- | -+- +-\ ^ /-- |/ /-- +-\ --
- -- | | |-/ /-\ | + +-- |-/ --
- -- | | | \ | | \-- |\ \-- | \ --
- -- | --
- -- \---- --
- -- Minecraft Music Maker --
- -- --
- ------------------------------------
- ------------------------------------
- -- V1.0.1.1 FOR CC 1.56, --
- -- REQUIRES IMMIBIS PERIPHERALS --
- ------------------------------------
- ---------
- --SETUP--
- ---------
- term.clear()
- term.setCursorPos(1, 1)
- if (not term.isColor()) then
- print("You need to use an Advanced (Golden) Computer with this program! To craft one, use the normal Computer recipe and replace all Stone with Gold Ingots.")
- error("Can't run - improper computer setup", 0)
- end
- local function getDev(d, skip) --snippet from forums - find any side device 'd' is located on
- for _, side in pairs(rs.getSides()) do
- if (peripheral.isPresent(side)) then
- if (peripheral.getType(side) == string.lower(d)) then
- if(skip == 0) then
- return side
- else
- skip = skip - 1
- end
- end
- end
- end
- return nil
- end
- local function tContains(t, find) --naive table contains function - assumes everything is a table
- for _, i in pairs(t) do
- if(i == find) then return true end
- end
- return false
- end
- local monExists = false
- local mon = getDev("monitor", 0) --for the vuemeter, optional - advanced monitor (nyi, just ignore this)
- if(not mon) then
- print("You can attatch at least two advanced monitors (horizontally) to your computer for a visualizer.")
- print("Press enter to continue.")
- read()
- term.clear()
- term.setCursorPos(1, 1)
- else
- mon = peripheral.wrap(mon)
- mon.getSize()
- mszx, mszy = mon.getSize()
- if mszx >= 18 and mszy >= 5 and mon.isColor() then
- monExists = true
- else
- print("You must have at least two Advanced Monitors placed horizontally (widescreen) for a visualizer.")
- print("Press enter to continue.")
- read()
- term.clear()
- term.setCursorPos(1, 1)
- end
- end
- local spka = getDev("speaker", 0) --for sound, required - immibis peripherals speaker
- local spkb = getDev("speaker", 1) --for sound, required - immibis peripherals speaker
- local validpairs = {"frontback", "leftright"}
- if ((not spka) or (not spkb)) then
- print("You need two speakers from the Immibis' Peripherals mod to use this program! They must be on opposite sides of the computer, not top or bottom!")
- error("Can't run - improper computer setup", 0)
- end
- local spkchain = spka .. spkb
- if (not tContains(validpairs, spkchain)) then --we want stereo to work at least a little right, so make sure there are two speakers on opposite sides
- print("Your speakers must be on the LEFT AND RIGHT or FRONT AND BACK sides of the computer!")
- error("Can't run - improper computer setup", 0)
- end
- --volume variables
- local globVol = 15 --parent volume
- local partVol = 1 --amount of parent volume set by volume commands
- local panning = 0.5 --0 = left, 1 = right
- --key variables
- local ctrlFlag = false --is the ctrl key down
- --buffers, buffer flags
- local copyBuffer={} --copied data
- local copyStartX = 0 --copied data location flags
- local copyStartY = 0
- local copyEndX = 0
- local copyEndY = 0
- local extModulesNote={} --all modules
- local loadedModuleNote={} --current module
- local loadedModuleIndex = 1 --current module number
- local modStart = 1 --start of play loop
- local modEnd = 1 --end of play loop
- local modIndex = 1 --playing module
- local modLetterIndex = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} --just a useful reference for number-to-letter stuff
- --selection variables
- local colPlay = 1 --selected column (for play)
- local setCol = 1 --selected column (for edit)
- local setRow = 1 --selected row (for edit)
- local selStartX = 1 --flags for selection (for batch edit)
- local selStartY = 1
- local selEndX = 1
- local selEndY = 1
- --display variables
- local displayHelp = true --show the help?
- local scrollAmt = 0 --horizontal scroll in notes
- local szx, szy = term.getSize() --used to determine how much of the screen to draw a bar
- local visNotes = {}
- local mszx = 0
- local mszy = 0
- if mon then
- local mszx, mszy = mon.getSize() --peripheral.call(mon, "getSize") --used to center the vuemeter
- end
- local visVals = {0, 0, 0, 0, 0, 0, 0, 0} --0 to 3 - 'time' value for each channel
- for i = 1, 8 do
- visNotes[i] = {}
- for j = 1, mszy do
- visNotes[i][j] = 0
- end
- end
- local visColIndex = {colors.black, colors.gray, colors.green, colors.lime}
- --song and sound variables
- local tempo = 32 --rate of play - quarter notes per second
- local setOct = 3 --lowermost octave to 'type in' - the qwerty row
- local noteLetterIndex = {"C ", "C#", "D ", "D#", "E ", "F ", "F#", "G ", "G#", "A " , "A#", "B "} --used for text
- local freqLetterIndex = {16.35, 17.32, 18.35, 19.45, 20.60, 21.83, 23.12, 24.50, 25.96, 27.50, 29.14, 30.87} --used for calculation - frequencies of notes starting from C
- local playSong = false --auto increment song?
- local detcode = "9gkKQgoJwcKbeYthmSvlbn9UAUmPdz1a" --randomly generated code pasted into each file to identify it
- for i = 1, 16 do --set up the arrays
- extModulesNote[i] = {}
- for j = 1, 8 do
- extModulesNote[i][j] = {}
- for k = 1, 64 do
- extModulesNote[i][j][k] = -1
- end
- end
- end
- for j = 1, 8 do
- loadedModuleNote[j] = {}
- for k = 1, 64 do
- loadedModuleNote[j][k] = -1
- end
- end
- ----------------
- --MAIN PROGRAM--
- ----------------
- function pushVuemeter(index)
- for i = 1, 8 do
- if loadedModuleNote[i][index] == -1 then
- visVals[i] = visVals[i] > 0 and visVals[i] - 1 or 0
- visNotes[i][1] = 0
- elseif loadedModuleNote[i][index] == -2 then
- visVals[i] = 0
- visNotes[i][1] = 0
- else
- visVals[i] = 3
- visNotes[i][1] = 1
- end
- for j = mszy, 2, -1 do
- visNotes[i][j] = visNotes[i][j-1]
- end
- end
- end
- function drawVuemeter()
- mszx, mszy = mon.getSize()
- mon.clear()
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.black)
- for i = 1, mszy do
- mon.setCursorPos(mszx / 2 + 1, i)
- mon.write(" ")
- end
- for i = 1, 8 do
- for j = 1, mszy do
- mon.setBackgroundColor(visColIndex[visVals[i] + 1])
- if visNotes[i][j] == 1 then
- if (j - colPlay) % 5 == 1 then
- mon.setBackgroundColor(colors.purple)
- elseif (j - colPlay) % 5 == 2 then
- mon.setBackgroundColor(colors.magenta)
- elseif (j - colPlay) % 5 == 3 then
- mon.setBackgroundColor(colors.lightBlue)
- elseif (j - colPlay) % 5 == 4 then
- mon.setBackgroundColor(colors.cyan)
- else
- mon.setBackgroundColor(colors.blue)
- end
- end
- mon.setCursorPos(mszx/2 + 1 - i, j)
- mon.write(" ")
- mon.setCursorPos(mszx/2 + 1 + i, j)
- mon.write(" ")
- end
- end
- end
- function playCol(index) --play a column to the speaker
- if monExists then
- pushVuemeter(index)
- drawVuemeter()
- end
- peripheral.call(spka, "setAttenuation" , globVol * partVol * panning)
- peripheral.call(spkb, "setAttenuation" , globVol * partVol * (1 - panning))
- for i = 1, 8 do
- if(loadedModuleNote[i][index] >= 0) then peripheral.call(spka, "start", i-1, freqLetterIndex[loadedModuleNote[i][index]-math.floor(loadedModuleNote[i][index]/12)*12+1]*math.pow(2, math.floor(loadedModuleNote[i][index]/12))) end
- if(loadedModuleNote[i][index] == -2) then peripheral.call(spka, "stop", i-1) end
- if(loadedModuleNote[i][index] >= 0) then peripheral.call(spkb, "start", i-1, freqLetterIndex[loadedModuleNote[i][index]-math.floor(loadedModuleNote[i][index]/12)*12+1]*math.pow(2, math.floor(loadedModuleNote[i][index]/12))) end
- if(loadedModuleNote[i][index] == -2) then peripheral.call(spkb, "stop", i-1) end
- end
- end
- function stopCol() --stop all sound
- for i = 1, 8 do
- peripheral.call(spka, "stop", i-1)
- peripheral.call(spkb, "stop", i-1)
- end
- end
- function saveSong(fname) --save song to a file - will be replaced with a dialog
- f = fs.open(fname, "w")
- f.writeLine(detcode)
- f.writeLine("ThinkInvisible - CTracker song file")
- f.writeLine("You probably shouldn't change this manually")
- f.writeLine(modStart)
- f.writeLine(modEnd)
- for i = modStart, modEnd do
- for j = 1, 8 do
- for k = 1, 64 do
- f.writeLine(extModulesNote[i][j][k])
- end
- end
- end
- f.writeLine(tempo)
- f.close()
- end
- function loadSong(fname) --load a song from a file - will be replaced with a dialog
- f = fs.open(fname, "r")
- if (not (f.readLine() == detcode)) then
- f.close()
- term.write("That isn't a valid CTracker song.")
- read()
- return false
- end
- f.readLine()
- f.readLine()
- modStart = tonumber(f.readLine())
- modEnd = tonumber(f.readLine())
- for i = modStart, modEnd do
- for j = 1, 8 do
- for k = 1, 64 do
- extModulesNote[i][j][k] = tonumber(f.readLine())
- end
- end
- end
- tempo = tonumber(f.readLine())
- f.close()
- loadModule(modStart)
- end
- function loadModule(index) --load a module to the editing buffer
- term.clear()
- for i = 1, 8 do
- for j = 1, 64 do
- loadedModuleNote[i][j] = extModulesNote[index][i][j]
- end
- end
- loadedModuleIndex = index
- end
- function saveModule(index) --save the editing buffer to a module
- term.clear()
- for i = 1, 8 do
- for j = 1, 64 do
- extModulesNote[index][i][j] = loadedModuleNote[i][j]
- end
- end
- end
- function setNote(channel, note, key) --set a note, obviously - just a safeguard
- if(key == nil) then key = -1 end
- loadedModuleNote[channel][note] = key
- end
- while true do --main program loop
- term.setBackgroundColor(colors.gray)
- for j = 1, 4 do --draw the top menu bar
- term.setCursorPos(1, j)
- for i = 1, szx do
- term.write(" ")
- end
- end
- term.setCursorPos(1, 1) --write the button text
- if(displayHelp == true) then term.setBackgroundColor(colors.white) term.setTextColor(colors.black) end
- term.write("Help")
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.write(" ML " .. modLetterIndex[modStart] .. " " .. modLetterIndex[modEnd] .. " (12, 34 modify)")
- term.setCursorPos(1, 2)
- term.write("SAVE LOAD OCTS " .. setOct .. " (56 modify)")
- term.setCursorPos(1, 3)
- if(playSong == true) then term.setTextColor(colors.red) else term.setTextColor(colors.white) end
- term.write("Play")
- term.setCursorPos(1, 4)
- term.write("Tempo " .. tempo .. " (78 modify)")
- term.setCursorPos(1, 5)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.gray)
- for i = 1, szx do --draw the divider
- term.write(" ")
- end
- term.setCursorPos(1, 5) --write status bar stuff
- term.write("MOD ABCDEFGHIJKLMNOP " .. setCol .. " " .. setRow)
- term.setTextColor(colors.gray)
- term.setCursorPos(5, 5)
- term.write(tostring(loadedModuleIndex))
- term.setCursorPos(7, 5)
- term.write("A")
- term.setCursorPos(6 + loadedModuleIndex, 5)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.write(" ")
- for i = 1, 64 do --draw a the notes!
- for j = 1, 8 do
- term.setCursorPos(i*3 - scrollAmt * 3 - 2 , j+5)
- term.setBackgroundColor(colors.black) --default notes to a black background with white text
- term.setTextColor(colors.white)
- if(i == setCol or setRow == j) then term.setBackgroundColor(colors.blue) elseif(i % 4 == 1) then term.setBackgroundColor(colors.gray) end
- --if the column or row is the selected one set the background to blue. if the column is a first beat (4/4 time) set the background to grey.
- if(playSong == true) then
- if(i == colPlay) then term.setBackgroundColor(colors.lime) term.setTextColor(colors.black) end
- else
- if(i == colPlay) then term.setBackgroundColor(colors.yellow) term.setTextColor(colors.black) end
- end
- --if the playing position is at this column set it to yellow (paused) or lime.
- if(i == setCol and setRow == j) then term.setBackgroundColor(colors.green) term.setTextColor(colors.black) end
- if((i >= selStartX) and (i <= selEndX) and (j >= selStartY) and (j <= selEndY)) then
- term.setTextColor(colors.blue)
- term.setBackgroundColor(colors.orange)
- end
- if(loadedModuleNote[j][i] == -1) then term.write("--") elseif(loadedModuleNote[j][i] == -2) then term.write("==") else
- term.write(noteLetterIndex[1 + loadedModuleNote[j][i] - math.floor(loadedModuleNote[j][i]/12)*12]) end
- term.write(tostring(math.floor(loadedModuleNote[j][i]/12)))
- end
- end
- if(displayHelp == true) then
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.red)
- term.setCursorPos(1, 6)
- print("L-click select cell (---); 9/0 set selection at selected cell; shift/enter transpose; Ctrl-x/ctrl-c/ctrl-v work; Letter key set note; - continue note; = stop note; Left-click module letter (MOD) - load, right-click save; Arrow keys scroll and move.")
- term.setCursorPos(1, 1)
- end
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- evt, aa, ab, ac = os.pullEvent()
- if (playSong == true and evt == "timer" and aa == lastPlay) then
- scrollAmt = colPlay
- if (scrollAmt > 47) then scrollAmt = 47 end
- selCol = colPlay
- playCol(colPlay)
- colPlay = colPlay + 1
- if(colPlay == 65) then
- modIndex = modIndex + 1
- if(modIndex > modEnd) then modIndex = modStart end
- loadModule(modIndex)
- colPlay = 1
- end
- lastPlay = os.startTimer(4/tempo)
- end
- if(evt == "key" and aa == 41) then
- peripheral.call(spka, "shutdown")
- peripheral.call(spkb, "shutdown")
- term.clear()
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- return
- end
- if (evt == "key" and displayHelp == false) then
- if (aa == 29) then
- ctrlFlag = not ctrlFlag
- end
- if ctrlFlag == true then
- if(selStartX > 0 and selStartY > 0 and selEndX > 0 and selEndY > 0) then
- if (aa == 46) then --copy
- copyStartX = selStartX
- copyEndX = selEndX
- copyStartY = selStartY
- copyEndY = selEndY
- for i = copyStartY, copyEndY do
- copyBuffer[i] = {}
- for j = copyStartX, copyEndX do
- copyBuffer[i][j] = loadedModuleNote[i][j]
- end
- end
- elseif (aa == 45) then --cut
- copyStartX = selStartX
- copyEndX = selEndX
- copyStartY = selStartY
- copyEndY = selEndY
- for i = copyStartY, copyEndY do
- copyBuffer[i] = {}
- for j = copyStartX, copyEndX do
- copyBuffer[i][j] = loadedModuleNote[i][j]
- loadedModuleNote[i][j] = -1
- end
- end
- elseif (aa == 47) then --paste
- for i = copyStartY, copyEndY do
- for j = copyStartX, copyEndX do
- loadedModuleNote[i+setRow-1][j+setCol-1] = copyBuffer[i][j]
- end
- end
- end
- end
- if (aa == keys.a) then
- selStartX = 1
- selStartY = 1
- selEndX = 64
- selEndY = 8
- elseif (aa == keys.b) then
- selStartX = 0
- selStartY = 0
- selEndX = 0
- selEndY = 0
- end
- if not (aa == 29) then
- ctrlFlag = false
- end
- else
- if (aa == 211) then
- for i = selStartX, selEndX do
- for j = selStartY, selEndY do
- loadedModuleNote[j][i] = -1
- end
- end
- elseif (aa == 8) then
- tempo = tempo - 1
- if(tempo < 1) then tempo = 1 end
- elseif (aa == 9) then
- tempo = tempo + 1
- if(tempo > 400) then tempo = 400 end
- elseif (aa == 54) then
- for i = selStartX, selEndX do
- for j = selStartY, selEndY do
- if loadedModuleNote[j][i] > 0 then
- loadedModuleNote[j][i] = loadedModuleNote[j][i] - 1
- end
- end
- end
- elseif (aa == 28) then
- for i = selStartX, selEndX do
- for j = selStartY, selEndY do
- if loadedModuleNote[j][i] > 0 and loadedModuleNote[j][i] < 144 then
- loadedModuleNote[j][i] = loadedModuleNote[j][i] + 1
- end
- end
- end
- elseif(aa == 10) then
- selStartX = setCol;
- selStartY = setRow;
- if selStartX > selEndX then selStartX = selEndX end
- if selStartY > selEndY then selStartY = selEndY end
- elseif(aa == 11) then
- selEndX = setCol;
- selEndY = setRow;
- if selEndX < selStartX then setEndX = selStartX end
- if selEndY < selStartY then selEndY = selStartY end
- elseif (aa == 2) then
- modStart = modStart - 1
- if(modStart < 1) then modStart = 1 end
- modIndex = modStart
- elseif (aa == 3) then
- modStart = modStart + 1
- if(modStart > modEnd) then modStart = modEnd end
- modIndex = modStart
- elseif (aa == 4) then
- modEnd = modEnd - 1
- if(modEnd < modStart) then modEnd = modStart end
- elseif (aa == 5) then
- modEnd = modEnd + 1
- if(modEnd > 16) then modEnd = 16 end
- elseif(aa == 205) then
- scrollAmt = scrollAmt + 1
- setCol = setCol + 1;
- if (setCol > 64) then setCol = 64 end
- if (scrollAmt > 47) then scrollAmt = 47 end
- term.clear()
- elseif(aa == 203) then
- scrollAmt = scrollAmt - 1
- setCol = setCol - 1;
- if(setCol < 1) then setCol = 1 end
- if scrollAmt < 0 then scrollAmt = 0 end
- term.clear()
- elseif(aa == 200) then
- setRow = setRow - 1;
- if(setRow < 1) then setRow = 1 end
- elseif(aa == 208) then
- setRow = setRow + 1;
- if(setRow > 8) then setRow = 8 end
- elseif aa == keys.q then
- setNote(setRow, setCol, 0 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.w then
- setNote(setRow, setCol, 1 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.e then
- setNote(setRow, setCol, 2 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.r then
- setNote(setRow, setCol, 3 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.t then
- setNote(setRow, setCol, 4 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.y then
- setNote(setRow, setCol, 5 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.u then
- setNote(setRow, setCol, 6 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.i then
- setNote(setRow, setCol, 7 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.o then
- setNote(setRow, setCol, 8 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.p then
- setNote(setRow, setCol, 9 + 12 * setOct)
- playCol(setCol)
- elseif aa == 26 then
- setNote(setRow, setCol, 10 + 12 * setOct)
- playCol(setCol)
- elseif aa == 27 then
- setNote(setRow, setCol, 11 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.a then
- setNote(setRow, setCol, 12 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.s then
- setNote(setRow, setCol, 13 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.d then
- setNote(setRow, setCol, 14 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.f then
- setNote(setRow, setCol, 15 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.g then
- setNote(setRow, setCol, 16 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.h then
- setNote(setRow, setCol, 17 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.j then
- setNote(setRow, setCol, 18 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.k then
- setNote(setRow, setCol, 19 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.l then
- setNote(setRow, setCol, 20 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.semiColon then
- setNote(setRow, setCol, 21 + 12 * setOct)
- playCol(setCol)
- elseif aa == keys.apostrophe then
- setNote(setRow, setCol, 22 + 12 * setOct)
- playCol(setCol)
- elseif aa == 43 then
- setNote(setRow, setCol, 23 + 12 * setOct)
- playCol(setCol)
- elseif aa == 44 then
- setNote(setRow, setCol, 24 + 12 * setOct)
- playCol(setCol)
- elseif aa == 45 then
- setNote(setRow, setCol, 25 + 12 * setOct)
- playCol(setCol)
- elseif aa == 46 then
- setNote(setRow, setCol, 26 + 12 * setOct)
- playCol(setCol)
- elseif aa == 47 then
- setNote(setRow, setCol, 27 + 12 * setOct)
- playCol(setCol)
- elseif aa == 48 then
- setNote(setRow, setCol, 28 + 12 * setOct)
- playCol(setCol)
- elseif aa == 49 then
- setNote(setRow, setCol, 29 + 12 * setOct)
- playCol(setCol)
- elseif aa == 50 then
- setNote(setRow, setCol, 30 + 12 * setOct)
- playCol(setCol)
- elseif aa == 51 then
- setNote(setRow, setCol, 31 + 12 * setOct)
- playCol(setCol)
- elseif aa == 52 then
- setNote(setRow, setCol, 32 + 12 * setOct)
- playCol(setCol)
- elseif aa == 53 then
- setNote(setRow, setCol, 33 + 12 * setOct)
- playCol(setCol)
- elseif aa == 12 then
- setNote(setRow, setCol, -1)
- playCol(setCol)
- elseif aa == 13 then
- setNote(setRow, setCol, -2)
- playCol(setCol)
- elseif aa == 6 then
- setOct = setOct - 1
- if(setOct < 1) then setOct = 1 end
- elseif aa == 7 then
- setOct = setOct + 1
- if(setOct > 5) then setOct = 5 end
- end
- end
- end
- if(evt == "mouse_click") then
- if(aa == 1) then
- if(ac == 5 and ab > 39 and ab < 44) then
- term.clear()
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- return
- end
- if(ac == 3) then
- if(ab < 5) then
- loadModule(modIndex)
- playSong = not playSong
- stopCol()
- colPlay = 1
- lastPlay = os.startTimer(4/tempo)
- end
- end
- if(ac == 1 and ab < 5) then
- displayHelp = not displayHelp
- term.clear()
- end
- if(ac == 2) then
- if(ab > 0 and ab < 4) then
- stopCol()
- term.clear()
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- print("Enter a file name to save.")
- n = read()
- saveSong(n)
- term.clear()
- end
- if(ab > 4 and ab < 9) then
- stopCol()
- term.clear()
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- print("Enter a file name to load.")
- n = read()
- loadSong(n)
- term.clear()
- end
- end
- if(displayHelp == false) then
- if(ac == 6) then
- setRow = 1
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 7) then
- setRow = 2
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 8) then
- setRow = 3
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 9) then
- setRow = 4
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 10) then
- setRow = 5
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 11) then
- setRow = 6
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 12) then
- setRow = 7
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 13) then
- setRow = 8
- setCol = math.ceil(ab / 3) + scrollAmt
- end
- if(setCol > 64) then setCol = 64 end
- if(ac == 5 and ab > 6 and ab < 23) then
- loadModule(ab - 6)
- end
- end
- end
- if(aa == 2) then
- if(displayHelp == false) then
- if(ac == 6) then
- setRow = 1
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 7) then
- setRow = 2
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 8) then
- setRow = 3
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 9) then
- setRow = 4
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 10) then
- setRow = 5
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 11) then
- setRow = 6
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 12) then
- setRow = 7
- setCol = math.ceil(ab / 3) + scrollAmt
- elseif(ac == 13) then
- setRow = 8
- setCol = math.ceil(ab / 3) + scrollAmt
- end
- if(ac > 5 and ac < 14) then
- if(setCol > 64) then setCol = 64 end
- setNote(setRow, setCol, -1, 0)
- playCol(setCol)
- end
- if(ac == 5 and ab > 6 and ab < 23) then
- saveModule(ab - 6)
- end
- end
- end
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
Advertisement
Add Comment
Please, Sign In to add comment