From 23a5e05341eae8868874b4816e74bcf95ff2273c Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 25 Jun 2008 18:30:07 +0000 Subject: first complete example based on [hidio] and 'mapping'. There is currently a bug in [hidio] when the [open 1( status message triggers an [info( message, it causes a stack overflow svn path=/trunk/externals/io/hidio/; revision=10098 --- examples/spiral-joystick.pd | 99 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 examples/spiral-joystick.pd diff --git a/examples/spiral-joystick.pd b/examples/spiral-joystick.pd new file mode 100644 index 0000000..dd33d6b --- /dev/null +++ b/examples/spiral-joystick.pd @@ -0,0 +1,99 @@ +#N canvas 284 22 633 598 10; +#X declare -lib mapping; +#X obj 482 32 import mapping; +#X obj 100 100 tgl 25 0 empty empty start 1 12 1 9 -225271 -1 -1 0 +1; +#X obj 184 484 osc~; +#X obj 67 517 *~; +#X obj 97 561 dac~; +#X obj 17 486 line~; +#X msg 17 464 \$1 5; +#X text 22 32 This patch uses the angle of the joystick to control +pitch and the distance from the centerpoint to control amplitude. The +joystick Z/twist is mapped to pan.; +#X obj 67 538 pan/equal_power_pan~; +#X text 11 9 spiral_joystick; +#X obj 29 103 pddp/dsp; +#X obj 123 161 hidio; +#X obj 192 297 route x y rz z; +#X text 289 297 some joysticks call twist 'z' \, others 'rz'; +#X msg 278 163 info; +#X obj 23 214 route absolute; +#X obj 23 297 route x y rz z; +#X obj 192 213 route absolute; +#X obj 192 192 route range; +#X obj 63 342 /; +#X obj 192 233 unpack symbol float float; +#X obj 192 254 pack symbol float; +#X obj 192 275 list trim; +#X obj 23 233 unpack symbol float float; +#X obj 23 254 pack symbol float; +#X obj 23 275 list trim; +#X obj 93 342 /; +#X obj 133 342 /; +#X obj 173 342 /; +#X text 313 253 we don't need the instance number \, so ignore it; +#X text 209 343 scale things to max 1 using the values querying using +[info(; +#X obj 187 520 hsl 128 15 0 1 0 1 empty empty empty -2 -8 0 10 -262144 +-1 -1 6350 0; +#X msg 143 101 open joystick; +#X text 153 79 1; +#X text 102 79 2; +#X text 34 79 3; +#X text 247 88 <-- click these in the order specified; +#X obj 184 463 mtof; +#X obj 184 442 notescale 60 72; +#X obj 17 443 exponential_sigmoid 0.3; +#X obj 93 363 reverse; +#X obj 63 410 spiral; +#X text 153 386 <-- reset position in spiral to middle C octave; +#X text 219 462 set middle C as start note \, with one octave per revolution +; +#X msg 124 386 bang; +#X text 343 145 the [info( message outputs the range info; +#X obj 278 121 route open; +#X obj 278 143 select 1; +#X connect 1 0 11 0; +#X connect 2 0 3 1; +#X connect 3 0 8 0; +#X connect 5 0 3 0; +#X connect 6 0 5 0; +#X connect 8 0 4 0; +#X connect 8 1 4 1; +#X connect 11 0 15 0; +#X connect 11 1 18 0; +#X connect 11 1 46 0; +#X connect 12 0 19 1; +#X connect 12 1 26 1; +#X connect 12 2 27 1; +#X connect 12 3 28 0; +#X connect 14 0 11 0; +#X connect 15 0 23 0; +#X connect 16 0 19 0; +#X connect 16 1 26 0; +#X connect 16 2 27 0; +#X connect 16 3 28 0; +#X connect 17 0 20 0; +#X connect 18 0 17 0; +#X connect 19 0 41 0; +#X connect 20 0 21 0; +#X connect 20 2 21 1; +#X connect 21 0 22 0; +#X connect 22 0 12 0; +#X connect 23 0 24 0; +#X connect 23 2 24 1; +#X connect 24 0 25 0; +#X connect 25 0 16 0; +#X connect 26 0 40 0; +#X connect 31 0 8 1; +#X connect 32 0 11 0; +#X connect 37 0 2 0; +#X connect 38 0 37 0; +#X connect 39 0 6 0; +#X connect 40 0 41 1; +#X connect 41 0 39 0; +#X connect 41 1 38 0; +#X connect 44 0 41 2; +#X connect 46 0 47 0; +#X connect 47 0 14 0; -- cgit v1.2.1