~rabbits/orca-toy

e792707071a5d0176773102105e083397c314c96 — Devine Lu Linvega 1 year, 3 months ago 12230b2
Draw voices
2 files changed, 26 insertions(+), 5 deletions(-)

M src/library.tal
M src/orca.tal
M src/library.tal => src/library.tal +4 -3
@@ 444,12 444,13 @@ JMP2r
	( channel ) get-port-right-value ,&ch STR
	( octave ) INC2r STH2kr get-port-right-value #0c MUL
	( note ) INC2r STH2kr get-port-right-raw chrmid ADD ,&pitch STR
	( velocity ) INC2r STH2kr get-port-right-value ,&vel STR
	( length ) INC2r STH2r get-port-right-value ,&len STR
	( velocity ) INC2r STH2kr get-port-right-value 
		DUP #00 NEQ ?&has-vel POP #7f &has-vel ,&vel STR
	( length ) INC2r STH2r get-port-right-value INC ,&len STR
	get-bang ?&has-bang POP2 JMP2r &has-bang
	,&pitch LDR ?&has-pitch POP2 JMP2r &has-pitch
	.types/io ROT ROT write-type
	[ LIT2 &ch $1 &pitch $1 ] [ LIT2 &vel $1 &len $1 ] add-voice
	[ LIT2 &ch $1 &pitch $1 ] [ LIT2 &len $1 &vel $1 ] add-voice

JMP2r


M src/orca.tal => src/orca.tal +22 -2
@@ 701,8 701,14 @@ JMP2r

@add-voice ( ch vel pitch len -- )

	SWP2 phex #2018 DEO
	phex #0a18 DEO
	next-voice STHk STZ2
	INCr INCr STHr STZ2

JMP2r

@next-voice ( -- voice )

	.voices

JMP2r



@@ 765,6 771,7 @@ JMP2r
	POP2r
	( draw meter )
	draw-meter
	draw-voices
	( draw help )
	.help LDZ ?draw-help



@@ 794,6 801,19 @@ JMP2r

JMP2r

@draw-voices ( -- )

	#2000
	&l
		#00 OVR #74 SFT2 .grid/x2 LDZ2 #00d0 SUB2 ADD2 .Screen/x DEO2
		#00 OVR #0f AND #40 SFT2 .grid/y1 LDZ2 ADD2 #0010 ADD2 .Screen/y DEO2
		DUP #20 SFT .voices ADD LDZ2k draw-short
		INC INC LDZ2 draw-short
		INC GTHk ?&l
	POP2

JMP2r

@draw-dpad ( -- )

	[ LIT2 &x $2 ] .Screen/x DEO2