beatfix studios

rocks in a river

WiiWhorld.PIE

Posted Wednesday, March 4th, 2009
Posted in code | No Comments » Print This Post Print

midi.DeviceOut = midi.yoke1.DeviceOut
debug=wiimote.gx
wiimote.leds=0

/* — WiiWhorld – Buttons — */
f6 = Wiimote.Down                               // fill
f7 = Wiimote.Up                                 // outline
backspace = Wiimote.Left                        // reverse
backslash =Wiimote.Right                        // convex
f8 = doubleclicked(wiimote.Up)                  // xray
f5 = doubleclicked(wiimote.Down)                // mirror
delete = wiimote.A                              // clear
esc = wiimote.home + wiimote.A                  // panic
f3 = Wiimote.One                                // rotate hue
f2 = doubleclicked(Wiimote.One)                 // loop hue
f4 = Wiimote.Two                                // invert color
if (Wiimote.plus) then midi.ByteControl22=midi.ByteControl22+.01 // zoom in
if (Wiimote.minus) then midi.ByteControl22=midi.ByteControl22-.01 // zoom out
if (doubleclicked(wiimote.plus)) then midi.ByteControl22=.8
if (doubleclicked(wiimote.minus)) then midi.ByteControl22=.2
if (doubleclicked(wiimote.home)) then midi.ByteControl25=.2

/* — WiiWhorld – Wiimote — */
var.x = (Wiimote.gx + 1) / 2
var.y = (Wiimote.gy + 1) / 2
var.z = (Wiimote.gz + 1) / 2

if (wiimote.b) then {
midi.ByteControl66 = var.x                      // global rotate
midi.ByteControl22 = var.z                      // zoom
} else {
midi.ByteControl5 = var.x                       // rotate speed
midi.ByteControl13 = var.z                      // saturation
} end if

/* — WiiWhorld – Nunchuk — */
if (Wiimote.HasNunchuk) {
var.nx = (Wiimote.Nunchuk.gx + 1) / 2
var.ny = (Wiimote.Nunchuk.gy + 1) / 2
var.nz = (Wiimote.Nunchuk.gz + 1) / 2
var.jx = (Wiimote.Nunchuk.JoyX + 1) / 2
var.jy = (Wiimote.Nunchuk.JoyY + 1) / 2

//midi.playback.firstnote = var.jx * 127  // musical joystick
//midi.playback.secondnote = var.jy * 127

if Wiimote.Nunchuk.ZButton {
midi.ByteControl23=.3                           // damping
midi.ByteControl24=.8                           // trail
midi.ByteControl31 = var.jx                     // origin x
midi.ByteControl32 = var.jy                     // origin y
midi.ByteControl9 = var.nx                      // star factor
midi.ByteControl10 = var.nz                     // pinwheel
} else if Wiimote.Nunchuk.CButton {
midi.ByteControl72 = var.jx                     // global even curve
midi.ByteControl73 = var.jy                     // global odd curve
midi.ByteControl31 = 1-var.nx                   // origin x
midi.ByteControl32 = 1-var.nz                   // origin y
} else {
midi.ByteControl70 = var.jx                     // global star factor
midi.ByteControl71 = var.jy                     // global pinwheel
midi.ByteControl11 = var.nx
midi.ByteControl21 = var.nz
} end if
} end if

// Speech Commands (requires http://www.ics.forth.gr/uachess/downloads/IE-speech_add-in_v1.zip)
// to activate – hold home button, say “voice” – wait for computer to confirm
if (wiimote.home and said(”voice”)) {
wait 100ms
if var.voice=0 {
say(”voice on”)
var.voice=1
} else {
say(”voice off”)
var.voice=0
}
}
if var.voice==1 {
//right=said(’next’)
backspace=said(’back’)
delete=said(’clear’)
esc=said(’panic’)
spacebar=said(’stop’)
spacebar=said(’go’)
f5=said(’mirror’)
f6=said(’fill’)
f7=said(’outline’)
f8=said(’xray’)
f9=said(’phase’)
f10=said(’new’)
ctrl+f11=said(’vj’)
shift+r=said(’random’)
shift+c=said(’center’)
shift+d=said(’drag’)
ctrl+a=said(’auto’)
backslash=said(’convex’)

alt+f=said(’file’)
ctrl+o=said(’load patch’)
ctrl+shift+o=said(’load playlist’)
ctrl+r=said(’record’)
up=said(’up’)
down=said(’down’)
//left=said(’left’)
//right=said(’right’)
enter=said(’enter’)
} end if

//debug = midi.OutDevName