WiimoteLib DLL as Max external?
I’m looking to use a Wiimote as an input device for Max/MSP, and I found Brian Peek’s WiimoteLib API, whose test executable receives all of the accelerometer and button data nicely. As someone completely new to the coding/development side of Max, would it be possible to integrate the DLL into an external object for use in Max? How difficult would this be/how would I get started?
Here is the library: http://channel9.msdn.com/coding4fun/articles/Managed-Library-for-Nintendos-Wiimote
Thanks for the help!
of course, you can link a DLL anytime with your external. Don’t forget that Max externals are DLLs themselves. However, unless you have some good reason to do so, you don’t need to write an external for this particular task. There’s quite a couple of tools to receive the Wiimote’s info in MaxMSP. I’ve been using OSCulator for this purpose in many projects and never had any problem with it, but there’s also [aka.wiimote] and probably plenty of other tools as well.
The main problem (from my POV) with writing a Wiimote external using a third-party Windows-only library would be that
(1) It’s not cross-platform (you never know when you run into a Mac or a PC, so for my part I always prefer to use technologies that run on both platforms)
(2) You’ll need to maintain a code for yourself (test it with new versions of Windows/MacOS or MaxMSP, build it again from time to time etc.) for a task that is already solved and accessible.
Thanks for the timely response! As I am a Windows 7 user, I unfortunately cannot use OSCulator or [aka.wiimote]… I’ve had only intermittent success actually connecting the Wiimote via bluetooth, and Brian Peek’s WiimoteTest executable is the only means by which I can achieve a reliable, predictable connection, so I have a feeling his DLL is my best bet.
For a newb programmer, do you have any suggestions as to starter tutorials for building an external/integrating a DLL?
I’m terribly sorry, I thought both OSCulator and [aka.wiimote] are available for Windows… My mistake.
I had a look at the link that you’ve sent, probably your biggest trouble there would be that you’ll need to figure out how to mix the C# code of the API with the Max SDK, which is written in C. Unfortunately I’ve never programmed in C# and my knowledge about that language is _very_ limited, so I can’t guess how easy or hard this could turn out to be (with C++ it’s quite straightforward as an ANSI C code should compile with any C++ compiler as well, but I think this is not the case with C#).
Linking third-party DLLs to your project in Visual Studio is quite easy and AFAIK there were some posts here over the years dealing with that, just as well as the problems of static/dynamic linkage for Max externals (for example, http://cycling74.com/forums/topic.php?id=33680 or http://cycling74.com/forums/topic.php?id=32989 ).
I don’t know how ‘newb’ programmer you are. :-) If you’re more-or-less fluent in C, then it shouldn’t be very hard to overcome the above problems (at least I think so, but again, I’ve personally never dealt with C#). The Max SDK is quite well documented and comes with a lot of sample code, which in a way is better than any tutorial. So I’d just download it and maybe write something simpler to start with (just to learn the basics). Then I’d jump into this project with the C# Wiimote API. Depending on your initial skills, I’d guess this should take a couple of days, but even in the worst case, no more than 1-2 weeks.
If you don’t really know C (or if you’ve never programmed before), well, then you’ll probably need to learn to program in C first and then jump to the previous paragraph. This would increment my original time estimate considerably, though (I’d say, a couple of weeks — if you consider yourself rather slow, then months — unless you work on this project 8-12 hours a day). Although I must admit, I saw once a woman who never programmed before, but finished her first external in 3 days (well, she had some quite high-skilled assistants for those 3 days who taught her), so these kind of ‘miracles’ can always happen… ;-)