ofxMultiTouchPad (OSX) - access to the multitouch features

hi folks,
yesterday i stumbled accross an implementation as an pd-external through the pd-mailinglist and was happy to see, that it wasn’t that hard to implement. so i made a quick simple wrapper for the multitouch events from the track of the recent macbook/pro as an addon. it’s my first, so excuse any faults… it’s a rough scetch, still much to improve and not everything i wanted (sorting, timestamps, etc).
i have to say, that i am not a c++ expert, so any suggestions are happily welcome :slight_smile:

it builds only on leopard and snow leopard, as the support was added only in these version by apple. i built it on 10.6. so if anyone tries on 10.5 let me know, if any errors. i have added an example x-code project in the examples folder to put in the apps folder; it looks in the addons folder for ofxMultiTouchPad/src/…

i am curious, if it works on other machines, so let me know! any ideas, how to to makes thismore elegant?

i put it ofxMultiTouchPad.tar.bz2

[attachment=0:2neqim9b]Bildschirmfoto 2009-10-27 um 20.31.30.png[/attachment:2neqim9b]

http://vimeo.com/7294187

![](http://forum.openframeworks.cc/uploads/default/452/Bildschirmfoto 2009-10-27 um 20.31.30.png)

Works for me.

wow this is so cool! i’ve been looking for info on how to access this data but couldn’t find it anywhere! thanks for this!

Can’t seem to get it working on my MacBook 10.5 - I know the drivers differ from the MacBook to the Pro. Compiles just fine but won’t link:

‘framework not found MultitouchSupport’

Its added in the project (was apart of the xcode project) and exists on my machine (in PrivateFrameworks).

Ideas? MacBook issue or Framework issue?

FYI this thread seems to indicate its at least possible on a MacBook:

http://steike.com/code/multitouch/

thanks a lot for these quick responses! i’m happy to hear, that it works on some other machines :slight_smile:

@croby: yes, i know the link, that’s what the code i based on; where the pd-external pointed. despite the hint to change the type of the device-ref, which i did oversee, it works on SL nevertheless. i will have a look on that. but that does not relate to your issue.
have you tried, what the first comment @steike suggested? maybe the lookuppath for the frameworks is faulty by x-code. i pulled the one from the /System/Library/PrivateFrameworks because the other one looked strange.
do you use the 10.5 sdk or the “current mac os”? try changing this for all targets to “current mac os”. hope it helps. unfortunately i do not have a leopard install at hand.

@jens: I’ve now tried on two systems, both 10.5, one MacBook and one MacBook Pro, both to no avail and both failing on the same step ‘framework not found MultitouchSupport’. Maybe Apple opened up access to it in 10.6 but 10.5 is out?

I’m using the /System/Library/PrivateFrameworks/MultitouchSupport.framework - the same one you already have linked in the xcode project. I’ve removed and re-added the framework thinking it might be something with the xcode project but nothing. I’m targeting 10.5, debug (release gives the same error).

Can anyone confirm this working in 10.5?

Working! It was the ‘Current Mac OS’ as target - targeting your specific OS version doesn’t work. From the site I linked before:

“Ah, I hadn’t tried compiling it in Xcode. It appears to be silently prepending all paths with /Developer/SDKs/MacOS10.xxx/. You need to change the ‘Base SDK’ setting (under Project settings) from ‘MacOS 10.whatever’ to ‘Current OS’.”

Working great on my MacBook Pro. I’ll try the MacBook tonight.

Thanks for this - I can’t wait to put this to use!

Now I’m having too much fun. One last thing:

TUIO Wrapper:
http://github.com/fajran/tongseng

plus

ofxTUIO:
http://addons.openframeworks.cc/project-…-es/ofxtuio

makes a quick and dirty multitouch software prototyping tool - can develop and test at a desk instead of having to have a large setup when you’re just writing the software

yes, i found that too, reading the initial blog entry at steike.com. as i put in the headers the of the files, http://steike.com/code/multitouch/ is a good resource to keep following.
i wonder how he found out about the API!? i ran the multitouch framework through a disassembler as well, but this is too strange for me. at least one can figure, that the frame work is thought of using cameras as tracking devices as well, at least you can find definitions for image related functions.
if anyone is interested, i can send the disassembly. or use otx yourself :smiley: it’s good, it compiles on leopard too.

i put the code on github as well, for anyone intereseted: http://github.com/ja-e/ofxMultiTouchPad/

I was trying to get this running again - I think 10.6.3 broke it.

Has anyone had a chance to try this lately? The app compiles fine but I’m getting no love with the touches. This is such a great addon, anyone have any ideas?

I’ve figured out the two small changes to make it work by looking at Tongseng.

In ofxMultiTouchPad.cpp line 68 replace:

  
MTDeviceStart(_mt_device);  

With:

  
MTDeviceStart(_mt_device, 0);  

In MTTypes.h line 77 replace:

  
void MTDeviceStart(MTDeviceRef);  

With:

  
void MTDeviceStart(MTDeviceRef, int);  

I’ll send a pull request to https://github.com/jens-a-e/ofxMultiTouchPad .

Has anyone tried getting this to work on the Magic Trackpad (Apple’s External Trackpad). I’d love to be able to use it as a wireless controller.

just updated the code to work with all devices… the points will override each-other if you have multiple devices hooked up, but it’ll work right away with your magic trackpad or magic mouse or whatever

sorry i suck at git so here is the code:
http://stfj.net/misc/ofxMultiTouchPad-alldevices.zip

I haven’t tested it with the actual magic mouse/trackpad devices, but I checked that it still works with the touchpad, so I’m pushing it up on my repository at:
https://github.com/chrisirhc/ofxMultiTouchPad

And sent a pull request to the original repository:
https://github.com/jens-a-e/ofxMultiTouchPad/pull/2

Cheers! :slight_smile:

oh awesome. thanks :slight_smile:

Here is a simple example of using multitouch with 0071

http://4u.jeffcrouse.info/of/multitouchExample.zip

If you are setting up the project from scratch, note that you have to add /System/Library/PrivateFrameworks/MultitouchSupport.framework to your project, which is somewhat different in XCode 4 than in previous versions. http://stackoverflow.com/questions/3352664/how-to-add-existing-frameworks-in-xcode-4

I really want to use this addon but on my macbook (10.11.2) looks not working…
When I run my project using this add on, I got this error.
Does anyone know how to fix this or other similar addon?

Undefined symbols for architecture i386:
“_MTDeviceStop”, referenced from:
ofxMultiTouchPad::~ofxMultiTouchPad() in ofxMultiTouchPad.o
“_MTUnregisterContactFrameCallback”, referenced from:
ofxMultiTouchPad::~ofxMultiTouchPad() in ofxMultiTouchPad.o
“_MTDeviceRelease”, referenced from:
ofxMultiTouchPad::~ofxMultiTouchPad() in ofxMultiTouchPad.o
“_MTDeviceCreateDefault”, referenced from:
ofxMultiTouchPad::ofxMultiTouchPad() in ofxMultiTouchPad.o
“_MTRegisterContactFrameCallback”, referenced from:
ofxMultiTouchPad::ofxMultiTouchPad() in ofxMultiTouchPad.o
“_MTDeviceStart”, referenced from:
ofxMultiTouchPad::ofxMultiTouchPad() in ofxMultiTouchPad.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Adding a ‘MultitouchSupport.framework’ in ‘/System/Library/PrivateFrameworks’ to your Xcode Project.