diff options
Diffstat (limited to 'externals')
-rw-r--r-- | externals/Makefile | 143 | ||||
-rw-r--r-- | externals/build/src/linuxevent.c | 2 | ||||
-rw-r--r-- | externals/build/src/linuxmouse.c | 2 | ||||
-rw-r--r-- | externals/build/src/pan_gogins~.c | 2 | ||||
-rw-r--r-- | externals/build/src/range.c | 2 | ||||
-rw-r--r-- | externals/deprecated/Makefile | 17 | ||||
-rw-r--r-- | externals/deprecated/doc/pan_gogins~-README.txt | 39 | ||||
-rw-r--r-- | externals/deprecated/examples/linuxevent-joystick.pd | 76 | ||||
-rw-r--r-- | externals/deprecated/help/linuxevent-help.pd | 276 | ||||
-rw-r--r-- | externals/deprecated/help/linuxmouse-help.pd | 44 | ||||
-rw-r--r-- | externals/deprecated/help/pan_gogins~-help.pd | 95 | ||||
-rw-r--r-- | externals/deprecated/help/range-help.pd | 31 | ||||
-rw-r--r-- | externals/deprecated/linuxevent.c | 285 | ||||
-rw-r--r-- | externals/deprecated/linuxhid.h | 85 | ||||
-rw-r--r-- | externals/deprecated/linuxmouse.c | 284 | ||||
-rw-r--r-- | externals/deprecated/pan_gogins~.c | 109 | ||||
-rw-r--r-- | externals/deprecated/range.c | 128 |
17 files changed, 1579 insertions, 41 deletions
diff --git a/externals/Makefile b/externals/Makefile index 74d1b93d..9a99b2c0 100644 --- a/externals/Makefile +++ b/externals/Makefile @@ -111,7 +111,7 @@ CXXFLAGS = $(CFLAGS) # # WARNING! this MUST be all on one line because the automatic package # building scripts rely on it being that way. -LIB_TARGETS = boids bsaylor buildsrc corelibs creb cxc cyclone ekext ext13 flib freeverb ggee hardware hcs iem_ambi iem_bin_ambi iemlib iemmatrix loaders mapping markex maxlib mjlib motex oscx pddp pdogg pmpd sigpack smlib toxy unauthorized vbap zexy +LIB_TARGETS = boids bsaylor corelibs creb cxc cyclone ekext ext13 flatspace flib freeverb ggee hardware hcs iem_ambi iem_bin_ambi iemlib iemmatrix loaders mapping markex maxlib mjlib motex oscx pddp pdogg pmpd sigpack smlib toxy unauthorized vbap zexy # this is for libraries that don't compile (yet) on all platforms ifeq ($(OS_NAME),windows) @@ -126,7 +126,7 @@ else endif -all: pre_all_$(OS_NAME) buildsrc $(LIB_TARGETS) +all: pre_all_$(OS_NAME) $(LIB_TARGETS) @echo " " @echo "Compiled external for $(OS_NAME) aka $(UNAME)" @@ -144,7 +144,7 @@ pre_all_unknown: #------------------------------------------------------------------------------# # INSTALL install: $(examplesdir) $(helpdir) $(manualsdir) $(objectsdir) $(readmesdir) \ -all unfiltered_install $(patsubst %, %_install,$(LIB_TARGETS)) +all $(patsubst %, %_install,$(LIB_TARGETS)) @echo " " @echo "externals install succeeded!" @@ -153,18 +153,24 @@ all unfiltered_install $(patsubst %, %_install,$(LIB_TARGETS)) # # OLD EXTERNALS BUILD SYSTEM TARGETS # -# this is all stuff related to the externals/build/src/*.c links +# This is all stuff related to the externals/build/src/*.c links. The idea is +# that they make for a flat namespace, here they are included as a libdir # #==============================================================================# +FLATSPACE_NAME=flatspace +FLATSPACE_OBJECTS := $(wildcard $(externals_src)/build/src/*.c) -BUILDSRC_OBJECTS := $(wildcard $(externals_src)/build/src/*.c) +flatspace: $(FLATSPACE_OBJECTS:.c=.$(EXTENSION)) -buildsrc: $(BUILDSRC_OBJECTS:.c=.$(EXTENSION)) - - -buildsrc_install: $(helpdir) $(objectsdir) - install -p $(BUILDSRC_OBJECTS:.c=.$(EXTENSION)) $(objectsdir) +flatspace_install: flatspace $(helpdir) $(objectsdir) + install -d $(objectsdir)/$(FLATSPACE_NAME) + $(scripts_src)/generate-libdir-metafile.sh $(objectsdir) $(FLATSPACE_NAME) \ + --author "Numerous" \ + --description "This is a collection of externals in a flat namespace" \ + --license "GNU GPL" + install -p $(FLATSPACE_OBJECTS:.c=.$(EXTENSION)) $(objectsdir)/$(FLATSPACE_NAME) + install -d $(helpdir)/$(FLATSPACE_NAME) # all standard objs' help files # it had to be broken up because the list is soo long install -p \ @@ -175,7 +181,7 @@ buildsrc_install: $(helpdir) $(objectsdir) $(externals_src)/bbogart/chaos/tools/*.pd \ $(externals_src)/bbogart/*/*.pd \ $(externals_src)/creb/doc/*.pd \ - $(helpdir) + $(helpdir)/$(FLATSPACE_NAME) install -p \ $(externals_src)/dfx/*/*.pd \ $(externals_src)/ggee/*/*-help.pd \ @@ -183,13 +189,12 @@ buildsrc_install: $(helpdir) $(objectsdir) $(externals_src)/gem2pdp/*.pd \ $(externals_src)/ff/*.pd \ $(externals_src)/hcs/*-help.pd \ - $(helpdir) + $(helpdir)/$(FLATSPACE_NAME) install -p \ $(externals_src)/hcs/*/doc/*.pd \ - $(externals_src)/hcs/pan/*-help.pd \ $(externals_src)/iem/comport/*/*-help.pd \ $(externals_src)/nusmuk/line3/*.pd\ - $(helpdir) + $(helpdir)/$(FLATSPACE_NAME) install -p \ $(externals_src)/pdogg/*/*.pd \ $(externals_src)/pdp/doc/objects/*.* \ @@ -202,15 +207,17 @@ buildsrc_install: $(helpdir) $(objectsdir) $(externals_src)/svf~/*.pd \ $(externals_src)/vst/*.pd \ $(externals_src)/zhzxh~/*.pd \ - $(helpdir) + $(helpdir)/$(FLATSPACE_NAME) -buildsrc_clean: - -rm -f -- $(BUILDSRC_OBJECTS:.c=.$(EXTENSION)) +flatspace_clean: + -rm -f -- $(FLATSPACE_OBJECTS:.c=.o) + -rm -f -- $(FLATSPACE_OBJECTS:.c=.$(EXTENSION)) -rm -f -- $(externals_src)/build/src/*.*~ -rm -f -- $(externals_src)/build/src/*.c.bak + #==============================================================================# # # PROJECT TARGETS @@ -459,6 +466,43 @@ cyclone_clean: -make -C $(externals_src)/miXed/cyclone $(DEST_PATHS) clean + + +#------------------------------------------------------------------------------# +# DEPRECATED +DEPRECATED_NAME=deprecated +DEPRECATED_OBJECTS := $(wildcard $(externals_src)/deprecated/*.c) +deprecated: $(DEPRECATED_OBJECTS:.c=.$(EXTENSION)) + +deprecated_install: deprecated + install -d $(objectsdir)/$(DEPRECATED_NAME) + $(scripts_src)/generate-libdir-metafile.sh $(objectsdir) $(DEPRECATED_NAME) \ + --author "numerous" \ + --description "a collection of deprecated objects that still have some use" \ + --license "" \ + --version "" + install -p $(DEPRECATED_OBJECTS:.c=.$(EXTENSION)) $(objectsdir)/$(DEPRECATED_NAME) + install -d $(helpdir)/$(DEPRECATED_NAME) + install -p $(externals_src)/deprecated/help/*.pd \ + $(helpdir)/$(DEPRECATED_NAME) + install -d $(manualsdir)/$(DEPRECATED_NAME) + install -p $(externals_src)/deprecated/doc/*.* \ + $(manualsdir)/$(DEPRECATED_NAME) +# install -d $(readmesdir) +# install -p $(externals_src)/deprecated/README \ +# $(readmesdir)/$(DEPRECATED_NAME).txt + install -d $(examplesdir)/$(DEPRECATED_NAME) + install -p $(externals_src)/deprecated/examples/*.pd \ + $(examplesdir)/$(DEPRECATED_NAME) + +deprecated_clean: + -rm -f -- $(DEPRECATED_OBJECTS:.c=.$(EXTENSION)) + -rm -f -- $(DEPRECATED_OBJECTS:.c=.o) + -rm -f -- $(externals_src)/deprecated/*.bak + -rm -f -- $(externals_src)/deprecated/*.*~ + + + #------------------------------------------------------------------------------# # DEVELLIBS DEVELLIBS_NAME=devellibs @@ -832,6 +876,10 @@ hcs_install: hcs --license "GNU GPL" \ --version "" install -p $(HCS_OBJECTS:.c=.$(EXTENSION)) $(objectsdir)/$(HCS_NAME) + install -p $(shell ls -1 $(externals_src)/hcs/*.pd | \ + grep -v '\-help.pd') $(objectsdir)/$(HCS_NAME) +# hmm, these don't have a home yet... + install -p $(externals_src)/hcs/general/*.pd $(objectsdir)/$(HCS_NAME) install -d $(helpdir)/$(HCS_NAME) install -p $(externals_src)/hcs/*-help.pd \ $(helpdir)/$(HCS_NAME) @@ -1368,6 +1416,47 @@ oscx_clean: + +#------------------------------------------------------------------------------# +# PAN +PAN_NAME=pan +PAN_OBJECTS := $(wildcard $(externals_src)/hcs/pan/*.c) +pan: $(PAN_OBJECTS:.c=.$(EXTENSION)) + +pan_install: pan + install -d $(objectsdir)/$(PAN_NAME) + $(scripts_src)/generate-libdir-metafile.sh $(objectsdir) $(PAN_NAME) \ + --author "Hans-Christoph Steiner <hans@at.or.at>" \ + --description "A library of panning algoritms" \ + --license "GNU GPL" \ + --version "" +# everything is .pd, nothing to compile (yet?) +# install -p $(PAN_OBJECTS:.c=.$(EXTENSION)) $(objectsdir)/$(PAN_NAME) + install -p $(wildcard $(externals_src)/hcs/pan/*.pd) \ + $(objectsdir)/$(PAN_NAME) + install -d $(helpdir)/$(PAN_NAME) + install -p $(externals_src)/hcs/pan/help/*.pd \ + $(helpdir)/$(PAN_NAME) +# install -d $(manualsdir)/$(PAN_NAME) +# install -p $(externals_src)/hcs/pan/manual.txt \ +# $(manualsdir)/$(PAN_NAME) +# install -d $(readmesdir) +# install -p $(externals_src)/hcs/pan/README \ +# $(readmesdir)/$(PAN_NAME).txt +# install -d $(examplesdir)/$(PAN_NAME) +# install -p $(externals_src)/hcs/pan/examples/*.pd \ +# $(examplesdir)/$(PAN_NAME) + + +pan_clean: + -rm -f -- $(PAN_OBJECTS:.c=.$(EXTENSION)) + -rm -f -- $(PAN_OBJECTS:.c=.o) + -rm -f -- $(externals_src)/hcs/pan/*.bak + -rm -f -- $(externals_src)/hcs/pan/*.*~ + + + + #------------------------------------------------------------------------------# # PDDP PDDP_NAME=pddp @@ -1830,24 +1919,6 @@ zexy_clean: -#==============================================================================# -# -# UNFILTERED PROJECT TARGETS -# -#==============================================================================# -# this is not yet organized into libdirs, but just leftover <hans@at.or.at> - -unfiltered_install: -#---------------------------------------------------------------------------- -# hcs - install -p $(shell ls -1 $(externals_src)/hcs/*.pd | \ - grep -v '\-help.pd') $(objectsdir) -# general - install -p $(externals_src)/hcs/general/*.pd $(objectsdir) -# pan - install -p $(shell ls -1 $(externals_src)/hcs/pan/*.pd | \ - grep -v '\-help.pd') $(objectsdir) - #==============================================================================# # @@ -1867,8 +1938,6 @@ devsymlinks: # the destination-specific clean targets are in Makefile.buildlayout clean: $(patsubst %, %_clean,$(LIB_TARGETS)) - -rm -f -- $(BUILDSRC_OBJECTS:.c=.o) - -rm -f -- $(BUILDSRC_OBJECTS:.c=.$(EXTENSION)) distclean: clean cruft_clean diff --git a/externals/build/src/linuxevent.c b/externals/build/src/linuxevent.c index 11ca7da6..703a0ca8 100644 --- a/externals/build/src/linuxevent.c +++ b/externals/build/src/linuxevent.c @@ -1 +1 @@ -#include "../../hcs/linuxevent.c" +#include "../../deprecated/linuxevent.c" diff --git a/externals/build/src/linuxmouse.c b/externals/build/src/linuxmouse.c index 7cc9a9bc..9533d47b 100644 --- a/externals/build/src/linuxmouse.c +++ b/externals/build/src/linuxmouse.c @@ -1 +1 @@ -#include "../../hcs/linuxmouse.c" +#include "../../deprecated/linuxmouse.c" diff --git a/externals/build/src/pan_gogins~.c b/externals/build/src/pan_gogins~.c index dbbdbe9b..20fa55dc 100644 --- a/externals/build/src/pan_gogins~.c +++ b/externals/build/src/pan_gogins~.c @@ -1 +1 @@ -#include "../../hcs/pan_gogins~.c" +#include "../../deprecated/pan_gogins~.c" diff --git a/externals/build/src/range.c b/externals/build/src/range.c index c9024917..4dc13ad0 100644 --- a/externals/build/src/range.c +++ b/externals/build/src/range.c @@ -1 +1 @@ -#include "../../hcs/range.c" +#include "../../deprecated/range.c" diff --git a/externals/deprecated/Makefile b/externals/deprecated/Makefile new file mode 100644 index 00000000..576ff878 --- /dev/null +++ b/externals/deprecated/Makefile @@ -0,0 +1,17 @@ +TARGET := $(shell pwd | sed 's|.*/\(.*\)$$|\1|') +EXTERNALS_ROOT := $(shell pwd | sed 's|^\(/.*externals\).*|\1|') + +default: + make -C $(EXTERNALS_ROOT) $(TARGET) + +install: + make -C $(EXTERNALS_ROOT) $(TARGET)_install + +clean: + make -C $(EXTERNALS_ROOT) $(TARGET)_clean + +test_locations: + make -C $(EXTERNALS_ROOT) test_locations + +etags: + etags *.[ch] ~/cvs/pure-data/pd/src/*.[ch] /usr/include/*.h /usr/include/sys/*.h diff --git a/externals/deprecated/doc/pan_gogins~-README.txt b/externals/deprecated/doc/pan_gogins~-README.txt new file mode 100644 index 00000000..7a059ef2 --- /dev/null +++ b/externals/deprecated/doc/pan_gogins~-README.txt @@ -0,0 +1,39 @@ +*********************************************************************** + File: pan_gogins~.c (a quick hack of pan~.c) + Auth: Marco Scoffier [marco@metm.org] modified code by + Iain Mott [iain.mott@bigpond.com] + Maintainer (of pan~.c) : Iain Mott [iain.mott@bigpond.com] + Date: March 2003 + + Description: Pd signal external. Stereo panning implementing an + algorithm concieved by Michael Gogins and described at + http://www.csounds.com/ezine/autumn1999/beginners/ + Angle input specified in degrees. -45 left, 0 centre, 45 right. + See supporting Pd patch: pan_gogins~.pd + + Copyright (C) 2001 by Iain Mott [iain.mott@bigpond.com] + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License, which should be included with this + program, for more details. + +*********************************************************************** +I only tested this patch under linux. + +INSTALLATION: + + type make pd_linux (or your platform's make target see Makefile) + + cp pan_gogins~.pd_linux to your pd/externs directory, + or somewhere in your pd -path + + cp pan_gogins~.pd into your pd/docs/5.reference directory + +Enjoy diff --git a/externals/deprecated/examples/linuxevent-joystick.pd b/externals/deprecated/examples/linuxevent-joystick.pd new file mode 100644 index 00000000..029b7f33 --- /dev/null +++ b/externals/deprecated/examples/linuxevent-joystick.pd @@ -0,0 +1,76 @@ +#N canvas 455 201 722 483 10; +#X msg 35 43 start; +#X msg 44 62 stop; +#X obj 16 9 inlet; +#X obj 79 116 pack f f f; +#X obj 137 159 print UNKNOWN_JOYSTICK_EVENT_TYPE; +#X text 148 139 types (1=buttons 3=abs axes); +#X obj 167 256 print UNKNOWN_JOYSTICK_EVENT_CODE; +#X obj 275 409 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 306 409 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 337 409 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 369 408 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 400 408 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 431 409 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 557 410 bng 30 250 50 0 empty empty not_routed 33 6 1 8 -262144 +-1 -1; +#X obj 275 386 route 288 289 290 291 292 293 294 295 296; +#X obj 464 409 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 493 408 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 525 408 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 79 139 route 3 1; +#X obj 38 378 outlet; +#X obj 59 357 outlet; +#X obj 80 337 outlet; +#X obj 102 317 outlet; +#X obj 123 297 outlet; +#X obj 144 277 outlet; +#X text 52 214 codes (0=X 1=Y 6=throttle 7=rudder \, 16=hat0X \, 17=hat0Y) +; +#X obj 456 338 outlet; +#X text 446 354 button_num; +#X text 537 355 button_value; +#X obj 556 339 outlet; +#X obj 456 272 unpack f f; +#X obj 456 308 - 288; +#X obj 16 86 linuxevent \$1; +#X obj 38 234 route 0 1 7 16 17 6; +#X connect 0 0 32 0; +#X connect 1 0 32 0; +#X connect 2 0 32 0; +#X connect 3 0 18 0; +#X connect 14 0 7 0; +#X connect 14 1 8 0; +#X connect 14 2 9 0; +#X connect 14 3 10 0; +#X connect 14 4 11 0; +#X connect 14 5 12 0; +#X connect 14 6 15 0; +#X connect 14 7 16 0; +#X connect 14 8 17 0; +#X connect 14 9 13 0; +#X connect 18 0 33 0; +#X connect 18 1 14 0; +#X connect 18 1 30 0; +#X connect 18 2 4 0; +#X connect 30 0 31 0; +#X connect 30 1 29 0; +#X connect 31 0 26 0; +#X connect 32 1 3 0; +#X connect 32 2 3 1; +#X connect 32 3 3 2; +#X connect 33 0 19 0; +#X connect 33 1 20 0; +#X connect 33 2 21 0; +#X connect 33 3 22 0; +#X connect 33 4 23 0; +#X connect 33 5 24 0; diff --git a/externals/deprecated/help/linuxevent-help.pd b/externals/deprecated/help/linuxevent-help.pd new file mode 100644 index 00000000..2cd51b8f --- /dev/null +++ b/externals/deprecated/help/linuxevent-help.pd @@ -0,0 +1,276 @@ +#N canvas 560 58 570 624 10; +#X floatatom 234 320 5 0 0 3 code - -; +#X floatatom 298 320 5 0 0 3 value - -; +#X floatatom 170 320 4 0 0 3 type - -; +#X floatatom 97 320 9 0 0 3 time - -; +#X msg 165 196 start; +#X msg 166 218 stop; +#X obj 107 297 linuxevent /dev/input/event0; +#X obj 107 178 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 18 178 metro 20; +#X text 286 254 time between polls (ms); +#X obj 18 156 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 38 156 stop; +#X msg 219 254 delay 20; +#X obj 107 129 key; +#N canvas 278 328 627 540 Event_Codes 0; +#X text 28 48 (For a complete listing of Linux Input Events \, see +/usr/include/linux/input.h.); +#X obj 11 9 cnv 15 580 30 empty empty Event_Codes 20 12 1 14 -225271 +-66577 0; +#X text 32 118 EVENT CODE; +#X text 162 118 #define; +#X text 232 118 number; +#X text 32 133 -----------------------------------; +#X text 32 148 X Axis; +#X text 32 163 Y Axis; +#X text 32 178 Z Axis; +#X text 32 193 Horizontal Wheel; +#X text 32 208 Dial; +#X text 32 223 Wheel; +#X text 32 238 Misc; +#X text 162 148 REL_X; +#X text 162 163 REL_Y; +#X text 162 178 REL_Z; +#X text 162 193 REL_HWHEEL; +#X text 162 208 REL_DIAL; +#X text 162 223 REL_WHEEL; +#X text 162 238 REL_MISC; +#X text 247 148 0; +#X text 247 163 1; +#X text 247 178 2; +#X text 247 193 6; +#X text 247 208 7; +#X text 247 223 8; +#X text 247 238 9; +#X text 307 118 EVENT CODE; +#X text 457 118 #define; +#X text 547 118 number; +#X text 307 148 Absolute X; +#X text 307 163 Absolute Y; +#X text 307 178 Absolute Z; +#X text 307 193 RX; +#X text 307 208 RY; +#X text 307 223 RZ; +#X text 307 238 Throttle; +#X text 307 253 Rudder; +#X text 307 268 Wheel; +#X text 307 283 Gas Pedal; +#X text 307 298 Brake Pedal; +#X text 307 313 Hat Switch 0 X-axis; +#X text 307 328 Hat Switch 0 Y-axis; +#X text 307 343 Hat Switch 1 X-axis; +#X text 307 358 Hat Switch 1 Y-axis; +#X text 307 373 Hat Switch 2 X-axis; +#X text 307 388 Hat Switch 2 Y-axis; +#X text 307 403 Hat Switch 3 X-axis; +#X text 307 418 Hat Switch 3 Y-axis; +#X text 307 433 Pressure; +#X text 307 448 Distance; +#X text 307 463 Tilt X-Axis; +#X text 307 478 Tilt Y-Axis; +#X text 307 493 Misc; +#X text 457 148 ABS_X; +#X text 457 163 ABS_Y; +#X text 457 178 ABS_Z; +#X text 457 193 ABS_RX; +#X text 457 208 ABS_RY; +#X text 457 223 ABS_RZ; +#X text 457 238 ABS_THROTTLE; +#X text 457 253 ABS_RUDDER; +#X text 457 268 ABS_WHEEL; +#X text 457 283 ABS_GAS; +#X text 457 298 ABS_BRAKE; +#X text 457 313 ABS_HAT0X; +#X text 457 328 ABS_HAT0Y; +#X text 457 343 ABS_HAT1X; +#X text 457 358 ABS_HAT1Y; +#X text 457 373 ABS_HAT2X; +#X text 457 388 ABS_HAT2Y; +#X text 457 403 ABS_HAT3X; +#X text 457 418 ABS_HAT3Y; +#X text 457 433 ABS_PRESSURE; +#X text 457 448 ABS_DISTANCE; +#X text 457 463 ABS_TILT_X; +#X text 457 478 ABS_TILT_Y; +#X text 457 493 ABS_MISC; +#X text 563 148 0; +#X text 563 163 1; +#X text 563 178 2; +#X text 563 193 3; +#X text 563 208 4; +#X text 563 223 5; +#X text 563 238 6; +#X text 563 253 7; +#X text 563 268 8; +#X text 563 283 9; +#X text 563 298 10; +#X text 563 313 16; +#X text 563 328 17; +#X text 563 343 18; +#X text 563 358 19; +#X text 563 373 20; +#X text 563 388 21; +#X text 563 403 22; +#X text 563 418 23; +#X text 563 433 24; +#X text 563 448 25; +#X text 563 463 26; +#X text 563 478 27; +#X text 563 493 28; +#X obj 30 89 cnv 15 250 25 empty empty Relative_Axes 20 12 1 12 -241660 +-66577 0; +#X obj 308 89 cnv 15 280 25 empty empty Absolute_Axes 20 12 1 12 -241660 +-66577 0; +#X text 307 133 ----------------------------------------; +#X text 32 285 EVENT CODE; +#X text 138 285 #define; +#X text 232 285 number; +#X text 32 300 -----------------------------------; +#X obj 30 256 cnv 15 250 25 empty empty Joystick_Buttons 20 12 1 12 +-241660 -66577 0; +#X text 138 315 BTN_TRIGGER; +#X text 32 315 Trigger; +#X text 32 330 Thumb; +#X text 32 345 Thumb 2; +#X text 32 360 Top; +#X text 32 375 Top 2; +#X text 32 390 Pinkie; +#X text 32 405 Base 1; +#X text 138 404 BTN_BASE; +#X text 138 330 BTN_THUMB; +#X text 138 345 BTN_THUMB2; +#X text 138 360 BTN_TOP; +#X text 138 375 BTN_TOP2; +#X text 138 390 BTN_PINKIE; +#X text 245 315 288; +#X text 245 330 289; +#X text 245 345 290; +#X text 245 360 291; +#X text 245 375 292; +#X text 245 390 293; +#X text 245 405 294; +#X text 245 419 295; +#X text 245 434 296; +#X text 245 448 297; +#X text 138 418 BTN_BASE2; +#X text 138 433 BTN_BASE3; +#X text 138 447 BTN_BASE4; +#X text 32 419 Base 2; +#X text 32 434 Base 3; +#X text 32 448 Base 4; +#X text 32 463 Base 5; +#X text 32 477 Base 6; +#X text 138 462 BTN_BASE5; +#X text 138 476 BTN_BASE6; +#X text 245 463 298; +#X text 245 477 299; +#X restore 132 556 pd Event_Codes; +#N canvas 50 289 469 317 Event_Types 0; +#X text 28 48 (For a complete listing of Linux Input Events \, see +/usr/include/linux/input.h.); +#X text 61 90 EVENT TYPE; +#X text 61 135 Keys and Buttons; +#X text 61 150 Relative Axes; +#X text 61 165 Absolute Axes; +#X text 61 180 Misc Events; +#X text 61 195 LED Event; +#X text 61 210 Sounds; +#X text 61 225 Autorepeat Values; +#X text 61 240 Force Feedback; +#X text 230 90 #define; +#X text 230 135 EV_KEY; +#X text 230 150 EV_REL; +#X text 230 165 EV_ABS; +#X text 230 180 EV_MSC; +#X text 230 195 EV_LED; +#X text 230 210 EV_SND; +#X text 230 225 EV_REP; +#X text 230 240 EV_FF; +#X text 315 90 number; +#X text 331 120 0; +#X text 331 135 1; +#X text 331 150 2; +#X text 331 165 3; +#X text 331 180 4; +#X text 331 195 17; +#X text 331 210 18; +#X text 331 225 20; +#X text 331 240 21; +#X obj 11 9 cnv 15 400 30 empty empty Event_Types 20 12 1 14 -262131 +-66577 0; +#X text 230 120 EV_SYN; +#X text 61 270 Force Feedback Status; +#X text 61 120 Syncronization Events; +#X text 230 270 EV_FF_STATUS; +#X text 331 270 23; +#X text 61 105 -------------------------------------------; +#X text 331 255 22; +#X text 230 255 EV_PWR; +#X text 61 255 Power Events (for UPS); +#X restore 132 536 pd Event_Types; +#N canvas 0 22 450 300 Event_Values 0; +#X text 28 48 (For a complete listing of Linux Input Events \, see +/usr/include/linux/input.h.); +#X obj 11 9 cnv 15 400 30 empty empty Event_Values 20 12 1 14 -261681 +-66577 0; +#X restore 132 576 pd Event_Values; +#X text 1 367 Check the Pd console for supported event types and codes. +This object will report them when it opens a device.; +#X obj 2 2 cnv 15 550 25 empty empty [linuxevent] 20 12 1 16 -228992 +-66577 0; +#X text 10 44 [linuxevent] outputs raw events from the Linux Event +system. It is used for access the output of various Human Interface +Devices \, like mice \, joysticks \, tablets \, etc.; +#X text 267 539 related HID objects:; +#X obj 418 538 linuxhid; +#X text 26 105 bang to get an update when polling is stopped.; +#X msg 229 195 poll; +#X msg 229 217 nopoll; +#X text 146 177 start/stop polling (synonyms for the same thing); +#X obj 107 149 sel 98; +#X text 153 149 <- (type 'b' for a bang); +#X text 8 407 Here's an example for using a joystick:; +#X msg 65 435 start; +#X msg 109 435 stop; +#X obj 75 463 linuxevent-joystick /dev/input/event1; +#X floatatom 329 492 2 0 0 3 button# - -; +#X floatatom 386 491 2 0 0 3 button_value - -; +#X floatatom 75 492 5 0 0 3 y-axis - -; +#X floatatom 28 492 5 0 0 3 x-axis - -; +#X floatatom 174 493 3 0 0 3 hat-X - -; +#X floatatom 220 493 3 0 0 3 hat-Y - -; +#X floatatom 124 493 5 0 0 3 twist - -; +#X floatatom 263 492 5 0 0 3 throttle - -; +#X obj 418 567 pddp_open all_about_hid; +#X text 309 566 for more info:; +#X text 13 554 detailed info:; +#X text 14 605 by Hans-Christoph Steiner <hans@at.or.at>; +#X text 379 604 updated for Pd 0.38test4; +#X connect 4 0 6 0; +#X connect 5 0 6 0; +#X connect 6 0 3 0; +#X connect 6 1 2 0; +#X connect 6 2 0 0; +#X connect 6 3 1 0; +#X connect 7 0 6 0; +#X connect 8 0 6 0; +#X connect 10 0 8 0; +#X connect 11 0 8 0; +#X connect 12 0 6 0; +#X connect 13 0 26 0; +#X connect 23 0 6 0; +#X connect 24 0 6 0; +#X connect 26 0 7 0; +#X connect 29 0 31 0; +#X connect 30 0 31 0; +#X connect 31 0 35 0; +#X connect 31 1 34 0; +#X connect 31 2 38 0; +#X connect 31 3 36 0; +#X connect 31 4 37 0; +#X connect 31 5 39 0; +#X connect 31 6 32 0; +#X connect 31 7 33 0; diff --git a/externals/deprecated/help/linuxmouse-help.pd b/externals/deprecated/help/linuxmouse-help.pd new file mode 100644 index 00000000..aceadc37 --- /dev/null +++ b/externals/deprecated/help/linuxmouse-help.pd @@ -0,0 +1,44 @@ +#N canvas 112 187 463 472 10; +#X floatatom 238 220 5 0 0 3 button# - -; +#X floatatom 299 220 5 0 0 3 button_value - -; +#X floatatom 190 220 2 0 0 3 wheel - -; +#X floatatom 137 220 4 0 0 3 y-axis - -; +#X floatatom 79 220 4 0 0 3 x-axis - -; +#X obj 95 193 linuxmouse /dev/input/event0; +#X obj 6 5 cnv 15 450 30 empty empty [linuxmouse] 20 12 1 16 -225280 +-66577 0; +#X text 24 263 [linuxmouse] takes events directly from a Linux event +device \, so that you get mouse data regardless of whether Pd has focus. +Also \, the data from the event system is relative and limited to the +screen size.; +#X msg 51 71 start; +#X msg 51 93 stop; +#X msg 115 70 poll; +#X msg 115 92 nopoll; +#X msg 158 165 close; +#X text 179 91 (synonyms for the same actions); +#X text 182 75 start/stop polling; +#X msg 147 122 open; +#X msg 152 142 open /dev/input/event1; +#X text 183 123 opens the previous device; +#X msg 419 10 pddp; +#X text 178 417 For more info on HIDs:; +#X text 10 441 by Hans-Christoph Steiner <hans@at.or.at>; +#X obj 340 417 pddp_open all_about_hid; +#X text 24 325 Rather than polling like the other HID objects \, [linuxmouse] +uses a pollfn so it receives events as they happen. A pollfn listens +to a network socket \, and takes action upon activity. Since all mouse +events go through the network socket between pd and pd-gui \, this +works for responding to mouse events.; +#X connect 5 0 4 0; +#X connect 5 1 3 0; +#X connect 5 2 2 0; +#X connect 5 3 0 0; +#X connect 5 4 1 0; +#X connect 8 0 5 0; +#X connect 9 0 5 0; +#X connect 10 0 5 0; +#X connect 11 0 5 0; +#X connect 12 0 5 0; +#X connect 15 0 5 0; +#X connect 16 0 5 0; diff --git a/externals/deprecated/help/pan_gogins~-help.pd b/externals/deprecated/help/pan_gogins~-help.pd new file mode 100644 index 00000000..281573dd --- /dev/null +++ b/externals/deprecated/help/pan_gogins~-help.pd @@ -0,0 +1,95 @@ +#N canvas 229 280 522 407 10; +#X floatatom 94 35 4 -45 45 0 - - -; +#X floatatom 112 85 0 0 0 0 - - -; +#N canvas 184 223 495 266 output 0; +#X obj 338 160 t b; +#X obj 338 110 f; +#X obj 338 60 inlet; +#X text 344 29 mute; +#X obj 338 185 f; +#X msg 425 178 0; +#X msg 338 85 bang; +#X obj 338 135 moses 1; +#X obj 425 153 t b f; +#X obj 397 117 moses 1; +#X obj 83 148 dbtorms; +#X obj 397 92 r master-lvl; +#X obj 83 42 r master-lvl; +#X obj 338 210 s master-lvl; +#X obj -15 176 inlet~; +#X obj 199 41 inlet; +#X text 199 18 level; +#X obj 199 100 s master-lvl; +#X msg 96 65 set \$1; +#X obj 96 89 outlet; +#X msg 214 64 \; pd dsp 1; +#X obj 83 194 line~; +#X obj -15 207 *~; +#X obj -15 236 dac~; +#X obj 83 171 pack 0 50; +#X text -17 153 audio; +#X text 93 110 show level; +#X obj 31 182 inlet~; +#X obj 31 218 *~; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 13 0; +#X connect 5 0 13 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 8 0; +#X connect 8 0 5 0; +#X connect 9 1 4 1; +#X connect 10 0 24 0; +#X connect 11 0 1 1; +#X connect 11 0 9 0; +#X connect 12 0 10 0; +#X connect 12 0 18 0; +#X connect 14 0 22 0; +#X connect 15 0 17 0; +#X connect 15 0 20 0; +#X connect 18 0 19 0; +#X connect 21 0 22 1; +#X connect 21 0 28 1; +#X connect 22 0 23 0; +#X connect 24 0 21 0; +#X connect 27 0 28 0; +#X connect 28 0 23 1; +#X restore 74 112 pd output; +#X msg 132 84 MUTE; +#X text 166 83 <-- output amplitude; +#N canvas 5 21 600 400 pulse 0; +#X obj 175 203 cos~; +#X obj 175 131 -~ 0.5; +#X obj 175 179 clip~ -0.5 0.5; +#X obj 175 227 hip~ 5; +#X obj 175 155 *~ 82; +#X obj 175 107 phasor~ 16; +#X obj 175 251 outlet~; +#X connect 0 0 3 0; +#X connect 1 0 4 0; +#X connect 2 0 0 0; +#X connect 3 0 6 0; +#X connect 4 0 2 0; +#X connect 5 0 1 0; +#X restore 22 33 pd pulse; +#X msg 21 177 \; pd dsp 1; +#X msg 91 177 \; pd dsp 0; +#X text 43 208 ON; +#X text 108 208 OFF; +#X obj 22 152 loadbang; +#X text 133 36 angle in degrees range -45 to 45; +#X obj 22 58 pan_gogins~; +#X text 17 324 pan_gogins~ a modification of pan~ by Ian Mott; +#X text 16 341 implements an algorithm conceived by Michael Gogins +and described at: http://www.csounds.com/ezine/autumn1999/beginners/ +; +#X connect 0 0 12 1; +#X connect 1 0 2 2; +#X connect 2 0 1 0; +#X connect 3 0 2 3; +#X connect 5 0 12 0; +#X connect 10 0 6 0; +#X connect 12 0 2 0; +#X connect 12 1 2 1; diff --git a/externals/deprecated/help/range-help.pd b/externals/deprecated/help/range-help.pd new file mode 100644 index 00000000..8a3b11c0 --- /dev/null +++ b/externals/deprecated/help/range-help.pd @@ -0,0 +1,31 @@ +#N canvas 381 126 552 355 12;
+#X floatatom 27 277 8 0 0;
+#X floatatom 27 73 5 0 0;
+#X text 213 48 written by <olaf.matthes@gmx.de>;
+#X text 37 306 creation:;
+#X text 141 11 range :: range input from a certain input range;
+#X text 212 29 to lie between output boundaries;
+#X floatatom 56 131 5 0 0;
+#X floatatom 85 152 5 0 0;
+#X floatatom 115 173 5 0 0;
+#X floatatom 144 194 5 0 0;
+#X text 84 71 input value;
+#X text 106 278 ranged output value;
+#X text 111 130 in low;
+#X text 137 151 in high;
+#X text 171 172 out low;
+#X text 200 194 out high;
+#X text 57 104 creation arguments can be changed dynamically:;
+#X text 53 323 range <in low> <in high> <out low> <out high> <log coeff>
+;
+#X obj 27 249 range 0 9 100 255 0;
+#X floatatom 174 220 5 0 0;
+#X text 227 219 log coefficient;
+#X text 265 237 0 = linear 1 = log;
+#X connect 1 0 18 0;
+#X connect 6 0 18 1;
+#X connect 7 0 18 2;
+#X connect 8 0 18 3;
+#X connect 9 0 18 4;
+#X connect 18 0 0 0;
+#X connect 19 0 18 5;
diff --git a/externals/deprecated/linuxevent.c b/externals/deprecated/linuxevent.c new file mode 100644 index 00000000..a976dd04 --- /dev/null +++ b/externals/deprecated/linuxevent.c @@ -0,0 +1,285 @@ +#include <m_pd.h> + +#include "linuxhid.h" + +#define LINUXEVENT_DEVICE "/dev/input/event0" + +static char *version = "$Revision: 1.1 $"; + +/*------------------------------------------------------------------------------ + * CLASS DEF + */ +static t_class *linuxevent_class; + +typedef struct _linuxevent { + t_object x_obj; + t_int x_fd; + t_symbol *x_devname; + t_clock *x_clock; + int x_read_ok; + int x_started; + int x_delay; +#ifdef __gnu_linux__ + struct input_event x_input_event; +#endif + t_outlet *x_input_event_time_outlet; + t_outlet *x_input_event_type_outlet; + t_outlet *x_input_event_code_outlet; + t_outlet *x_input_event_value_outlet; +}t_linuxevent; + +/*------------------------------------------------------------------------------ + * IMPLEMENTATION + */ + +void linuxevent_stop(t_linuxevent* x) { + DEBUG(post("linuxevent_stop");); + + if (x->x_fd >= 0 && x->x_started) { + clock_unset(x->x_clock); + post("linuxevent: polling stopped"); + x->x_started = 0; + } +} + +static int linuxevent_close(t_linuxevent *x) { + DEBUG(post("linuxevent_close");); + +/* just to be safe, stop it first */ + linuxevent_stop(x); + + if (x->x_fd <0) return 0; + close (x->x_fd); + post ("[linuxevent] closed %s",x->x_devname->s_name); + + return 1; +} + +static int linuxevent_open(t_linuxevent *x, t_symbol *s) { + int eventType, eventCode, buttons, rel_axes, abs_axes, ff; +#ifdef __gnu_linux__ + unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)]; +#endif + char devicename[256] = "Unknown"; + DEBUG(post("linuxevent_open");) + + linuxevent_close(x); + + /* set obj device name to parameter + * otherwise set to default + */ + if (s != &s_) + x->x_devname = s; + +#ifdef __gnu_linux__ + /* open device */ + if (x->x_devname) { + /* open the device read-only, non-exclusive */ + x->x_fd = open (x->x_devname->s_name, O_RDONLY | O_NONBLOCK); + /* test if device open */ + if (x->x_fd < 0 ) { + post("[linuxevent] open %s failed",x->x_devname->s_name); + x->x_fd = -1; + return 0; + } + } else return 1; + + /* read input_events from the LINUXEVENT_DEVICE stream + * It seems that is just there to flush the event input buffer? + */ + while (read (x->x_fd, &(x->x_input_event), sizeof(struct input_event)) > -1); + + /* get name of device */ + ioctl(x->x_fd, EVIOCGNAME(sizeof(devicename)), devicename); + post ("Configuring %s on %s",devicename,x->x_devname->s_name); + + /* get bitmask representing supported events (axes, buttons, etc.) */ + memset(bitmask, 0, sizeof(bitmask)); + ioctl(x->x_fd, EVIOCGBIT(0, EV_MAX), bitmask[0]); + post("\nSupported events:"); + + rel_axes = 0; + abs_axes = 0; + buttons = 0; + ff = 0; + + /* cycle through all possible event types */ + for (eventType = 0; eventType < EV_MAX; eventType++) { + if (test_bit(eventType, bitmask[0])) { + post(" %s (type %d) ", events[eventType] ? events[eventType] : "?", eventType); + // post("Event type %d",eventType); + + /* get bitmask representing supported button types */ + ioctl(x->x_fd, EVIOCGBIT(eventType, KEY_MAX), bitmask[eventType]); + + /* cycle through all possible event codes (axes, keys, etc.) + * testing to see which are supported + */ + for (eventCode = 0; eventCode < KEY_MAX; eventCode++) + if (test_bit(eventCode, bitmask[eventType])) { + post(" Event code %d (%s)", eventCode, names[eventType] ? (names[eventType][eventCode] ? names[eventType][eventCode] : "?") : "?"); + + switch(eventType) { +// the API changed at some point... +#ifdef EV_RST + case EV_RST: +#else + case EV_SYN: +#endif + break; + case EV_KEY: + buttons++; + break; + case EV_REL: + rel_axes++; + break; + case EV_ABS: + abs_axes++; + break; + case EV_MSC: + break; + case EV_LED: + break; + case EV_SND: + break; + case EV_REP: + break; + case EV_FF: + ff++; + break; + } + } + } + } + + post ("\nUsing %d relative axes, %d absolute axes, and %d buttons.", rel_axes, abs_axes, buttons); + if (ff > 0) post ("Detected %d force feedback types",ff); + post ("\nWARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING"); + post ("This object is under development! The interface could change at anytime!"); + post ("As I write cross-platform versions, the interface might have to change."); + post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING\n"); +#endif + + return 1; +} + +static int linuxevent_read(t_linuxevent *x,int fd) { + if (x->x_fd < 0) return 0; + +#ifdef __gnu_linux__ + while (read (x->x_fd, &(x->x_input_event), sizeof(struct input_event)) > -1) { + outlet_float (x->x_input_event_value_outlet, (int)x->x_input_event.value); + outlet_float (x->x_input_event_code_outlet, x->x_input_event.code); + outlet_float (x->x_input_event_type_outlet, x->x_input_event.type); + /* input_event.time is a timeval struct from <sys/time.h> */ + /* outlet_float (x->x_input_event_time_outlet, x->x_input_event.time); */ + } +#endif + + if (x->x_started) { + clock_delay(x->x_clock, x->x_delay); + } + + return 1; +} + +/* Actions */ +static void linuxevent_float(t_linuxevent* x) { + DEBUG(post("linuxevent_float");) + +} + +void linuxevent_delay(t_linuxevent* x, t_float f) { + DEBUG(post("linuxevent_DELAY %f",f);) + +/* if the user sets the delay less than zero, reset to default */ + if ( f > 0 ) { + x->x_delay = (int)f; + } else { + x->x_delay = DEFAULT_DELAY; + } +} + +void linuxevent_start(t_linuxevent* x) { + DEBUG(post("linuxevent_start");); + + if (x->x_fd >= 0 && !x->x_started) { + clock_delay(x->x_clock, DEFAULT_DELAY); + post("linuxevent: polling started"); + x->x_started = 1; + } else { + post("You need to set a input device (i.e /dev/input/event0)"); + } +} + +/* setup functions */ +static void linuxevent_free(t_linuxevent* x) { + DEBUG(post("linuxevent_free");) + + if (x->x_fd < 0) return; + + linuxevent_stop(x); + clock_free(x->x_clock); + close (x->x_fd); +} + +static void *linuxevent_new(t_symbol *s) { + int i; + t_linuxevent *x = (t_linuxevent *)pd_new(linuxevent_class); + + DEBUG(post("linuxevent_new");) + + post("[linuxevent] %s, written by Hans-Christoph Steiner <hans@eds.org>",version); +#ifndef __linux__ + post(" !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!"); + post(" This is a dummy, since this object only works with a Linux kernel!"); + post(" !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!"); +#endif + + /* init vars */ + x->x_fd = -1; + x->x_read_ok = 1; + x->x_started = 0; + x->x_delay = DEFAULT_DELAY; + x->x_devname = gensym(LINUXEVENT_DEVICE); + + x->x_clock = clock_new(x, (t_method)linuxevent_read); + + /* create outlets for each axis */ + x->x_input_event_time_outlet = outlet_new(&x->x_obj, &s_float); + x->x_input_event_type_outlet = outlet_new(&x->x_obj, &s_float); + x->x_input_event_code_outlet = outlet_new(&x->x_obj, &s_float); + x->x_input_event_value_outlet = outlet_new(&x->x_obj, &s_float); + + /* set to the value from the object argument, if that exists */ + if (s != &s_) + x->x_devname = s; + + /* Open the device and save settings */ + + if (!linuxevent_open(x,s)) return x; + + return (x); +} + +void linuxevent_setup(void) { + DEBUG(post("linuxevent_setup");) + linuxevent_class = class_new(gensym("linuxevent"), + (t_newmethod)linuxevent_new, + (t_method)linuxevent_free, + sizeof(t_linuxevent),0,A_DEFSYM,0); + + /* add inlet datatype methods */ + class_addfloat(linuxevent_class,(t_method) linuxevent_float); + class_addbang(linuxevent_class,(t_method) linuxevent_read); + + /* add inlet message methods */ + class_addmethod(linuxevent_class,(t_method) linuxevent_delay,gensym("delay"),A_DEFFLOAT,0); + class_addmethod(linuxevent_class,(t_method) linuxevent_open,gensym("open"),A_DEFSYM,0); + class_addmethod(linuxevent_class,(t_method) linuxevent_close,gensym("close"),0); + class_addmethod(linuxevent_class,(t_method) linuxevent_start,gensym("start"),0); + class_addmethod(linuxevent_class,(t_method) linuxevent_start,gensym("poll"),0); + class_addmethod(linuxevent_class,(t_method) linuxevent_stop,gensym("stop"),0); + class_addmethod(linuxevent_class,(t_method) linuxevent_stop,gensym("nopoll"),0); +} + diff --git a/externals/deprecated/linuxhid.h b/externals/deprecated/linuxhid.h new file mode 100644 index 00000000..ea8d34a3 --- /dev/null +++ b/externals/deprecated/linuxhid.h @@ -0,0 +1,85 @@ + +#ifdef __gnu_linux__ +#include <linux/input.h> +#endif +#ifndef NT +#include <sys/ioctl.h> +#endif + +#include <sys/stat.h> +#include <string.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/fcntl.h> +#include <unistd.h> + + +#define DEBUG(x) +//#define DEBUG(x) x + + +#define DEFAULT_DELAY 5 + +/*------------------------------------------------------------------------------ + * from evtest.c from the ff-utils package + */ + +#define BITS_PER_LONG (sizeof(long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<<OFF(x)) +#define LONG(x) ((x)/BITS_PER_LONG) +#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) + +#ifdef __gnu_linux__ +char *events[EV_MAX + 1] = { "Reset", "Key", "Relative", "Absolute", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL, "LED", "Sound", NULL, "Repeat", "ForceFeedback", NULL, "ForceFeedbackStatus"}; +char *keys[KEY_MAX + 1] = { "Reserved", "Esc", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "Minus", "Equal", "Backspace", +"Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "LeftBrace", "RightBrace", "Enter", "LeftControl", "A", "S", "D", "F", "G", +"H", "J", "K", "L", "Semicolon", "Apostrophe", "Grave", "LeftShift", "BackSlash", "Z", "X", "C", "V", "B", "N", "M", "Comma", "Dot", +"Slash", "RightShift", "KPAsterisk", "LeftAlt", "Space", "CapsLock", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", +"NumLock", "ScrollLock", "KP7", "KP8", "KP9", "KPMinus", "KP4", "KP5", "KP6", "KPPlus", "KP1", "KP2", "KP3", "KP0", "KPDot", "103rd", +"F13", "102nd", "F11", "F12", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "KPEnter", "RightCtrl", "KPSlash", "SysRq", +"RightAlt", "LineFeed", "Home", "Up", "PageUp", "Left", "Right", "End", "Down", "PageDown", "Insert", "Delete", "Macro", "Mute", +"VolumeDown", "VolumeUp", "Power", "KPEqual", "KPPlusMinus", "Pause", "F21", "F22", "F23", "F24", "KPComma", "LeftMeta", "RightMeta", +"Compose", "Stop", "Again", "Props", "Undo", "Front", "Copy", "Open", "Paste", "Find", "Cut", "Help", "Menu", "Calc", "Setup", +"Sleep", "WakeUp", "File", "SendFile", "DeleteFile", "X-fer", "Prog1", "Prog2", "WWW", "MSDOS", "Coffee", "Direction", +"CycleWindows", "Mail", "Bookmarks", "Computer", "Back", "Forward", "CloseCD", "EjectCD", "EjectCloseCD", "NextSong", "PlayPause", +"PreviousSong", "StopCD", "Record", "Rewind", "Phone", "ISOKey", "Config", "HomePage", "Refresh", "Exit", "Move", "Edit", "ScrollUp", +"ScrollDown", "KPLeftParenthesis", "KPRightParenthesis", +"International1", "International2", "International3", "International4", "International5", +"International6", "International7", "International8", "International9", +"Language1", "Language2", "Language3", "Language4", "Language5", "Language6", "Language7", "Language8", "Language9", +NULL, +"PlayCD", "PauseCD", "Prog3", "Prog4", "Suspend", "Close", +NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +"Btn0", "Btn1", "Btn2", "Btn3", "Btn4", "Btn5", "Btn6", "Btn7", "Btn8", "Btn9", +NULL, NULL, NULL, NULL, NULL, NULL, +"LeftBtn", "RightBtn", "MiddleBtn", "SideBtn", "ExtraBtn", "ForwardBtn", "BackBtn", +NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +"Trigger", "ThumbBtn", "ThumbBtn2", "TopBtn", "TopBtn2", "PinkieBtn", +"BaseBtn", "BaseBtn2", "BaseBtn3", "BaseBtn4", "BaseBtn5", "BaseBtn6", +NULL, NULL, NULL, "BtnDead", +"BtnA", "BtnB", "BtnC", "BtnX", "BtnY", "BtnZ", "BtnTL", "BtnTR", "BtnTL2", "BtnTR2", "BtnSelect", "BtnStart", "BtnMode", +"BtnThumbL", "BtnThumbR", NULL, +"ToolPen", "ToolRubber", "ToolBrush", "ToolPencil", "ToolAirbrush", "ToolFinger", "ToolMouse", "ToolLens", NULL, NULL, +"Touch", "Stylus", "Stylus2" }; + +char *absval[5] = { "Value", "Min ", "Max ", "Fuzz ", "Flat " }; +char *relatives[REL_MAX + 1] = { "X", "Y", "Z", NULL, NULL, NULL, "HWheel", "Dial", "Wheel" }; +char *absolutes[ABS_MAX + 1] = { "X", "Y", "Z", "Rx", "Ry", "Rz", "Throttle", "Rudder", "Wheel", "Gas", "Brake", +NULL, NULL, NULL, NULL, NULL, +"Hat0X", "Hat0Y", "Hat1X", "Hat1Y", "Hat2X", "Hat2Y", "Hat3X", "Hat 3Y", "Pressure", "Distance", "XTilt", "YTilt"}; +char *leds[LED_MAX + 1] = { "NumLock", "CapsLock", "ScrollLock", "Compose", "Kana", "Sleep", "Suspend", "Mute" }; +char *repeats[REP_MAX + 1] = { "Delay", "Period" }; +char *sounds[SND_MAX + 1] = { "Bell", "Click" }; + +char **names[EV_MAX + 1] = { events, keys, relatives, absolutes, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, leds, sounds, NULL, repeats, NULL, NULL, NULL }; + +#endif + +/*------------------------------------------------------------------------------ + */ diff --git a/externals/deprecated/linuxmouse.c b/externals/deprecated/linuxmouse.c new file mode 100644 index 00000000..aed33082 --- /dev/null +++ b/externals/deprecated/linuxmouse.c @@ -0,0 +1,284 @@ +#include <m_pd.h> + +#ifdef PD_MAJOR_VERSION +#include "s_stuff.h" +#else +#include "m_imp.h" +#endif + +#include "linuxhid.h" + +#define LINUXMOUSE_DEVICE "/dev/input/event0" +#define LINUXMOUSE_AXES 3 + +static char *version = "$Revision: 1.1 $"; + +/*------------------------------------------------------------------------------ + * CLASS DEF + */ +static t_class *linuxmouse_class; + +typedef struct _linuxmouse { + t_object x_obj; + t_int x_fd; + t_symbol *x_devname; + int x_read_ok; + int x_started; +#ifdef __gnu_linux__ + struct input_event x_input_event; +#endif + t_outlet *x_axis_out[LINUXMOUSE_AXES]; + t_outlet *x_button_num_out; + t_outlet *x_button_val_out; + unsigned char x_buttons; + unsigned char x_axes; +} t_linuxmouse; + +/*------------------------------------------------------------------------------ + * IMPLEMENTATION + */ + +/* Actions */ +void linuxmouse_stop(t_linuxmouse* x) { + DEBUG(post("linuxmouse_stop");); + +#ifdef __gnu_linux__ + if (x->x_fd >= 0 && x->x_started) { + sys_rmpollfn(x->x_fd); + post("[linuxmouse] stopped"); + x->x_started = 0; + } +#endif +} + +static int linuxmouse_close(t_linuxmouse *x) { + DEBUG(post("linuxmouse_close");); + +/* just to be safe, stop it first */ + linuxmouse_stop(x); + + if (x->x_fd < 0) { + return 0; + } + else { + close (x->x_fd); + post ("[linuxmouse] closed %s",x->x_devname->s_name); + return 1; + } +} + +static int linuxmouse_open(t_linuxmouse *x, t_symbol *s) { + int eventType, eventCode; + char devicename[256] = "Unknown"; +#ifdef __gnu_linux__ + unsigned long bitmask[EV_MAX][NBITS(KEY_MAX)]; +#endif + + DEBUG(post("linuxmouse_open");); + + linuxmouse_close(x); + + /* set obj device name to parameter otherwise set to default */ + if ( s != &s_ ) + x->x_devname = s; + +#ifdef __gnu_linux__ + /* open device */ + if (x->x_devname) { + /* open the device read-only, non-exclusive */ + x->x_fd = open (x->x_devname->s_name, O_RDONLY | O_NONBLOCK); + /* test if device open */ + if (x->x_fd < 0 ) { + post("[linuxmouse] open %s failed",x->x_devname->s_name); + x->x_fd = -1; + return 0; + } + } else { + post("[linuxmouse] no device set: %s",x->x_devname->s_name); + return 1; + } + +/* read input_events from the LINUXMOUSE_DEVICE stream + * It seems that is just there to flush the event input buffer? + */ + while (read (x->x_fd, &(x->x_input_event), sizeof(struct input_event)) > -1); + + /* get name of device */ + ioctl(x->x_fd, EVIOCGNAME(sizeof(devicename)), devicename); + post ("Configuring %s on %s.",devicename,x->x_devname->s_name); + post("\nSupported events:"); + + /* get bitmask representing supported events (axes, buttons, etc.) */ + memset(bitmask, 0, sizeof(bitmask)); + ioctl(x->x_fd, EVIOCGBIT(0, EV_MAX), bitmask[0]); + + x->x_axes = 0; + x->x_buttons = 0; + + /* cycle through all possible event types */ + for (eventType = 0; eventType < EV_MAX; eventType++) { + if (test_bit(eventType, bitmask[0])) { + post(" %s (type %d) ", events[eventType] ? events[eventType] : "?", eventType); + // post("Event type %d",eventType); + + /* get bitmask representing supported button types */ + ioctl(x->x_fd, EVIOCGBIT(eventType, KEY_MAX), bitmask[eventType]); + + /* cycle through all possible event codes (axes, keys, etc.) + * testing to see which are supported + */ + for (eventCode = 0; eventCode < KEY_MAX; eventCode++) { + if (test_bit(eventCode, bitmask[eventType])) { + post(" Event code %d (%s)", eventCode, names[eventType] ? (names[eventType][eventCode] ? names[eventType][eventCode] : "?") : "?"); + + if ( eventType == EV_KEY ) + x->x_buttons++; + else if ( eventType == EV_REL ) + x->x_axes++; + } + } + } + } + + post ("\nUsing %d axes and %d buttons.", x->x_axes, x->x_buttons); + post ("\nWARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING"); + post ("This object is under development! The interface could change at anytime!"); + post ("As I write cross-platform versions, the interface might have to change."); + post ("WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING\n"); +#endif + + return 1; +} + +static int linuxmouse_read(t_linuxmouse *x,int fd) { + int axis_num = 0; + t_float button_num = 0; + + if (x->x_fd < 0) return 0; + +#ifdef __gnu_linux__ + while (read (x->x_fd, &(x->x_input_event), sizeof(struct input_event)) > -1) { + if ( x->x_input_event.type == EV_REL ) { + /* Relative Axes Event Type */ + switch ( x->x_input_event.code ) { + case REL_X: + axis_num = 0; + break; + case REL_Y: + axis_num = 1; + break; + case REL_WHEEL: + axis_num = 2; + break; + } + outlet_float (x->x_axis_out[axis_num], (int)x->x_input_event.value); + } + else if ( x->x_input_event.type == EV_KEY ) { + /* key/button event type */ + switch ( x->x_input_event.code ) { + case BTN_LEFT: + button_num = 0; + break; + case BTN_RIGHT: + button_num = 1; + break; + case BTN_MIDDLE: + button_num = 2; + break; + case BTN_SIDE: + button_num = 3; + break; + case BTN_EXTRA: + button_num = 4; + break; + case BTN_FORWARD: + button_num = 5; + break; + case BTN_BACK: + button_num = 6; + break; + } + outlet_float (x->x_button_val_out, x->x_input_event.value); + outlet_float (x->x_button_num_out, button_num); + } + } +#endif + + return 1; +} + +void linuxmouse_start(t_linuxmouse* x) { + DEBUG(post("linuxmouse_start");); + +/* if the device isn't open already, open it */ +/* (I'll test this later -HCS) */ +/* if (x->x_fd < 0) linuxmouse_open(x,&s_); */ + +#ifdef __gnu_linux__ + if (x->x_fd >= 0 && !x->x_started) { + sys_addpollfn(x->x_fd, (t_fdpollfn)linuxmouse_read, x); + post("[linuxmouse] started"); + x->x_started = 1; + } else { + post("You need to set a input device (i.e /dev/input/event0)"); + } +#endif +} + +/* setup functions */ +static void linuxmouse_free(t_linuxmouse* x) { + DEBUG(post("linuxmouse_free");); + + if (x->x_fd < 0) return; + linuxmouse_stop(x); + close (x->x_fd); +} + +static void *linuxmouse_new(t_symbol *s) { + int i; + t_linuxmouse *x = (t_linuxmouse *)pd_new(linuxmouse_class); + + DEBUG(post("linuxmouse_new");); + + post("[linuxmouse] %s, written by Hans-Christoph Steiner <hans@eds.org>",version); +#ifndef __gnu_linux__ + post(" !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!"); + post(" This is a dummy, since this object only works with a Linux kernel!"); + post(" !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!"); +#endif + + /* init vars */ + x->x_fd = -1; + x->x_read_ok = 1; + x->x_started = 0; + x->x_devname = gensym("/dev/input/event0"); + + /* create outlets for each axis */ + for (i = 0; i < LINUXMOUSE_AXES; i++) + x->x_axis_out[i] = outlet_new(&x->x_obj, &s_float); + + /* create outlets for buttons */ + x->x_button_num_out = outlet_new(&x->x_obj, &s_float); + x->x_button_val_out = outlet_new(&x->x_obj, &s_float); + + if (!linuxmouse_open(x,s)) return x; + + return (x); +} + +void linuxmouse_setup(void) { + DEBUG(post("linuxmouse_setup");); + linuxmouse_class = class_new(gensym("linuxmouse"), + (t_newmethod)linuxmouse_new, + (t_method)linuxmouse_free, + sizeof(t_linuxmouse), 0, A_DEFSYM, 0); + + /* add inlet message methods */ + class_addmethod(linuxmouse_class,(t_method) linuxmouse_open,gensym("open"),A_DEFSYM,0); + class_addmethod(linuxmouse_class,(t_method) linuxmouse_close,gensym("close"),0); + class_addmethod(linuxmouse_class,(t_method) linuxmouse_start,gensym("start"),0); + class_addmethod(linuxmouse_class,(t_method) linuxmouse_stop,gensym("stop"),0); + class_addmethod(linuxmouse_class,(t_method) linuxmouse_start,gensym("poll"),0); + class_addmethod(linuxmouse_class,(t_method) linuxmouse_stop,gensym("nopoll"),0); +} + diff --git a/externals/deprecated/pan_gogins~.c b/externals/deprecated/pan_gogins~.c new file mode 100644 index 00000000..3bef226b --- /dev/null +++ b/externals/deprecated/pan_gogins~.c @@ -0,0 +1,109 @@ +/*************************************************************************** + * File: pan_gogins~.c (a quick hack of pan~.c) + * Auth: Marco Scoffier [marco@metm.org] modified code by + * Iain Mott [iain.mott@bigpond.com] + * Maintainer (of pan~.c) : Iain Mott [iain.mott@bigpond.com] + * Date: March 2003 + * + * Description: Pd signal external. Stereo panning implementing an + * algorithm concieved by Michael Gogins and described at + * http://www.csounds.com/ezine/autumn1999/beginners/ + * Angle input specified in degrees. -45 left, 0 centre, 45 right. + * See supporting Pd patch: pan_gogins~.pd + * + * Copyright (C) 2001 by Iain Mott [iain.mott@bigpond.com] + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License, which should be included with this + * program, for more details. + * + ****************************************************************************/ + + +#include "m_pd.h" +#include <math.h> + +static t_class *pan_gogins_class; +#define RADCONST 0.017453293 +#define ROOT2DIV2 0.707106781 +// PHASECONST = pi - pi/2 +// as per http://www.csounds.com/ezine/autumn1999/beginners/ +#define PHASECONST 1.570796327 + +typedef struct _pan_gogins +{ + t_object x_obj; + float x_f; + float pan; + float left; + float right; +} t_pan_gogins; + +static void *pan_gogins_new(t_symbol *s, int argc, t_atom *argv) +{ + t_pan_gogins *x = (t_pan_gogins *)pd_new(pan_gogins_class); + outlet_new(&x->x_obj, gensym("signal")); + outlet_new(&x->x_obj, gensym("signal")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("panf")); + + x->x_f = 0; + x->left = ROOT2DIV2; + x->right = ROOT2DIV2; + return (x); +} + +static t_int *pan_gogins_perform(t_int *w) +{ + float *in1 = (t_float *)(w[1]); + float *out1 = (t_float *)(w[2]); + float *out2 = (t_float *)(w[3]); + int n = (int)(w[4]); + t_pan_gogins *x = (t_pan_gogins *)(w[5]); + float value; + while (n--) + { + value = *in1++; + *out1++ = value * x->left; + *out2++ = value * x->right; + } + return (w+6); +} + +static void pan_gogins_dsp(t_pan_gogins *x, t_signal **sp) +{ + int n = sp[0]->s_n; + float *in1 = sp[0]->s_vec; + float *out1 = sp[1]->s_vec; + float *out2 = sp[2]->s_vec; + + dsp_add(pan_gogins_perform, 5, + in1, out1, out2, n, x); +} + +void pan_gogins_f(t_pan_gogins *x, t_floatarg f) +{ + double angle; + f = f < -45 ? -45 : f; + f = f > 45 ? 45 : f; + angle = f * RADCONST * PHASECONST; // convert degrees to radians + x->right = ROOT2DIV2 * (cos(angle) + sin(angle)); + x->left = ROOT2DIV2 * (cos(angle) - sin(angle)); +/* post("left = %f : right = %f", x->left, x->right); */ +} + +void pan_gogins_tilde_setup(void) +{ + pan_gogins_class = class_new(gensym("pan_gogins~"), (t_newmethod)pan_gogins_new, 0, + sizeof(t_pan_gogins), 0, A_GIMME, 0); + class_addmethod(pan_gogins_class, nullfn, gensym("signal"), 0); + + class_addmethod(pan_gogins_class, (t_method)pan_gogins_dsp, gensym("dsp"), 0); + class_addmethod(pan_gogins_class, (t_method)pan_gogins_f, gensym("panf"), A_FLOAT, 0); +} diff --git a/externals/deprecated/range.c b/externals/deprecated/range.c new file mode 100644 index 00000000..106cd622 --- /dev/null +++ b/externals/deprecated/range.c @@ -0,0 +1,128 @@ +/* ------------------------- range ------------------------------------------ */
+/* */
+/* Ranges input to lie within an output range. */
+/* Written by Olaf Matthes <olaf.matthes@gmx.de> */
+/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
+
+#include "m_pd.h"
+#include <stdio.h>
+#include <math.h>
+
+static char *version = "range v0.2, written by Olaf Matthes <olaf.matthes@gmx.de>";
+
+typedef struct range
+{
+ t_object x_ob;
+ t_float x_f; /* current input value */
+ t_float x_il; /* low border of input range */
+ t_float x_ih; /* high border of input range */
+ t_float x_ol; /* low border of output range */
+ t_float x_oh; /* high border of output range */
+ t_float x_logcoeff; /* log-coefficient */
+ t_outlet *x_outlet1; /* result */
+} t_range;
+
+static void range_float(t_range *x, t_floatarg f)
+{
+ t_float ir = x->x_ih - x->x_il;
+ t_float or = x->x_oh - x->x_ol;
+ double oq;
+ double result;
+ double k;
+ if(ir == 0)
+ {
+ post("range: input range must not be 0");
+ return;
+ }
+ /* we accept an output range of 0 in case someone really wants this */
+ if(!x->x_logcoeff) /* linear */
+ {
+ k = (or / ir);
+ result = ((f - x->x_il) * k) + x->x_ol;
+ }
+ else /* logarythmical range */
+ {
+ oq = x->x_oh / x->x_ol;
+ // k = (log((double)oq)/log(x->x_logcoeff))/((double)ir);
+ k = log((double)oq)/((double)ir);
+
+ if(x->x_ol)
+ {
+ // result = (double)x->x_ol*exp(k*(double)(f - x->x_il)*log(x->x_logcoeff));
+ result = (double)x->x_ol*exp(k*(double)(f - x->x_il));
+ }
+ else
+ {
+ /* in case the low output is 0 we have to cheat... */
+ /* okay, here's the chating: we calculate for a lower out limit
+ of 1 and remove this shift after the calculation */
+ result = ((double)(x->x_ol+1)*exp(k*(double)(f - x->x_il)))-1.0;
+ }
+ }
+
+ x->x_f = f; /* save current input value */
+
+ outlet_float(x->x_outlet1, result);
+}
+
+static void range_bang(t_range *x)
+{
+ range_float(x, x->x_f); /* recalculate result */
+}
+
+static t_class *range_class;
+
+static void *range_new(t_floatarg fil, t_floatarg fih, t_floatarg fol, t_floatarg foh, t_floatarg flc)
+{
+ t_range *x = (t_range *)pd_new(range_class);
+
+ floatinlet_new(&x->x_ob, &x->x_il);
+ floatinlet_new(&x->x_ob, &x->x_ih);
+ floatinlet_new(&x->x_ob, &x->x_ol);
+ floatinlet_new(&x->x_ob, &x->x_oh);
+ floatinlet_new(&x->x_ob, &x->x_logcoeff);
+
+ x->x_outlet1 = outlet_new(&x->x_ob, gensym("float"));
+
+ /* default values taken from Max's range */
+ x->x_il = fil;
+ x->x_ih = fih;
+ if(!x->x_ih)x->x_ih = 127.0;
+ x->x_ol = fol;
+ x->x_oh = foh;
+ if(!x->x_oh)x->x_oh = 1.0;
+ x->x_logcoeff = flc;
+ x->x_f = 0;
+
+ post(version);
+
+ return (void *)x;
+}
+
+void range_setup(void)
+{
+ range_class = class_new(gensym("range"), (t_newmethod)range_new,
+ 0, sizeof(t_range), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addfloat(range_class, range_float);
+ class_addbang(range_class, range_bang);
+ class_sethelpsymbol(range_class, gensym("range.pd"));
+}
+
|