version$="0.19" 'chr#[0..]80 font and ui 'rom#2 ui background 'for track editor: '================= 'one track need: '- note, sharp?, octave: 3 cells '- sound: 1 cell '- volume: 1 cell '- effect: 2 cells 'cost 7 cells 'by doubling it's 14 cells 'minimal width is 22 cells 'I can add: '- row number: 3 cells (with space) 'There is still space for a floating panel on the side of the track editor 'total: 14+3=17 'in the bottom bar, i need '- a keyboard (octave included) '- delete '- stop sound '- file '- record '- pause/pause '- restart NO '- a track selector '- switch to song editor '- switch to sound editor '- insert '- copy/paste/clear using selection '- transpose note (octave) using selection '- undo '- zoom '- auto down: 0,1,2,4 'that's a lot of things 'behavior: '- allow to seed during play? '- slide keyboard to access all notes (including octave) '- fast access to track selection '- minimap? NO '- add effect description '- automaticly change bottom bar according to selected column (note/sound/volume/effect) 'a track is 32 rows, should use a quarter of a bg but actually I need space above and below, so it should take 0,0 to 31,63 'bg#3 [| ] for column and row selection, take 0,0..31,63 'bg#2 [| ] track data, take 0,0..31,63 'bg#1 [^^] edited frieze, take 0,0..63,31 'bg#0 [^ ] bottombar 0,0..31,31 'bg#0 [vv] piano 0,32..63,63 'for track selection 'if can represent a track by creating character. 'there is 32 row and 64 pixels per character 'what about using 4pixels wide on 4 characters 'a put them of the bottom or top as a selector and a minimap 'will required 16 cells wide only to fit all, hm maybe if need space around 'i dont think its a good idea 'I can use a top bar with #num and track icon maybe 'slide to change 'bottom '[#14] [play] [0] [undo] [zoom] '[snd||tra||sng] [file] [edit] 'side '[rec] '[del] '[ins] '[off] 'edit '[selec] [copy] [paste] [back] 'try to remove the side bar 'use space to show effect name instead '[rec] [del] [ins] [off] '[#14] [play] [0] [undo] [zoom] '[snd||tra||sng] [file] [edit] '[ins][del] [cutoff] '[play] [rec||0] [undo] [zoom] '[snd||tra||sng] [file] [edit] 'when note column show keyboard 'when sound column show sound selector 'when volume column show volume slider 'when effect column show effect editor 'sound editor: '============= 'canvas: 'sound: wave, pulse width, length 'envelope: attack, decay, sustain, release 'Can I show it visually? 'lfo: rate, frequency amount, volume amount, pulse width amount, wave, invert mode, environment mode, trigger mode 'floating: 'keys 'bottom: '[cutoff] [copy] [past] '[snd||tra||mus] [file] files '=========================layout: 'used to detect if the layout has changed global shownw,shownh,resized shownw=0 :shownh=0 :resized=0 'used to adapt the ui according to the device aspect ratio global short,tall,wide 'call this after 'wait vbl' and check var 'resized' sub checkresize if shownw<>shown.w or shownh<>shown.h-safe.b-keyboard then resized=-1 shownw=shown.w :shownh=shown.h-safe.b-keyboard 'for capturing program icon shownw=180 : shownh=180 : resized=0 tall=0 : short=0 : wide=0 r=shownw/shownh if r>0.7 then short=1 if r<0.5 then tall=1 if r>0.9 then wide=-1 if tall then trace"tall" if short then trace"short" if wide then trace"wide" end if end sub '''SETUP 'needed for floating bar global flt, fltr, flty 'flt= floating bar type ' =0 no floating bar ' =1 piano keys flt=0 'flted= floating bar has changed flted=0 'fltr= raster position for floating bar fltr=-999 'flth= height in cell in bg, not in screen flth=0 'flty= offset in pixel for raster flty=0 'needed for bottom bar global tlb, tlbr, tlbr1, tlbr2 'tlb= bottom bar type ' =0 no bottom bar ' =1 sounder main tlb=0 'tlbed= bottom bar has changed tlbed=0 'tlbr= raster position for bottom bar tlbr=-999 'tlbh= height in cell in bg, not in screen tlbh=0 'tlby1= 'tlbl2= to shorten the bottom bar, the row to shorten in cell, relative to the whole bottom bar bg tlby1=-99 :tlby2=-99 'tlbr1= 'tlbr2= to shorten the bottom bar, the raster position where 8 pixels row will be removed during raster interrupt tlbr1=999 :tlbr2=999 'needed for keys global keysx 'keysp= pressed key pitch ' =0 not pressed ' =1..96 pressed keysp=0 'keysg= keys floating bar gesture ' =0 no gesture, enable ' =1 dragging, but no direction yet ' =2 horizontal dragging keysg=0 'keyss= keys playback state ' =0 not playing ' =1 playing note keyss=0 'keysx= horizontal drag position in pixel keysx=0 'mapped touch position in cell to pitch, two values per column, upper and lower part of the key '1st octave, from C to B data 1,1, 2,1, 2,3, 4,3, 4,5, 5,5, 6,6, 7,6, 7,8, 9,8, 9,10, 11,10, 11,12, 12,12 dim keysm(13,1) for i=0 to 13: read keysm(i,0), keysm(i,1): next i '''RASTER sub r 'temp: if raster=0 then poke $ff32,0 on flt goto r_tlb, r_keys r_keys: if raster=fltr then poke $ff32,%100010 :'double bg#0 scroll 0,keysx mod 224,-fltr-512+flty else if raster=tlbr-5 then scroll 0,keysx mod 224,-fltr-512+flty*2 end if goto r_tlb r_tlb: on tlb goto r_end, r_ser r_ser: if raster=tlbr then poke $ff32,%10 :'single bg#0 scroll 0,0,-tlbr+4 :'shorten top by 4 pixel rows else if raster=tlbr1 then scroll 0,0,-tlbr+12 end if goto r_end r_end: end sub '''MAIN 'temp: flt=1 :flted=-1 tlb=1 :tlbed=-1 font 0 on raster call r system 5,1 :'double bg#0 do 'resized call checkresize if resized then resized=0 flted=-1 :tlbed=-1 end if 'redraw if flted then on flt gosub none, keys_redraw if tlbed then on tlb gosub none, serm_redraw 'layout if flted or tlbed then tlbr=shownh-tlbh*8 :tlbed=0 add tlbr,4 :'shorten top by 4 pixel rows tlbr1=-999 if short and tlby1>=0 then tlbr1=tlbr+tlby1*8-4 trace"tlbr1",tlbr1 end if fltr=tlbr-flth*16-1 :flted=0 flty=0 if tall then else if short then add fltr,48 flty=24 else if wide then add fltr,64 flty=32 else add fltr,32 flty=16 end if end if 'input on flt gosub none, keys_input 'update on flt gosub none, keys_update wait vbl loop none: return '''KEYS keys_redraw: trace"=keys_redraw" bg 0 bg copy 0,0,14,6 to 0,32 bg copy 0,0,14,6 to 14,32 flth=6 return keys_input: on keysg goto keys_input_0, keys_input_1, keys_input_2 keys_input_0: 'detect gesture, play pressed key if tap and touch.y>=fltr and touch.ydy and dx>12 then keysp=0 trace "keysp",keysp keysg=2 :goto keys_input_2 end if end if return keys_input_2: 'horizontal dragging if not touch then keysg=0 keysp=0 trace "keysp",keysp else 'drag and limit keysx=clamp(px+touch.px-touch.x,0,224*7-shownw) end if return keys_update: if keysp>0 and not keyss then play 0,clamp(keysp,1,96),0 keyss=-1 else if keysp=0 and keyss then stop 0 keyss=0 end if return '''SERM serm_redraw: trace"=serm_redraw" bg 0 attr 0 bg fill 0,0 to 31,31 char 64 bg copy 0,6,29,3 to 0,1 bg copy 0,9,29,3 to 0,5 tlbh=9 tlby1=4 return #1:MAIN PALETTES 00030105000330320003021E00030018 002E013B090302000001010200030507 #2:MAIN CHARACTERS 00000000000000000000000000000000 FFFFFFFFFFFFFFFFFFE7E7E7E7FFE7FF FFFFFFFFFFFFFFFFFF9393DBFFFFFFFF FFFFFFFFFFFFFFFFFFDB81DBDB81DBFF FFFFFFFFFFFFFFFFFFF7C1C7F1C1F7FF FFFFFFFFFFFFFFFFFF9D9BF7EFD9B9FF FFFFFFFFFFFFFFFFFFE3CBC7919BC5FF FFFFFFFFFFFFFFFFFFE7E7CFFFFFFFFF FFFFFFFFFFFFFFFFFFF3E7CFCFE7F3FF FFFFFFFFFFFFFFFFFFCFE7F3F3E7CFFF FFFFFFFFFFFFFFFFFFFFDBE781E7DBFF FFFFFFFFFFFFFFFFFFFFE7E781E7E7FF FFFFFFFFFFFFFFFFFFFFFFFFE7E7CFFF FFFFFFFFFFFFFFFFFFFFFFFF81FFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFE7E7FF FFFFFFFFFFFFFFFFFFF9F3E7CF9FBFFF FFFFFFFFFFFFFFFFFFC399918999C3FF FFFFFFFFFFFFFFFFFFE7C7E7E7E781FF FFFFFFFFFFFFFFFFFFC399F3E7CF81FF FFFFFFFFFFFFFFFFFFC399F3F999C3FF FFFFFFFFFFFFFFFFFF999981F9F9F9FF FFFFFFFFFFFFFFFFFF819F83F9F983FF FFFFFFFFFFFFFFFFFFE3CF839999C3FF FFFFFFFFFFFFFFFFFF81F9F3E7CFCFFF FFFFFFFFFFFFFFFFFFC399C39999C3FF FFFFFFFFFFFFFFFFFFC399C1F999C3FF FFFFFFFFFFFFFFFFFFFFFFE7FFE7FFFF FFFFFFFFFFFFFFFFFFFFFFE7FFE7CFFF FFFFFFFFFFFFFFFFFFFFF3E7CFE7F3FF FFFFFFFFFFFFFFFFFFFFFF81FF81FFFF FFFFFFFFFFFFFFFFFFFFCFE7F3E7CFFF FFFFFFFFFFFFFFFFFFC399F3E7FFE7FF FFFFFFFFFFFFFFFFFFC39991919FC3FF FFFFFFFFFFFFFFFFFFE7C399819999FF FFFFFFFFFFFFFFFFFF839983999983FF FFFFFFFFFFFFFFFFFFC3999F9F99C3FF FFFFFFFFFFFFFFFFFF879399999387FF FFFFFFFFFFFFFFFFFF819F879F9F81FF FFFFFFFFFFFFFFFFFF819F879F9F9FFF FFFFFFFFFFFFFFFFFFC39F919999C3FF FFFFFFFFFFFFFFFFFF999981999999FF FFFFFFFFFFFFFFFFFFC3E7E7E7E7C3FF FFFFFFFFFFFFFFFFFFE1F9F9F999C3FF FFFFFFFFFFFFFFFFFF999387879399FF FFFFFFFFFFFFFFFFFF9F9F9F9F9F81FF FFFFFFFFFFFFFFFFFFBD9981819999FF FFFFFFFFFFFFFFFFFF998981919999FF FFFFFFFFFFFFFFFFFFC399999999C3FF FFFFFFFFFFFFFFFFFF8399839F9F9FFF FFFFFFFFFFFFFFFFFFC399999593C1FF FFFFFFFFFFFFFFFFFF839983879399FF FFFFFFFFFFFFFFFFFFC19FC3F9F983FF FFFFFFFFFFFFFFFFFF81E7E7E7E7E7FF FFFFFFFFFFFFFFFFFF9999999999C3FF FFFFFFFFFFFFFFFFFF99999999C3E7FF FFFFFFFFFFFFFFFFFF9999818199BDFF FFFFFFFFFFFFFFFFFF99C3E7C39999FF FFFFFFFFFFFFFFFFFF9999C3E7E7E7FF FFFFFFFFFFFFFFFFFF81F3E7CF9F81FF FFFFFFFFFFFFFFFFFFC3CFCFCFCFC3FF FFFFFFFFFFFFFFFFFF9FCFE7F3F9FDFF FFFFFFFFFFFFFFFFFFC3F3F3F3F3C3FF FFFFFFFFFFFFFFFFFFE7C399FFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFF81FF FFFFFFFFFFFFFFFF0000000000000000 FFFFFFFFFFFFFFFF3F3F3F3F3F3F3F3F FFFFFFFFFFFFFFFF0000FFFFFFFFFFFF FFFFFFFFFFFFFFFF0000071F1F3F3F3F FFFFFFFFFFFFFFFF0000FFFF0000FFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 80808080808080807F7F7F7F7F7F7F7F 808080808080C0FF7F7F7F7F7F7F3F00 7F7F7F7F7F7F7F7FFFFFFFFFFFFFFFFF 7F7F7F7F7F7F3F01FFFFFFFFFFFFFFFE #3:MAIN BG 00001D5046054805480D4805480D460D 46054805480D4805480D4805480D460D 40004000400040004000400040004000 40004000400040004000400040004605 4805480D4805480D460D46054805480D 4805480D4805480D460D400040004000 40004000400040004000400040004000 400040004000400046054905490D4905 490D460D46054905490D4905490D4905 490D460D400040004000400040004000 40004000400040004000400040004000 40004605460D4605460D4605460D4605 460D4605460D4605460D4605460D4000 40004000400040004000400040004000 4000400040004000400040004605460D 4605460D4605460D4605460D4605460D 4605460D4605460D4000400040004000 40004000400040004000400040004000 4000400040004705470D4705470D4705 470D4705470D4705470D4705470D4705 470D4000400040004000400040004000 40004000400040004000400040004000 40004000430042004200420042004200 42004308400043004200420042004200 43084000430042004200420042004308 40104010401040004000400040004100 2300350034002F002600260041084000 410023102F1030003900410840004100 30002100330034004108401040104010 40004000400040004310421042104210 42104210421043184000431042104210 42104210431840004310421042104210 42104318401040104010400040004000 40004300420042004200420042004200 42004200420042004200420042004308 40004300420042004200420043084000 40004000400040004000400041003300 2E002400450045003400320021004500 45002D00350033004108400041002600 29002C00250041084000400040004000 40004000400043104210421042104210 42104210421042104210421042104210 42104318400043104210421042104210 43184000400040004000400040004000 43004200420042004200430840004300 42004200420042004200430840004300 42004308400043004200420042004200 43084000400040004000410030002C00 21003900410840004100320025002300 451010004108400041003A0041084000 410035002E0024002F00410840004000 40004000431042104210421042104318 40004310421042104210421042104318 40004310421043184000431042104210 42104210431840004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000400040004000 40004000400040004000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000