diff --git a/l2ork_addons/K12/icons-large/wii_nunchuk_hit.png b/l2ork_addons/K12/icons-large/wii_nunchuk_hit.png new file mode 100644 index 0000000000000000000000000000000000000000..aac15fea123c98494c644606b518fdf7b83e0c55 Binary files /dev/null and b/l2ork_addons/K12/icons-large/wii_nunchuk_hit.png differ diff --git a/l2ork_addons/K12/icons/wii_nunchuk_hit.png b/l2ork_addons/K12/icons/wii_nunchuk_hit.png new file mode 100644 index 0000000000000000000000000000000000000000..00ac7f51d25c3f309f6936bffe0c7e9929bb8c8a Binary files /dev/null and b/l2ork_addons/K12/icons/wii_nunchuk_hit.png differ diff --git a/l2ork_addons/K12/objects/wii_nunchuk_hit1.png b/l2ork_addons/K12/objects/wii_nunchuk_hit1.png new file mode 100644 index 0000000000000000000000000000000000000000..6865483d37b5799782bf7859a0f58b66da117a55 Binary files /dev/null and b/l2ork_addons/K12/objects/wii_nunchuk_hit1.png differ diff --git a/l2ork_addons/K12/objects/wii_nunchuk_hit2.png b/l2ork_addons/K12/objects/wii_nunchuk_hit2.png new file mode 100644 index 0000000000000000000000000000000000000000..097be89269a979f2895c70d7986bb08fcb707ad9 Binary files /dev/null and b/l2ork_addons/K12/objects/wii_nunchuk_hit2.png differ diff --git a/l2ork_addons/K12/objects/wii_nunchuk_hit3.png b/l2ork_addons/K12/objects/wii_nunchuk_hit3.png new file mode 100644 index 0000000000000000000000000000000000000000..58e7997e774230303c0693bd39938faca557d059 Binary files /dev/null and b/l2ork_addons/K12/objects/wii_nunchuk_hit3.png differ diff --git a/l2ork_addons/K12/objects/wii_nunchuk_hit4.png b/l2ork_addons/K12/objects/wii_nunchuk_hit4.png new file mode 100644 index 0000000000000000000000000000000000000000..d8eb0a202e34e914201c21df6c508ab0bcda80ab Binary files /dev/null and b/l2ork_addons/K12/objects/wii_nunchuk_hit4.png differ diff --git a/l2ork_addons/K12/objects/wii_nunchuk_hit5.png b/l2ork_addons/K12/objects/wii_nunchuk_hit5.png new file mode 100644 index 0000000000000000000000000000000000000000..e6ea4a723d68ec1d5353667b3c85498c5a556188 Binary files /dev/null and b/l2ork_addons/K12/objects/wii_nunchuk_hit5.png differ diff --git a/l2ork_addons/K12/objects/wii_nunchuk_hit6.png b/l2ork_addons/K12/objects/wii_nunchuk_hit6.png new file mode 100644 index 0000000000000000000000000000000000000000..89370d4c5f5b96efd9e391610dbed54cdfd1c40a Binary files /dev/null and b/l2ork_addons/K12/objects/wii_nunchuk_hit6.png differ diff --git a/l2ork_addons/K12/wii_hit-help.pd b/l2ork_addons/K12/wii_hit-help.pd index d01fdca2aa48a8ad55926d730ac4c1ac2fe6db7c..2e4717a5834df438cc31ada9a63dfc1882c42407 100755 --- a/l2ork_addons/K12/wii_hit-help.pd +++ b/l2ork_addons/K12/wii_hit-help.pd @@ -1,27 +1,30 @@ -#N canvas 362 64 502 430 10; -#X obj 18 132 cnv 15 476 103 empty empty empty 20 12 0 14 -233017 -66577 +#N canvas 362 64 508 451 10; +#X obj 18 132 cnv 15 477 170 empty empty empty 20 12 0 14 -233017 -66577 0; #X obj 24 138 K12/wii_hit; -#N canvas 572 86 450 514 META 0; -#X text 7 58 OUTLET_0 Connect to a purple instrument object or an orange -math object; +#N canvas 572 86 395 115 META 0; #X text 8 33 INLET_0 Connect the Wii Connect object here; -#X text 8 9 DESCRIPTION Registers jolts from the wiimote as hits; -#X restore 457 372 pd META; +#X text 8 9 DESCRIPTION Registers jolts from the Wiimote as hits; +#X text 7 58 OUTLET_0 Outputs 1 when a hit has been detected and a +0 once the hit has ended; +#X restore 457 388 pd META; #X obj 24 21 K12/wii_connect; #X obj 8 -6 cnv 3 501 3 empty empty empty 5 14 0 20 -260097 -191407 0; -#X text 123 146 The Wii Hit object takes one input from the Wii Connect -object. It calculates when the Wiimote is jolted.; -#X text 125 182 This object outputs a 0 if no hit is occuring \, and -a 1 if a hit occurs. Connect the outlet to an instrument or math object. -; -#X obj 24 259 K12/math_number; +#X obj 24 320 K12/math_number; #X obj 251 -30 preset_hub k12 %hidden% %node% 2 5 14 %node% 2 5 28 -%node% 2 6 7 %node% 2 8 1 %node% 2 1 33 %node% 2 1 34 %node% 2 7 7 +%node% 2 6 7 %node% 2 8 1 %node% 2 1 33 %node% 2 1 34 %node% 2 5 7 ; #X obj 8 -35 cnv 15 501 28 empty empty Wii/Hit 5 14 0 20 -139274 -262144 0; -#X obj 478 -2 ggee/image @pd_extra/K12/icons/l2ork.png; -#X connect 1 0 7 0; +#X obj 478 -2 ggee/image @pd_extra/K12/icons/l2ork.png 0; +#X text 123 137 The Wii Nunchuk Hit object takes one input from the +Wii Connect object. It calculates when the Wiimote is jolted as it +has hit something (e.g. a mallet hitting a drum).Use high setting +to adjust the threshold of acceleration necessary to trigger a hit +\, and use the low setting for a threshold which acceleration needs +to drop below before the next hit can be detected.This object outputs +a 0 if no hit is occuring \, and a 1 if a hit occurs. Connect the outlet +to an instrument or math object.; +#X connect 1 0 5 0; #X connect 3 0 1 0; diff --git a/l2ork_addons/K12/wii_nunchuk_hit-help.pd b/l2ork_addons/K12/wii_nunchuk_hit-help.pd new file mode 100644 index 0000000000000000000000000000000000000000..73651d52a327244f51367f8a76a557731e2f39a7 --- /dev/null +++ b/l2ork_addons/K12/wii_nunchuk_hit-help.pd @@ -0,0 +1,30 @@ +#N canvas 362 64 508 441 10; +#X obj 17 132 cnv 15 480 171 empty empty empty 20 12 0 14 -233017 -66577 +0; +#X obj 24 138 K12/wii_hit; +#N canvas 572 86 450 104 META 0; +#X text 8 33 INLET_0 Connect the Wii Connect object here; +#X text 8 9 DESCRIPTION Registers jolts from the Nunchuk as hits; +#X text 7 58 OUTLET_0 Outputs 1 when a hit has been detected and a +0 once the hit has ended; +#X restore 457 376 pd META; +#X obj 24 21 K12/wii_connect; +#X obj 8 -6 cnv 3 501 3 empty empty empty 5 14 0 20 -260097 -191407 +0; +#X obj 24 317 K12/math_number; +#X obj 251 -30 preset_hub k12 %hidden% %node% 2 5 14 %node% 2 5 28 +%node% 2 6 7 %node% 2 8 1 %node% 2 1 33 %node% 2 1 34 %node% 2 5 7 +; +#X obj 8 -35 cnv 15 501 28 empty empty Wii/NunchukHit 5 14 0 20 -139274 +-262144 0; +#X obj 478 -2 ggee/image @pd_extra/K12/icons/l2ork.png 0; +#X text 124 139 The Wii Nunchuk Hit object takes one input from the +Wii Connect object. It calculates when the Nunchuk is jolted as it +has hit something (e.g. a mallet hitting a drum).Use high setting +to adjust the threshold of acceleration necessary to trigger a hit +\, and use the low setting for a threshold which acceleration needs +to drop below before the next hit can be detected.This object outputs +a 0 if no hit is occuring \, and a 1 if a hit occurs. Connect the outlet +to an instrument or math object.; +#X connect 1 0 5 0; +#X connect 3 0 1 0; diff --git a/l2ork_addons/K12/wii_nunchuk_hit.pd b/l2ork_addons/K12/wii_nunchuk_hit.pd new file mode 100644 index 0000000000000000000000000000000000000000..464b44215c00ae40a3d549a9939528bdcc7d0080 --- /dev/null +++ b/l2ork_addons/K12/wii_nunchuk_hit.pd @@ -0,0 +1,128 @@ +#N canvas 693 136 540 515 10; +#X obj 25 -100 expr sqrt(pow($f1 \, 2) + pow($f2 \, 2) + pow($f3 \, +2)); +#X obj 25 -50 -; +#X obj 25 -77 t f f; +#X obj 25 -29 abs; +#X obj 31 163 gate 1 1; +#X msg 58 208 0; +#X obj 66 74 sel 1; +#X msg 66 95 1; +#X obj 120 255 outlet; +#X obj 66 54 < 0.02; +#X msg 38 95 0; +#X obj 66 33 gate 1 0; +#X msg 89 208 1; +#X obj 25 140 moses 0.3; +#X obj 25 -225 inlet; +#X obj 25 -183 route acceleration; +#X obj 25 -162 unpack 0 0 0; +#X obj 261 121 ggee/image @pd_extra/K12/objects/wii_nunchuk_hit1.png +1; +#X obj 169 -9 select 0 1; +#X obj 169 -53 expr if ($f1 > 0 \, 1 \, 0); +#N canvas 31 175 465 442 delays 0; +#X obj 51 406 outlet; +#X obj 51 16 inlet; +#X obj 349 16 inlet; +#X obj 349 74 delay 15; +#X obj 349 121 delay 15; +#X obj 349 174 delay 15; +#X obj 349 228 delay 15; +#X obj 349 279 delay 15; +#X obj 349 334 delay 15; +#X msg 60 38 stop; +#X msg 51 118 open @pd_extra/K12/objects/wii_nunchuk_hit6.png; +#X msg 51 167 open @pd_extra/K12/objects/wii_nunchuk_hit5.png; +#X msg 51 216 open @pd_extra/K12/objects/wii_nunchuk_hit4.png; +#X msg 51 270 open @pd_extra/K12/objects/wii_nunchuk_hit3.png; +#X msg 51 322 open @pd_extra/K12/objects/wii_nunchuk_hit2.png; +#X msg 51 368 open @pd_extra/K12/objects/wii_nunchuk_hit1.png; +#X connect 1 0 10 0; +#X connect 1 0 9 0; +#X connect 2 0 3 0; +#X connect 3 0 10 0; +#X connect 3 0 4 0; +#X connect 4 0 11 0; +#X connect 4 0 5 0; +#X connect 5 0 12 0; +#X connect 5 0 6 0; +#X connect 6 0 13 0; +#X connect 6 0 7 0; +#X connect 7 0 14 0; +#X connect 7 0 8 0; +#X connect 8 0 15 0; +#X connect 9 0 3 0; +#X connect 9 0 4 0; +#X connect 9 0 5 0; +#X connect 9 0 6 0; +#X connect 9 0 7 0; +#X connect 9 0 8 0; +#X connect 10 0 0 0; +#X connect 11 0 0 0; +#X connect 12 0 0 0; +#X connect 13 0 0 0; +#X connect 14 0 0 0; +#X connect 15 0 0 0; +#X restore 146 41 pd delays; +#X obj 197 17 delay 100; +#X obj 261 17 loadbang; +#X obj 66 117 pipe 50; +#X obj 31 186 t f b; +#X msg 120 207 1 \, 0 250; +#X obj 120 231 line; +#X obj 169 -31 change; +#X obj 218 120 nbx 4 14 0 1e+37 0 1 \$0-s-null \$0-r-null empty 0 -8 +0 10 -262144 -1 -1 0.3 256 3; +#X obj 218 142 nbx 4 14 0 1e+37 0 1 \$0-s-null \$0-r-null empty 0 -8 +0 10 -262144 -1 -1 0.02 256 3; +#X text 225 108 high; +#X text 225 131 low; +#X obj 311 89 preset_node k12; +#X obj 311 111 preset_node k12; +#X obj 25 -204 route nunchuk; +#X msg 261 40 open @pd_extra/K12/objects/wii_nunchuk_hit1.png; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 2 0 1 1; +#X connect 2 1 1 0; +#X connect 3 0 11 1; +#X connect 3 0 13 0; +#X connect 4 0 24 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 6 0 10 0; +#X connect 7 0 23 0; +#X connect 9 0 6 0; +#X connect 10 0 11 0; +#X connect 11 0 9 0; +#X connect 12 0 11 0; +#X connect 13 1 4 1; +#X connect 14 0 34 0; +#X connect 15 0 16 0; +#X connect 16 0 0 0; +#X connect 16 1 0 1; +#X connect 16 2 0 2; +#X connect 18 1 20 0; +#X connect 18 1 21 0; +#X connect 19 0 27 0; +#X connect 20 0 17 0; +#X connect 21 0 20 1; +#X connect 22 0 35 0; +#X connect 23 0 4 0; +#X connect 24 1 5 0; +#X connect 24 1 12 0; +#X connect 24 1 25 0; +#X connect 25 0 26 0; +#X connect 26 0 19 0; +#X connect 26 0 8 0; +#X connect 27 0 18 0; +#X connect 28 0 32 0; +#X connect 28 0 13 1; +#X connect 29 0 33 0; +#X connect 29 0 9 1; +#X connect 32 0 28 0; +#X connect 33 0 29 0; +#X connect 34 0 15 0; +#X connect 35 0 17 0; +#X coords 0 -1 1 1 89 89 2 216 89; diff --git a/pd/src/pd.tk b/pd/src/pd.tk index 4672b8f9ed864e109b265bccbe23b49a1212b84a..6de9003689171f88e623d70abc0f389c873e5c2e 100644 --- a/pd/src/pd.tk +++ b/pd/src/pd.tk @@ -367,9 +367,16 @@ proc pdtk_enable_k12_mode {extra_dir} { image create photo i.wii_connect -file $extra_dir/K12/icons/wii_connect_on.png image create photo i.wii_buttons -file $extra_dir/K12/icons/wii_buttons.png + image create photo i.wii_speed_xry -file $extra_dir/K12/icons/wii_speed_xry.png image create photo i.wii_speed -file $extra_dir/K12/icons/wii_speed.png image create photo i.wii_hit -file $extra_dir/K12/icons/wii_hit.png + image create photo i.wii_accelerometer -file $extra_dir/K12/icons/wii_accelerometer.png + image create photo i.wii_nunchuk_buttons -file $extra_dir/K12/icons/wii_nunchuk_buttons.png + image create photo i.wii_nunchuk_hit -file $extra_dir/K12/icons/wii_nunchuk_hit.png + image create photo i.wii_nunchuk_accelerometer -file $extra_dir/K12/icons/wii_nunchuk_accelerometer.png + image create photo i.wii_nunchuk_stick -file $extra_dir/K12/icons/wii_nunchuk_stick.png + image create photo i.sarcduino -file $extra_dir/K12/icons/sarcduino_on.png image create photo i.sarcduino_digital -file $extra_dir/K12/icons/sarcduino_digital.png image create photo i.sarcduino_analog -file $extra_dir/K12/icons/sarcduino_analog.png @@ -2349,7 +2356,7 @@ proc pdtk_k12_show_data_icons {name} { $name.k12frame.datasound.sound configure -image i.sound catch { pack forget $name.k12frame.signal_1 $name.k12frame.signal_2 $name.k12frame.signal_3 $name.k12frame.instr $name.k12frame.fx $name.k12frame.output - pack $name.k12frame.wii $name.k12frame.arduino $name.k12frame.math_1 $name.k12frame.math_2 $name.k12frame.math_3 $name.k12frame.logic $name.k12frame.other -side top -expand 0 -fill x + pack $name.k12frame.wii $name.k12frame.wii2 $name.k12frame.arduino $name.k12frame.math_1 $name.k12frame.math_2 $name.k12frame.math_3 $name.k12frame.logic $name.k12frame.other -side top -expand 0 -fill x } } @@ -2357,7 +2364,7 @@ proc pdtk_k12_show_sound_icons {name} { $name.k12frame.datasound.data configure -image i.data $name.k12frame.datasound.sound configure -image i.sound_on catch { - pack forget $name.k12frame.wii $name.k12frame.arduino $name.k12frame.math_1 $name.k12frame.math_2 $name.k12frame.math_3 $name.k12frame.logic $name.k12frame.other + pack forget $name.k12frame.wii $name.k12frame.wii2 $name.k12frame.arduino $name.k12frame.math_1 $name.k12frame.math_2 $name.k12frame.math_3 $name.k12frame.logic $name.k12frame.other pack $name.k12frame.signal_1 $name.k12frame.signal_2 $name.k12frame.signal_3 $name.k12frame.instr $name.k12frame.fx $name.k12frame.output -side top -expand 0 -fill x } } @@ -2507,19 +2514,47 @@ proc pdtk_canvas_new {name width height geometry editable} { -command [concat put_K12_objects $name wii_connect]] match_linux_wm [list button $name.k12frame.wii.b_wii_buttons -image i.wii_buttons \ -command [concat put_K12_objects $name wii_buttons]] - match_linux_wm [list button $name.k12frame.wii.b_wii_speed -image i.wii_speed \ - -command [concat put_K12_objects $name wii_speed]] match_linux_wm [list button $name.k12frame.wii.b_wii_hit -image i.wii_hit \ -command [concat put_K12_objects $name wii_hit]] - pack $name.k12frame.wii.b_wii_connect $name.k12frame.wii.b_wii_buttons $name.k12frame.wii.b_wii_speed $name.k12frame.wii.b_wii_hit -side left -expand 0 -padx 1 -pady 1 + match_linux_wm [list button $name.k12frame.wii.b_wii_accelerometer -image i.wii_accelerometer \ + -command [concat put_K12_objects $name wii_accelerometer]] + match_linux_wm [list button $name.k12frame.wii.b_wii_speed_xry -image i.wii_speed_xry \ + -command [concat put_K12_objects $name wii_speed_xry]] + pack $name.k12frame.wii.b_wii_connect $name.k12frame.wii.b_wii_buttons $name.k12frame.wii.b_wii_hit $name.k12frame.wii.b_wii_accelerometer $name.k12frame.wii.b_wii_speed_xry -side left -expand 0 -padx 1 -pady 1 setTooltip $name.k12frame.wii.b_wii_connect "Wiimote Connect: Use this to connect wiimote to the computer" setTooltip $name.k12frame.wii.b_wii_buttons "Wiimote Buttons: Use this to select which Wiimote button should activate objects connected to this object" - setTooltip $name.k12frame.wii.b_wii_hit "Wiimote Hit: Use this to detect when the wiimote has been shaken" - setTooltip $name.k12frame.wii.b_wii_speed "Wiimote Speed: Use this to detect how quickly is Wiimote moving" + setTooltip $name.k12frame.wii.b_wii_hit "Wiimote Hit: Use this to detect when the wiimote has been shaken like a mallet" + setTooltip $name.k12frame.wii.b_wii_accelerometer "Wiimote Accelerometer: Use this to monitor Wiimotes acceleration across X, Y, and Z axes" + setTooltip $name.k12frame.wii.b_wii_speed_xry "Wiimote Speed X, Roll, Y: Use this to detect how quickly is Wiimote moving across individual axes x, roll, and y (requires motion plus)" pdtk_standardkeybindings $name.k12frame.wii.b_wii_connect pdtk_standardkeybindings $name.k12frame.wii.b_wii_buttons - pdtk_standardkeybindings $name.k12frame.wii.b_wii_speed pdtk_standardkeybindings $name.k12frame.wii.b_wii_hit + pdtk_standardkeybindings $name.k12frame.wii.b_wii_accelerometer + pdtk_standardkeybindings $name.k12frame.wii.b_wii_speed_xry + + # ---------------------------------- WII2 ----------------------------------------- + match_linux_wm [list frame $name.k12frame.wii2 -relief flat] + match_linux_wm [list button $name.k12frame.wii2.b_wii_speed -image i.wii_speed \ + -command [concat put_K12_objects $name wii_speed]] + match_linux_wm [list button $name.k12frame.wii2.b_wii_nunchuk_buttons -image i.wii_nunchuk_buttons \ + -command [concat put_K12_objects $name wii_nunchuk_buttons]] + match_linux_wm [list button $name.k12frame.wii2.b_wii_nunchuk_hit -image i.wii_nunchuk_hit \ + -command [concat put_K12_objects $name wii_nunchuk_hit]] + match_linux_wm [list button $name.k12frame.wii2.b_wii_nunchuk_accelerometer -image i.wii_nunchuk_accelerometer \ + -command [concat put_K12_objects $name wii_nunchuk_accelerometer]] + match_linux_wm [list button $name.k12frame.wii2.b_wii_nunchuk_stick -image i.wii_nunchuk_stick \ + -command [concat put_K12_objects $name wii_nunchuk_stick]] + pack $name.k12frame.wii2.b_wii_speed $name.k12frame.wii2.b_wii_nunchuk_buttons $name.k12frame.wii2.b_wii_nunchuk_hit $name.k12frame.wii2.b_wii_nunchuk_accelerometer $name.k12frame.wii2.b_wii_nunchuk_stick -side left -expand 0 -padx 1 -pady 1 + setTooltip $name.k12frame.wii2.b_wii_speed "Wiimote Speed: Use this to detect how quickly is Wiimote moving (requires motion plus)" + setTooltip $name.k12frame.wii2.b_wii_nunchuk_buttons "Wiimote Nunchuk Buttons: Use this to select which Nunchuk button should activate objects connected to this object (requires nunchuk extension)" + setTooltip $name.k12frame.wii2.b_wii_nunchuk_hit "Wiimote Nunchuk Hit: Use this to detect when the wiimote has been shaken like a mallet (requires nunchuk extension)" + setTooltip $name.k12frame.wii2.b_wii_nunchuk_accelerometer "Wiimote Nunchuk Accelerometer: Use this to monitor Nunchuk acceleration across X, Y, and Z axes (requires nunchuk extension)" + setTooltip $name.k12frame.wii2.b_wii_nunchuk_stick "Wiimote Nunchuk stick: Use this to monitor Nunchuk stick motion across X and Y axes (requires nunchuk extension)" + pdtk_standardkeybindings $name.k12frame.wii2.b_wii_speed + pdtk_standardkeybindings $name.k12frame.wii2.b_wii_nunchuk_buttons + pdtk_standardkeybindings $name.k12frame.wii2.b_wii_nunchuk_hit + pdtk_standardkeybindings $name.k12frame.wii2.b_wii_nunchuk_accelerometer + pdtk_standardkeybindings $name.k12frame.wii2.b_wii_nunchuk_stick # ---------------------------------- ARDUINO ----------------------------------------- match_linux_wm [list frame $name.k12frame.arduino -relief flat] @@ -2765,7 +2800,7 @@ proc pdtk_canvas_new {name width height geometry editable} { pdtk_standardkeybindings $name.k12frame.output.b_output # ---------------------------------------- NOW PACK THEM ALL ----------------------------------------- - pack $name.k12frame.edit $name.k12frame.datasound $name.k12frame.wii $name.k12frame.arduino $name.k12frame.math_1 $name.k12frame.math_2 $name.k12frame.math_3 $name.k12frame.logic $name.k12frame.other -side top -expand 0 -fill x + pack $name.k12frame.edit $name.k12frame.datasound $name.k12frame.wii $name.k12frame.wii2 $name.k12frame.arduino $name.k12frame.math_1 $name.k12frame.math_2 $name.k12frame.math_3 $name.k12frame.logic $name.k12frame.other -side top -expand 0 -fill x } tkp::canvas $name.c -width $width -height $height -background $::canvas_color($name) \ @@ -2793,7 +2828,7 @@ proc pdtk_canvas_new {name width height geometry editable} { if { $k12_mode == 0 } { wm minsize $name 50 20 } else { - wm minsize $name 580 372 + wm minsize $name 580 407 } wm geometry $name $geometry # the file menu