get a send/receive method within an external

Jun 27, 2013 at 8:44am

get a send/receive method within an external

i’m trying to build up an external which should communicate straight to another object via a sw system, in a MVC architecture. The problem is that I cannot see how to implement a send/receive method inside my exetrnal.
Thanks in advance

Jun 28, 2013 at 12:23am

The clean way to do this is having your object A directly calling methods of B. This is straightforward (use object_method in one of its flavors) as long as A knows the memory address of B – which can be accomplished in a variety of ways (according to how you want your objects to be aware of each other), including binding B to a symbol:
gensym("my_B_object")->s_thing = x;
or iterating the patcher…

On a side note, but this is strictly personal, I don’t like wireless communication in Max. I am suspicious about the pattr system, value, pv and even send/receive, I use them as little as I can… I think they really work against the Max paradigm… but, then again, that’s just me… ;)


Jun 28, 2013 at 12:54am

@andrea : in the jitter world, with matrices, it’s more than convenient though…

Jun 28, 2013 at 6:20am

First of all, thx for your reply.
OK, now if i would communicate to a standard “receive” object, how am I supposed to get its memory address?
I found this on the forum :

But still I can’t outline a practical way to implement this method.
Actually my external is a float object (ui object). What i’m attempting to do, is receiving the values sent out from my external (while i’m scrolling it), in a specific “receive” object – e.g. [r receive_my_external].
I see that i’m supposed to pass “the object that will receive the message” as first parameter of object_method. Am i supposed to point to [r receive_my_external] from here?

Jun 28, 2013 at 7:06am


Do not confuse “object” and “box” in a patcher. A box is an object, but an object {is not necessary contains in} {have not} a box. When you trigger a message to a [send] ; all the [receive] objects bound to that [send] are called.

The method suggested in the topic is simple. You get the global send object reference using the “s_thing” parameter. It’s pretty well explained here ( ).

I never used this approach, and i share Andrea Agostini’s opinion. At first look it seems nice ; but i’m not sure that it’s so easy to make it “safe” (specially with a closed-source codes and all the mechanism occuring under the hood). My 2 cents.

You should also have a look on :

- Sheep.c / Shepherd.c examples in the SDK.
- ( globalsymbol_reference / globalsymbol_dereference )

Jun 29, 2013 at 6:01am


to accomplish a mechanism like send/receive, you need to use the object notification system of Max. Unfortunately, the usage of this is quite splitted up within the documentation (at least, this was the case in the Max 5 SDK — I don’t know if the situation changed with Max 6, as I still did not make that step). I implemented a generic “stream” object (an object capable of streaming bytes between externals that use my interface) within The sadam Library a few years ago, using the globalsymbol/object_notify/object_method stuff. On the one hand, you may wish to experiment with using that one; although my project is closed-source, the header file describing the interface of my streaming object is public, and the documentation contains a chapter explaining how to use it. On the other hand, you may wish to read the forum thread where I summarized the key points of attaching to/detaching from named objects (along with the links mentioned by Nicolas): (and, as a small addendum: ).

Hope this helps,

Jun 29, 2013 at 6:02am

BTW, as I have heard, the situation changed in Max 6, now it is much easier to create a proper send/receive scenario. However, if you want to stay Max5-compatible, you’ll need the solution described in the above links.


You must be logged in to reply to this topic.