It's quite a struggle to make Leap Motion work with Pure Data on Windows. This may help you out.
Here you will find external object which outputs data from Leap Motion controller. Based on Chikashi Miyama's mac external.
Download Leap Motion external for Windows v0.1.1 as a zip file.
Unzip the archive and put extracted leapmotion folder into extra folder in your Pure Data installaion. For a demo how to use the leapmotion object, right click on it in Pure Data and see the help patch.
NotesUpdate Dec 30, 2014:
- Recompiled with Leap SDK 1.2.0+10970, it should not crash your Pure Data anymore!
- Added help patch
Update Nov 20, 2013 – v0.1.1:
- palm normal now gives correct values
- patches worked only when launched by double clicking on patch file, this is now fixed
- patches now receive events even when their window is in the background; you can control this behavior with "Allow Background Apps" toggle in Leap Motion Control Panel
If you want to compile it yourself
- Download and install Microsoft Visual Studio. I use 2013 Community Edition, it's free. Leap Motion library can be only compiled with MSVC, so you are out of luck with MinGW and Cygwin.
- Get flext via svn from https://svn.grrrr.org/ext/trunk/flext/ Put it into C:\flext
- Get pthreads-win32 from ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip, unpack it and copy contents of Pre-built.2 folder into C:\pthreads-win32
- Get Leap Motion SDK from https://developer.leapmotion.com/downloads, unpack it and copy folder LeapSDK to C:\LeapSDK
- Get "Pure Data for Windows" from http://puredata.info/downloads/pure-data, unpack it and put pd folder to C:\pd
- Get copy of Pd_leapmotion from https://github.com/jakubvaltar/Pd_leapmotion. Copy all the files to C:\Pd_leapmotion
- Locate file vcvars32.bat. It should be a part of your Microsoft Visual Studio installation. I have it at C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
- Start -> Run -> cmd
- cd to folder with vcvars32.bat and run it. This will allow you to run msvc compiler from this terminal window. If you close the terminal window, you will have to do it again.
- cd C:\flext
build pd msvc
This should throw an error, so don't panic. Open C:\flext\buildsys\config-win-pd-msvc.txt in text editor. Make changes so that
At the end of the file, add these three lines:
Save the file.
build pd msvc
It should create another config file and return error. We don't need to make any changes to this file.
build pd msvc
Now it should finally build flext.
build pd msvc install
C:\flext\build pd msvc
C:\flext\build pd msvc install
- Go to C:\pd\extra and find there leapmotion.dll. Create pd/extra/leapmotion folder in your Pure Data installation. Copy leapmotion.dll there.
- Go to C:\LeapSDK\lib\x86 and copy Leap.dll to pd/extra/leapmotion folder in your Pure Data installation.
- Congrats! Now you can use leapmotion object!
- If you don't want to build the external again, now is the right time to delete