Forums > Dev

[Stuck] Porting the Phidgets object suite to Max 6

February 2, 2014 | 1:49 pm

Dear All,

First the backstory:
I am working to support the Phidget hardware (sensors and actuators) in Max on Windows 64bit. The company has always provided excellent support for their products in Max but the last year they could not give priority to provide a modern Max 6 suite of objects (maybe I was the only one harassing them). They were willing to share the code of the old objects.

To get the project going I started on MacOS 10.9 with Xcode 5.0.2 and the Max SDK 6.1.4. The dummy object in the SDK to compiles and I can debug the external just fine. So I went ahead and modified the Phidget object code to accommodate the new style initialization routine (it was still using setup). The new code compiles and pronto a fresh new external is delivered.

Now the problem:
When I instantiate the object in Max it does not work (the object shows but no inlets/outlets and the color is that of an unrecognized object – no error message in the Max window though). When I debug the code the debugger nicely lands in the main() function and a good (it looks good to me…) t_class can be seen at the end of main(). However, the new instance routine is never called and the strange thing is that the main() is called 3 times. After which the object box shows with the same behaviour as described above.

I have been trying to get past this for the last couple of days, carefully checking the code and even taking some time off to come at it with a fresh perspective. This post is another attempt along that line.

Please share any thoughts you might have.

Kind regards,
–Aadjan


February 2, 2014 | 4:05 pm

Hi there,

it could be dependent on the source code or the way your Xcode project is setup.
In any case it is really difficult to provide some help unless you are willing to share the Xcode project along with the source code of the object in question.

- Luigi


February 3, 2014 | 10:20 am

Hi Luigi,

Would indeed appreciate if you can take a look. Find the source with this message and a zip with the working Xcode project at the following link: https://dl.dropboxusercontent.com/u/1745173/PhidgetsMaxSource.zip

Looking forward to some insights!

Kind regards,
–Aadjan

Attachments:
  1. main.c.zip

February 3, 2014 | 4:23 pm

Hi Aadjan,

please, load this external in Max 6 and tell me if it now works on your platform.
Thanks.

- Luigi


February 4, 2014 | 12:31 pm

Many thanks Luigi!

I can now see a valid Max object with an inlet and outlet. Obviously you have pushed it past the obstacle I was running into. Still not the proper response to messages but I can probably deal with that (maybe overly confident ;-).

How did you do it? I would like to reproduce it in code so I can learn and continue on.

Kind regards,
–Aadjan


February 4, 2014 | 3:27 pm

Yes, of course. I just wanted to know if my solution worked for you too…

It was a problem in the code. Here is the complete source code with my fixes.
Please notice that there is still a memory leak in the new method.
The leak was in the original code and I didn’t have time to fix it.
In any case, it should be pretty easy for you to do…

Glad I could help.
Best

- Luigi


February 6, 2014 | 11:28 am

Hi Luigi,

Sweet success! See the attached screen capture from Windows 8.1 64bit.

Still do not no exactly where I went wrong, couple of differences in the main.c you provided. My old c brain can not figure it out. Went straight ahead with your file to Windows and had to scale back from Visual Studio 2013 to express to successfully compile and build a .mxe64.

Still digging’
–Aadjan

Attachments:
  1. Capture

April 14, 2014 | 7:21 am

The libraries have been updated, you can find the Phidgets objects working with Max6.


April 14, 2014 | 7:21 am

The libraries have been updated, you can find the Phidgets objects working with Max6.http://cycling74.com/toolbox/phidgets-libraries-and-drivers/


Viewing 9 posts - 1 through 9 (of 9 total)