7. Pattern: calculate pattern frame sizes = Let(Frame_W,S_Frame_W+(IN2*IN4)+IN5), ;Calc pattern frame width~Let(Frame_H,(S_Frame_H*2)+IN6), ;Calc pattern frame height~Let(Frame_X,(PixScreenWidth/2)-(Frame_W/2)), ;Calc pattern frame X position~Let(Frame_Y,(PixScreenHeight-Frame_H-200)) ;Calc pattern frame Y position
8. Pattern: setup pattern frames = PixActive(3), ;Set pattern buffer frame active~PixFill(0), ;Fill pattern buffer frame with black~PixSize(Frame_W,Frame_H), ;Set pattern buffer frame size~PixOff, ;Set pattern buffer frame invisible~PixActive(4), ;Set pattern frame active~PixFill(0), ;Fill pattern frame with black~PixSize(Frame_W,Frame_H), ;Set pattern frame size~PixMove(Frame_X,Frame_Y), ;Place pattern frame on screen~PixShow(1), ;Make pattern frame visible~PixOnTop(1) ;Make pattern frame stay on top of other frames
9. Pattern: test if draw swatch = Switch(V0<(IN2-1),Me+1,0) ;If step count is < 0 based steps, add swatch to pattern
10. Pattern: build pattern = V0.(V0+1), ;Increment step counter~Ex(Me+1), ;Process swatch~Ex(Me+2), ;Process pattern part 1~Ex(Me+3) ;Process pattern part 2
11. Pattern: process swatch = PixActive(2), ;Set swatch frame active~PixRotate((IN3*3) Mod 360), ;Rotate frame~Switch(IN1,0,Me+3) ;If button false, filter swatch
12. Pattern: process pattern part 1 = PixActive(3), ;Set pattern buffer frame active~PixFill(0), ;Fill pattern buffer frame with black~V1.(IN5*Ran), ;Calculate X position using jitter~V2.(IN6*Ran), ;Calculate Y position using jitter~PixCombine(2,512,(((V0*(IN4-1))+(V1)) Mod Frame_W),((Frame_H/2)-(S_Frame_H/2)-IN6/2)+(V2)),~ ;Combine swatch into pattern buffer at appropriate X,Y location~V3.(IN3 Mod 15), ;Calculate portion of note value based on rotation~V4.(IN4 Mod 8), ;Calculate portion of note based on step size~V5.((V1+V2) Mod 10), ;Calculate portion of note based on jitter~Out(V0+V3+V4+V5) ;Output note value
13. Pattern: process pattern part 2 = PixActive(4), ;Set pattern frame active~PixAutoRepaint(0), ;Turn off auto repainting to stop flicker~PixGamma(IN7/6), ;Apply gamma effect to existing elements~PixSharpen(-(IN8*10)), ;Apply sharpen effect, actually soften~PixCombine(3,Combinecode), ;Combine pattern buffer into pattern frame~PixRepaint, ;Repaint~PixAutoRepaint(1) ;Turn on auto repainting~
19. Save: description = ; Pattern State (Frame) Saver~;
20. Save: setup tooltips = nLed(2), ;Set # of inputs and define tooltips~ToolTip(, ;No clock tip~ "Hold", ;IN1~ "# of swatches"), ;IN2~V0.(0), ;Initialize file index counter (1 based)~NumLabel(V0), ;Display file index counter in module label~Goto(Me+1) ;Exit initialization section
21. Save: test if save pattern = Switch(IN1,0,Me+1) ;If hold button is off, save file on each clock tick
22. Save: test if save complete = Switch(V0<(IN2),Me+1,0) ;If step count is < 0 based steps, save state of pattern
23. Save: save pattern = V0.(V0+1), ;Increment file index counter~NumLabel(V0), ;Display file index counter in module label~PixActive(4), ;Set pattern frame active~PixSave(V0,Savefile,"",Saveformat) ;Save current state of current pattern into pattern<V0>.bmp