How to implement with SDK an object which can send/receive messages with max send/receive ?

    Devadvanced

    Chris
    Jan 08 2019 | 8:41 am
    Hello I need to implement an object which can send/receive message between instances of itself and also receive from max send and forward to max receive. I will call ss the sender and rr the receiver. I need to implement some specific behaviour. As these objects will be widely used in my patches, I prefer to create an object rather than a reusable patch. How do send/receive talk together? Thanks for your support Christophe

    • andrea agostini's icon
      andrea agostini
      Jan 08 2019 | 10:12 am
      Hi,
      send and receive talk to each other via an invisible object called "through", but I wouldn't try to hack it for your own purposes.
      What I'd do instead would be creating a custom send/receive system, possibly with an invisible "chris.through" (or tt) object—that should not be complicated. The only thing is that you shouldn't bind your tt objects to symbols, if you want them to be available to s/r/through as well, but you should build and manage your own lookup table associating names to objects instead.
      Then, when you want to send a message via [ss foo] you also send it to gensym("foo")->s_thing with object_method_typed(). This is pretty simple.
      For [rr foo] to receive a message sent from [send foo], [rr foo] could create an invisible [receive foo] object at instantiation and connect it to its own inlet—or, if you really don't want the inlet, you could create an intermediary, "symbiont" object, say rrhelper, connect [receive foo] to [rrhelper] and have [rrhelper] call the appropriate A_CANT method in [rr foo].
      I hope this helps. Cheers, aa
      Share
    • Chris's icon
      Chris's icon
      Chris
      Jan 08 2019 | 2:57 pm
      Thanks, I'll experiment that Chris