Send finger data from Macbook multitouch trackpads over OSC
JavaScript C++ Java Objective-C++ HTML Pure Data Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
SendMultiTouchesXCode
examples
src
.gitignore
Makefile
README

README

Hello!

This is a small bit of code that will allow you to send multitouch data
from a MacBook trackpad via OSC. I bundled together two lovely bits of code:
http://gruntthepeon.free.fr/oscpkt/
http://steike.com/code/multitouch/

Thanks guys!

------------------------------------------------------------------------
Send Multi Touches
------------------------------------------------------------------------

This has only been tested using OSX Lion on the latest MacBook Air.
It will probably work on almost all recent MacBooks, and possibly Macs
using a Magic Trackpad, on most recent versions of OSX.

Download the app from the GitHub Downloads page, (or here:
https://github.com/downloads/dboehle/SendMultiTouches/Send%20Multi%20Touches.app.zip)

You can configure the address and port that it sends OSC messages to,
and that's about it.

Have fun!


------------------------------------------------------------------------
Source Code / Command Line Version
------------------------------------------------------------------------

This requires some developer tools, for g++ and make.

In order to compile and run the demos, just expand enter this directory
in the command line and run the command "make". If the command doesn't
work, then you might not have the developer tools installed. If it
didn't work for some other reason, I don't know why!

If you do have it working, though, you can run the multitouch OSC sender
with the command "./sendMultiTouches". Optionally, append "-v" to output
the messages it's sending, and "-p PORTNUM" to send them to a port other
than the default, which is 9109.

Run the test receiver using "./testReceiver" to test that the OSC messages
are being sent and received correctly on port 9109.

Right now, the messages take the format:

For verbosity level 1:
address i32 f       f
/finger	id  xpos    ypos

For verbosity level 2/3:
address i32 f     f     f     f     f     f     f     i     i     f
/finger	id  xpos  ypos  xvel  yvel  angle AXIS  axis  frame state size

If you want to change the parameters they are pretty transparent in the code.


------------------------------------------------------------------------
Examples
------------------------------------------------------------------------

Right now there are examples for Unity3D, Processing, and Flash.


The Unity demo is packaged for Unity 3.5, and you can import it into a blank
project to see the demo at work. It reads OSC signals off the default
sendMultiTouches port (9109), and shows two sprites on the screen to represent
the detected finger positions. It was originally developed for easier
prototyping for touchscreen devices, so it didn't seem very useful to implement
an arbitrary number of fingers. The other two examples are more geared for that.


The Processing demo uses the oscP5 library to receive the OSC messages, and
it just draws ellipses to the screen to represent all the current touches.
There is a dictionary from finger ID to finger information, where each
entry exists as long as the finger is held down.


The Flash demo follows the same principle as the Processing demo, but it is more
challenging to run. Because Flash doesn't natively support UDP, it must connect
via TCP to flosc, which is a Java proxy of sorts that listens for the OSC messages,
then sends them via TCP in XML form to the Flash client.

In order to run the Flash demo, you must first start flosc by navigating to the
flosc-0.3.1 folder, then running the command:
	java Gateway OSC_PORT TCP_PORT
Where the default values for OSC_PORT and TCP_PORT are 9109 and 9110, respectively.

Once you run the flosc server, you can then run the Flash demo.

------------------------------------------------------------------------