From 480b757207c659f0c3e06277e29733b52d46bcdc Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 13 Apr 2005 03:47:20 +0000 Subject: - created a suite of hid objects for using polar coordinates and converting between the range of 0-1 and degrees/radians. - made two joystick/polar examples - added some pretty colors to help patches svn path=/trunk/externals/hcs/hid/; revision=2754 --- TODO | 20 ++++++++++++++++ deg2hid.pd | 25 ++++++++++++++++++++ doc/deg2hid-help.pd | 24 +++++++++++++++++++ doc/hid2deg-help.pd | 23 ++++++++++++++++++ doc/hid2rad-help.pd | 24 +++++++++++++++++++ doc/hid_polar-help.pd | 40 +++++++++++++++++++++++++++++++ doc/hid_spiral-help.pd | 40 +++++++++++++++++++++++++++++++ doc/notescale-help.pd | 8 +++---- doc/rad2hid-help.pd | 24 +++++++++++++++++++ examples/polar-joystick.pd | 44 ++++++++++++++++++++++++++++++++++ examples/spiral-joystick.pd | 57 +++++++++++++++++++++++++++++++++++++++++++++ hid2deg.pd | 31 ++++++++++++++++++++++++ hid2rad.pd | 22 +++++++++++++++++ hid_polar.pd | 39 +++++++++++++++++++++++++++++++ hid_spiral.pd | 47 +++++++++++++++++++++++++++++++++++++ rad2hid.pd | 26 +++++++++++++++++++++ 16 files changed, 490 insertions(+), 4 deletions(-) create mode 100644 deg2hid.pd create mode 100644 doc/deg2hid-help.pd create mode 100644 doc/hid2deg-help.pd create mode 100644 doc/hid2rad-help.pd create mode 100644 doc/hid_polar-help.pd create mode 100644 doc/hid_spiral-help.pd create mode 100644 doc/rad2hid-help.pd create mode 100644 examples/polar-joystick.pd create mode 100644 examples/spiral-joystick.pd create mode 100644 hid2deg.pd create mode 100644 hid2rad.pd create mode 100644 hid_polar.pd create mode 100644 hid_spiral.pd create mode 100644 rad2hid.pd diff --git a/TODO b/TODO index d4b0bf1..1d5a2ac 100644 --- a/TODO +++ b/TODO @@ -98,6 +98,24 @@ void hid_post(const char *format, const char *); the events. +============================================================================== += figure out whole degree issue + +- BUG: zexy's 3D conversion objects just pass through Z rather than converting + it to elevation in rad/deg. + +- make [hid_polar] output 0 to 1 for angle rather than -pi to pi + +- [hid2rad], [hid2deg], [rad2hid], [deg2hid] + +- should degree conversion also change rotation direction and 0 point? The + degrees on a compass rotate the opposite direction of radians. The 0 point + of a compass is due north, with radians, its right/due east. + +- [hid_polar] should take an argument (in degrees?) which specifies where the + 0 is on the circle + + ============================================================================== = mapping object ideas @@ -114,6 +132,8 @@ non-linear one-to-many mapping object (one curve spans the whole range of the movement, the other curve kicks in at a specifable point. Arguments could be start-point and start-value. +[infinitepot] for use with a [knob] or any single axis that could be infinite. + /++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/deg2hid.pd b/deg2hid.pd new file mode 100644 index 0000000..ee9ac47 --- /dev/null +++ b/deg2hid.pd @@ -0,0 +1,25 @@ +#N canvas 380 212 444 356 10; +#X obj 88 30 inlet; +#X obj 89 264 outlet; +#X text 232 311 released under the GNU GPL; +#X text 15 297 (C) Copyright 2005 Hans-Christoph Steiner +; +#X text 143 264 output range: 0 to 360 \, 0 = north/top; +#X text 19 9 [deg2hid]; +#X text 129 28 input range: 0 to 360 \, 0 = east/right; +#X obj 88 170 / 360; +#X text 162 108 % is an int operation; +#X text 169 126 this saves accuracy; +#X obj 89 121 % 3.6e+07; +#X obj 89 142 / 100000; +#X obj 89 100 * 100000; +#X obj 45 210 moses 0; +#X obj 45 230 + 1; +#X connect 0 0 12 0; +#X connect 7 0 13 0; +#X connect 10 0 11 0; +#X connect 11 0 7 0; +#X connect 12 0 10 0; +#X connect 13 0 14 0; +#X connect 13 1 1 0; +#X connect 14 0 1 0; diff --git a/doc/deg2hid-help.pd b/doc/deg2hid-help.pd new file mode 100644 index 0000000..041c618 --- /dev/null +++ b/doc/deg2hid-help.pd @@ -0,0 +1,24 @@ +#N canvas 82 386 483 323 10; +#X obj 5 2 cnv 15 450 20 empty empty [deg2hid] 2 11 1 18 -233017 -66577 +0; +#X obj 422 3 pddp; +#X text 254 269 released under the GNU GPL; +#X text 185 228 For more info:; +#X obj 289 226 all_about_hid_mapping; +#X text 40 254 (C) Copyright 2005 Hans-Christoph Steiner +; +#X text 300 168 related objects:; +#X obj 333 184 rad2hid; +#X floatatom 56 203 7 0 0 1 - - -; +#X obj 59 103 hsl 300 15 -720 720 0 0 empty empty degrees 6 7 1 10 +-262131 -1 -1 3100 0; +#X floatatom 82 133 5 0 0 0 - - -; +#X text 26 34 This object converts numbers from the [hid] range (0 +to 1) to radians (-pi to pi) with the 0's lining up in the same place. +; +#X obj 274 184 hid2rad; +#X obj 392 184 hid2deg; +#X obj 56 168 deg2hid; +#X connect 9 0 10 0; +#X connect 9 0 14 0; +#X connect 14 0 8 0; diff --git a/doc/hid2deg-help.pd b/doc/hid2deg-help.pd new file mode 100644 index 0000000..7d08062 --- /dev/null +++ b/doc/hid2deg-help.pd @@ -0,0 +1,23 @@ +#N canvas 589 387 483 323 10; +#X obj 5 2 cnv 15 450 20 empty empty [hid2deg] 2 11 1 18 -233017 -66577 +0; +#X obj 422 3 pddp; +#X text 254 269 released under the GNU GPL; +#X text 185 228 For more info:; +#X obj 289 226 all_about_hid_mapping; +#X text 40 254 (C) Copyright 2005 Hans-Christoph Steiner +; +#X text 300 168 related objects:; +#X obj 333 184 rad2hid; +#X obj 392 184 deg2hid; +#X floatatom 69 185 7 0 0 1 degrees - -; +#X obj 72 85 hsl 128 15 0 1 0 0 empty empty hid 6 7 1 10 -262131 -1 +-1 500 0; +#X floatatom 95 115 5 0 0 0 - - -; +#X obj 274 184 hid2rad; +#X obj 69 150 hid2deg; +#X text 26 34 This object converts numbers from the [hid] range (0 +to 1) to degrees (0 to 360) with the 0 being north.; +#X connect 10 0 11 0; +#X connect 10 0 13 0; +#X connect 13 0 9 0; diff --git a/doc/hid2rad-help.pd b/doc/hid2rad-help.pd new file mode 100644 index 0000000..b1723cb --- /dev/null +++ b/doc/hid2rad-help.pd @@ -0,0 +1,24 @@ +#N canvas 633 307 471 311 10; +#X obj 5 2 cnv 15 450 20 empty empty [hid2rad] 2 11 1 18 -233017 -66577 +0; +#X obj 422 3 pddp; +#X text 254 269 released under the GNU GPL; +#X text 185 228 For more info:; +#X obj 289 226 all_about_hid_mapping; +#X text 40 254 (C) Copyright 2005 Hans-Christoph Steiner +; +#X text 300 168 related objects:; +#X obj 273 184 rad2hid; +#X obj 332 184 deg2hid; +#X obj 391 184 hid2deg; +#X obj 69 150 hid2rad; +#X floatatom 69 185 9 0 0 1 radians - -; +#X obj 72 85 hsl 128 15 0 1 0 0 empty empty hid 6 7 1 10 -262131 -1 +-1 0 0; +#X floatatom 95 115 5 0 0 0 - - -; +#X text 26 34 This object converts numbers from the [hid] range (0 +to 1) to radians (-pi to pi) with the 0's lining up in the same place. +; +#X connect 10 0 11 0; +#X connect 12 0 13 0; +#X connect 12 0 10 0; diff --git a/doc/hid_polar-help.pd b/doc/hid_polar-help.pd new file mode 100644 index 0000000..858c69d --- /dev/null +++ b/doc/hid_polar-help.pd @@ -0,0 +1,40 @@ +#N canvas 601 232 478 451 10; +#X obj 5 2 cnv 15 450 20 empty empty [hid_polar] 2 11 1 18 -233017 +-66577 0; +#X obj 422 3 pddp; +#X text 244 411 released under the GNU GPL; +#X floatatom 100 248 5 0 0 0 - - -; +#X floatatom 100 335 7 0 0 0 radius-> - -; +#X text 175 375 For more info:; +#X obj 279 373 all_about_hid_mapping; +#X obj 100 295 hid_polar; +#X text 27 397 (C) Copyright 2005 Hans-Christoph Steiner +; +#X obj 101 161 hsl 128 15 0 1 0 0 empty empty x-axis 133 7 1 10 -225280 +-1 -1 6350 0; +#X obj 157 103 vsl 15 128 0 1 0 0 empty empty y-axis -6 -9 1 10 -261681 +-1 -1 6350 0; +#X floatatom 159 335 7 0 0 1 <-angle - -; +#X floatatom 158 248 5 0 0 0 - - -; +#X obj 157 265 t b f; +#X obj 334 335 polar-joystick; +#X text 275 273 related objects:; +#X text 273 334 example:; +#X msg 97 86 0.5; +#X text 43 86 center:; +#X text 17 29 Converts cartesian coordinates(x \, y) to polar coordinates +(radius \, angle). The angle is in radians (-pi to pi). The angle 0 +is at cartesian (1 \, 0.5) or to the right.; +#X obj 361 293 hid_spiral; +#X obj 245 293 hid2rad; +#X obj 303 293 hid2deg; +#X connect 3 0 7 0; +#X connect 7 0 4 0; +#X connect 7 1 11 0; +#X connect 9 0 3 0; +#X connect 10 0 12 0; +#X connect 12 0 13 0; +#X connect 13 0 3 0; +#X connect 13 1 7 1; +#X connect 17 0 9 0; +#X connect 17 0 10 0; diff --git a/doc/hid_spiral-help.pd b/doc/hid_spiral-help.pd new file mode 100644 index 0000000..fdebf2f --- /dev/null +++ b/doc/hid_spiral-help.pd @@ -0,0 +1,40 @@ +#N canvas 56 302 475 480 10; +#X obj 5 2 cnv 15 450 20 empty empty [hid_spiral] 2 11 1 18 -233017 +-66577 0; +#X obj 422 3 pddp; +#X text 245 451 released under the GNU GPL; +#X floatatom 70 288 5 0 0 0 - - -; +#X floatatom 70 375 5 0 0 0 radius-> - -; +#X text 175 408 For more info:; +#X text 28 437 (C) Copyright 2005 Hans-Christoph Steiner +; +#X obj 71 201 hsl 128 15 0 1 0 0 empty empty x-axis 133 7 1 10 -225280 +-1 -1 0 0; +#X obj 127 143 vsl 15 128 0 1 0 0 empty empty y-axis -6 -9 1 10 -261681 +-1 -1 0 0; +#X floatatom 136 376 8 0 0 1 <-angle - -; +#X floatatom 128 288 5 0 0 0 - - -; +#X obj 127 305 t b f; +#X text 246 271 related objects:; +#X text 264 324 example:; +#X msg 69 126 0.5; +#X text 15 126 center:; +#X obj 323 324 spiral-joystick; +#X obj 70 335 hid_spiral; +#X obj 279 406 all_about_hid_mapping; +#X obj 362 271 hid_polar; +#X text 24 32 Converts cartesian coordinates(x \, y) to spiral in polar +coordinates (radius \, angle). The angle is from 0 to 1 The angle 0 +is at cartesian (1 \, 0) or far right center.; +#X text 24 81 The angle will just keep going up/down as long as there +is rotation rather than reset like [hid_polar].; +#X connect 3 0 17 0; +#X connect 7 0 3 0; +#X connect 8 0 10 0; +#X connect 10 0 11 0; +#X connect 11 0 3 0; +#X connect 11 1 17 1; +#X connect 14 0 8 0; +#X connect 14 0 7 0; +#X connect 17 0 4 0; +#X connect 17 1 9 0; diff --git a/doc/notescale-help.pd b/doc/notescale-help.pd index 053b712..10ec4f2 100644 --- a/doc/notescale-help.pd +++ b/doc/notescale-help.pd @@ -1,4 +1,4 @@ -#N canvas 577 303 460 463 10; +#N canvas 577 303 464 467 10; #X floatatom 26 85 5 0 0 0 - - -; #X floatatom 26 160 0 0 0 0 - - -; #X obj 2 2 cnv 15 450 20 empty empty [notescale] 2 11 1 18 -233017 @@ -12,11 +12,11 @@ #X text 234 407 released under the GNU GPL; #X floatatom 150 160 0 0 0 0 - - -; #X floatatom 297 160 0 0 0 0 - - -; -#X obj 213 83 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +#X obj 213 83 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -225271 -1 -1 0 0; -#X text 17 426 $Revision: 1.1 $$Date: 2004-11-28 20:57:26 $; +#X text 17 426 $Revision: 1.2 $$Date: 2005-04-13 03:47:19 $; #X text 18 439 $Author: eighthave $; -#X obj 140 244 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +#X obj 140 244 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262131 -1 -1 0 0; #X obj 26 130 notescale 30 60; #X floatatom 137 347 5 0 0 0 - - -; diff --git a/doc/rad2hid-help.pd b/doc/rad2hid-help.pd new file mode 100644 index 0000000..a86ce20 --- /dev/null +++ b/doc/rad2hid-help.pd @@ -0,0 +1,24 @@ +#N canvas 147 313 467 307 10; +#X obj 5 2 cnv 15 450 20 empty empty [rad2hid] 2 11 1 18 -233017 -66577 +0; +#X obj 422 3 pddp; +#X text 254 269 released under the GNU GPL; +#X text 185 228 For more info:; +#X obj 289 226 all_about_hid_mapping; +#X text 40 254 (C) Copyright 2005 Hans-Christoph Steiner +; +#X text 300 168 related objects:; +#X obj 273 184 rad2hid; +#X obj 332 184 deg2hid; +#X obj 391 184 hid2deg; +#X floatatom 69 195 5 0 0 1 hid - -; +#X obj 72 95 hsl 128 15 -3.14159 3.14159 0 0 empty empty radians 6 +7 1 10 -262131 -1 -1 0 0; +#X floatatom 95 125 9 0 0 0 - - -; +#X obj 69 160 rad2hid; +#X text 21 35 This object converts numbers from radians (-pi to pi) +to the [hid] range (0 to 1) with the 0's lining up in the same place. +; +#X connect 11 0 12 0; +#X connect 11 0 13 0; +#X connect 13 0 10 0; diff --git a/examples/polar-joystick.pd b/examples/polar-joystick.pd new file mode 100644 index 0000000..baace12 --- /dev/null +++ b/examples/polar-joystick.pd @@ -0,0 +1,44 @@ +#N canvas 515 127 469 529 10; +#X obj 184 159 joystick 3; +#X obj 242 194 hid_invert; +#X obj 183 92 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1 +; +#X msg 246 125 open \$1; +#X obj 246 105 hradio 15 1 1 8 \$0-device-number empty choose_a_device +0 -6 1 9 -225271 -1 -1 3; +#X obj 220 105 nbx 1 14 -1e+37 1e+37 0 0 empty \$0-device-number empty +0 -6 0 14 -166441 -1 -1 3 256; +#X msg 137 120 print; +#X obj 242 314 mtof; +#X obj 241 338 osc~; +#X obj 126 422 *~; +#X obj 182 488 dac~; +#X obj 141 329 line~; +#X msg 141 307 \$1 5; +#X obj 141 288 hid_cube; +#X obj 242 270 notescale 40 90; +#X text 14 9 [polar_joystick]; +#X text 25 38 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 183 455 pan~; +#X obj 183 225 hid_polar; +#X connect 0 0 18 0; +#X connect 0 1 1 0; +#X connect 0 2 17 1; +#X connect 1 0 18 1; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 3 0; +#X connect 6 0 0 0; +#X connect 7 0 8 0; +#X connect 8 0 9 0; +#X connect 9 0 17 0; +#X connect 11 0 9 1; +#X connect 12 0 11 0; +#X connect 13 0 12 0; +#X connect 14 0 7 0; +#X connect 17 0 10 0; +#X connect 17 1 10 1; +#X connect 18 0 13 0; +#X connect 18 1 14 0; diff --git a/examples/spiral-joystick.pd b/examples/spiral-joystick.pd new file mode 100644 index 0000000..f2f00e6 --- /dev/null +++ b/examples/spiral-joystick.pd @@ -0,0 +1,57 @@ +#N canvas 195 175 483 554 10; +#X obj 184 159 joystick 3; +#X obj 255 194 hid_invert; +#X obj 183 92 tgl 25 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1 +; +#X msg 246 125 open \$1; +#X obj 246 105 hradio 15 1 1 8 \$0-device-number empty choose_a_device +0 -6 1 9 -225271 -1 -1 3; +#X obj 220 105 nbx 1 14 -1e+37 1e+37 0 0 empty \$0-device-number empty +0 -6 0 14 -166441 -1 -1 3 256; +#X msg 137 120 print; +#X obj 249 309 osc~; +#X obj 126 422 *~; +#X obj 182 488 dac~; +#X obj 141 329 line~; +#X msg 141 307 \$1 5; +#X obj 141 288 hid_cube; +#X text 25 38 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 183 455 pan~; +#X text 14 9 [spiral_joystick]; +#X text 254 524 released under the GNU GPL; +#X text 40 509 (C) Copyright 2005 Hans-Christoph Steiner +; +#X obj 183 225 hid_spiral; +#X floatatom 78 193 5 0 0 0 - - -; +#X floatatom 124 193 5 0 0 0 - - -; +#X msg 68 130 poll 2; +#X floatatom 316 305 5 0 0 0 - - -; +#X obj 249 283 pow 3; +#X text 302 224 set 440 as start; +#X obj 249 258 + 7.60591; +#X text 303 240 (7.60591 ^ 3 = 440.001); +#X connect 0 0 18 0; +#X connect 0 0 19 0; +#X connect 0 1 1 0; +#X connect 0 1 20 0; +#X connect 0 2 14 1; +#X connect 1 0 18 1; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 3 0; +#X connect 6 0 0 0; +#X connect 7 0 8 0; +#X connect 8 0 14 0; +#X connect 10 0 8 1; +#X connect 11 0 10 0; +#X connect 12 0 11 0; +#X connect 14 0 9 0; +#X connect 14 1 9 1; +#X connect 18 0 12 0; +#X connect 18 1 25 0; +#X connect 21 0 0 0; +#X connect 23 0 7 0; +#X connect 23 0 22 0; +#X connect 25 0 23 0; diff --git a/hid2deg.pd b/hid2deg.pd new file mode 100644 index 0000000..af40bca --- /dev/null +++ b/hid2deg.pd @@ -0,0 +1,31 @@ +#N canvas 163 40 444 356 10; +#X obj 88 30 inlet; +#X obj 89 264 outlet; +#X obj 88 56 min 1; +#X obj 88 74 max 0; +#X text 133 63 its a [hid] object \, so limit input range; +#X text 232 311 released under the GNU GPL; +#X text 15 297 (C) Copyright 2005 Hans-Christoph Steiner +; +#X text 19 9 [hid2deg]; +#X text 129 28 input range: 0 to 1 \, 0 = east/right; +#X text 143 264 output range: 0 to 360 \, 0 = north/top; +#X obj 88 100 * 360; +#X text 162 189 % is an int operation; +#X text 169 207 this saves accuracy; +#X obj 88 148 abs; +#X obj 88 123 - 450; +#X text 131 122 <- rotate zero to north; +#X text 130 148 <- change direction of rotation; +#X obj 89 202 % 3.6e+07; +#X obj 89 223 / 100000; +#X obj 89 181 * 100000; +#X connect 0 0 2 0; +#X connect 2 0 3 0; +#X connect 3 0 10 0; +#X connect 10 0 14 0; +#X connect 13 0 19 0; +#X connect 14 0 13 0; +#X connect 17 0 18 0; +#X connect 18 0 1 0; +#X connect 19 0 17 0; diff --git a/hid2rad.pd b/hid2rad.pd new file mode 100644 index 0000000..b2c3f19 --- /dev/null +++ b/hid2rad.pd @@ -0,0 +1,22 @@ +#N canvas 287 246 432 344 10; +#X obj 88 30 inlet; +#X obj 89 264 outlet; +#X text 19 9 [hid2rad]; +#X obj 89 198 * 6.28318; +#X obj 88 101 moses 0.5; +#X obj 88 56 min 1; +#X obj 88 74 max 0; +#X obj 147 133 - 1; +#X text 133 63 its a [hid] object \, so limit input range; +#X text 129 28 input range: 0 to 1; +#X text 143 264 output range: -pi to pi; +#X text 232 311 released under the GNU GPL; +#X text 15 297 (C) Copyright 2005 Hans-Christoph Steiner +; +#X connect 0 0 5 0; +#X connect 3 0 1 0; +#X connect 4 0 3 0; +#X connect 4 1 7 0; +#X connect 5 0 6 0; +#X connect 6 0 4 0; +#X connect 7 0 3 0; diff --git a/hid_polar.pd b/hid_polar.pd new file mode 100644 index 0000000..5b28852 --- /dev/null +++ b/hid_polar.pd @@ -0,0 +1,39 @@ +#N canvas 328 234 464 407 10; +#X obj 30 58 inlet; +#X obj 25 323 outlet; +#X text 73 323 output range: 0 to 1; +#X text 72 57 input range: 0 to 1; +#X text 11 5 [hid_polar]; +#X obj 232 322 outlet; +#X obj 224 56 inlet; +#X text 264 57 input range: 0 to 1; +#X text 29 29 x-axis value; +#X text 221 26 y-axis value; +#X obj 25 292 / 1.41421; +#X text 92 292 (sqrt 2); +#X obj 104 220 cart2pol; +#X obj 223 85 t b f; +#X obj 29 180 f; +#X obj 252 140 - 1; +#X obj 252 120 * 2; +#X obj 29 140 - 1; +#X obj 29 120 * 2; +#X text 61 125 convert range to -1 to 1; +#X text 280 322 output range: 0 to 1; +#X text 245 371 released under the GNU GPL; +#X text 28 357 (C) Copyright 2005 Hans-Christoph Steiner +; +#X obj 231 290 rad2hid; +#X connect 0 0 18 0; +#X connect 6 0 13 0; +#X connect 10 0 1 0; +#X connect 12 0 10 0; +#X connect 12 1 23 0; +#X connect 13 0 14 0; +#X connect 13 1 16 0; +#X connect 14 0 12 0; +#X connect 15 0 12 1; +#X connect 16 0 15 0; +#X connect 17 0 14 0; +#X connect 18 0 17 0; +#X connect 23 0 5 0; diff --git a/hid_spiral.pd b/hid_spiral.pd new file mode 100644 index 0000000..f0868dd --- /dev/null +++ b/hid_spiral.pd @@ -0,0 +1,47 @@ +#N canvas 492 167 669 441 10; +#X obj 30 58 inlet; +#X obj 25 363 outlet; +#X text 73 363 output range: 0 to 1; +#X text 72 57 input range: 0 to 1; +#X obj 232 362 outlet; +#X obj 222 58 inlet; +#X text 264 57 input range: 0 to 1; +#X text 29 29 x-axis value; +#X text 221 26 y-axis value; +#X text 11 5 [hid_spiral]; +#X text 254 411 released under the GNU GPL; +#X text 40 396 (C) Copyright 2005 Hans-Christoph Steiner +; +#X obj 268 258 +; +#X obj 299 258 f; +#X msg 219 227 1; +#X msg 315 227 -1; +#X obj 232 327 +; +#X obj 164 140 t f f; +#X obj 194 161 delta; +#X obj 105 109 hid_polar; +#X obj 269 291 * 1; +#X obj 221 185 moses -0.4; +#X obj 271 205 moses 0.4; +#X text 260 110 changes over 0.4 mean one rotation. I can't move fast +enough on my joystick to get near a change of 0.4 This might not work +on other devices \, like tablets \, but we'll cross that bridge when +we get to it (i.e. when I get a tablet); +#X text 280 362 output range: infinite \, one rotation = 1; +#X connect 0 0 19 0; +#X connect 5 0 19 1; +#X connect 12 0 13 0; +#X connect 12 0 20 0; +#X connect 13 0 12 1; +#X connect 14 0 12 0; +#X connect 15 0 12 0; +#X connect 16 0 4 0; +#X connect 17 0 16 0; +#X connect 17 1 18 0; +#X connect 18 0 21 0; +#X connect 19 0 1 0; +#X connect 19 1 17 0; +#X connect 20 0 16 1; +#X connect 21 0 14 0; +#X connect 21 1 22 0; +#X connect 22 1 15 0; diff --git a/rad2hid.pd b/rad2hid.pd new file mode 100644 index 0000000..39debb1 --- /dev/null +++ b/rad2hid.pd @@ -0,0 +1,26 @@ +#N canvas 258 110 429 400 10; +#X obj 42 36 inlet; +#X obj 140 297 outlet; +#X text 19 9 [rad2hid]; +#X obj 141 234 % 628318; +#X obj 127 167 moses 0; +#X obj 141 255 / 628318; +#X obj 42 96 * 100000; +#X obj 41 167 % 628318; +#X obj 42 136 moses -314159; +#X obj 85 200 + 628318; +#X text 10 66 % is an int operation \, we want floats \, so convert +to large integers; +#X text 225 351 released under the GNU GPL; +#X text 8 337 (C) Copyright 2005 Hans-Christoph Steiner +; +#X connect 0 0 6 0; +#X connect 3 0 5 0; +#X connect 4 0 9 0; +#X connect 4 1 3 0; +#X connect 5 0 1 0; +#X connect 6 0 8 0; +#X connect 7 0 9 0; +#X connect 8 0 7 0; +#X connect 8 1 4 0; +#X connect 9 0 3 0; -- cgit v1.2.1