User-Defined Opcode Database

rbatonPercPad

Senses trigger/whack strength as well as X and Y coordinates of the two batons in a Max Mathew's Radio Baton system.

Download UDO File

Description

Based on the CsoundAV opcodes by Gabriel Maldonado, this UDO reads the whack strength of the two batons as well as their respective coordinate data.

Syntax

kstr1, kcx1, kcy1, kstr2, kcx2, kcy2 rbatonPercPad

Performance

** All values are integers returned in range 0-127 **

kstr1 -- The strength of the stick hitting the surface of the stick that's plugged in to the stick 1 jack.

kcx1 -- Coordinate data for the X-AXIS of stick 1.

kcy1 -- Coordinate data for the Y-AXIS of stick 1.

kstr2 -- Strength of the whack of the stick plugged into the stick 2 jack.

kcx2 -- Coordinate data for the whack of stick 2 on the X-AXIS.

kcy2 -- Coordinate data for the whack of stick 2 on the Y-AXIS.

Code

opcode	rbatonPercPad, kkkkkk, 0

kstatus, kchan, kd1, kd2	midiin

;  trigger and whack strength - both sticks
if	(kstatus == 160 && kd1 == 1) then
kstr1	=	kd2
elseif	(kstatus == 160 && kd1 == 2) then
kstr2	=	kd2
	endif

;  stick coordinates
if	(kstatus == 160 && kd1 == 15) then
kx1	=	kd2
elseif	(kstatus == 160 && kd1 == 17) then
kx2	=	kd2
elseif	(kstatus == 160 && kd1 == 16) then
ky1	=	kd2
elseif	(kstatus == 160 && kd1 == 18) then
ky2	=	kd2
	endif

	xout	kstr1, kx1, ky1, kstr2, kx2, ky2

	endop

Examples

instr	3	; string printing test instrument

kstr1,kcx1,kcy1,kstr2,kcx2,kcy2	rbatonPercPad

	printks	"kstr1: %d, kcx1: %d, kcy1: %d\\nkstr2: %d, kcx2: %d, kcy2: %d\\n\",
			 0.25, kstr1, kcx1, kcy1, kstr2, kcx2, kcy2

		endin

Credits

David Akbari - 2005


Previous Home Next
rbatonPot   SCReverb