outlet something at creation

ch's icon

Hi,

I want an object to send out something when it is created. Here's there a way to do that?
such as getting a function called when the whole patch has been created or something?
thanks for any pointers

Stephane Morisse's icon

Something like loadbang ?

diablodale's icon

I recommend trying output on your outlet at the end of your max_xxxx_new function which you declared in your setup() function in main().
Hopefully by then, all the outlets are in place and max is ready to go.

ch's icon

Something like loadbang ?

yes, something like that. but I thought the [loadbang]s were executed from top after the patch was loaded no?
Do you mean there's a function for that? How is written [loadbang] to have this functionnality then?

I recommend trying output on your outlet at the end of your max_xxxx_new function

that won't work ...

andrea agostini's icon

Hi.

No, that will not be enough, as the patch is not aware of the existence of your object yet. I'd call a function with defer_low() from your new method, and from that function output what you need from your outlets. Or, even better, you can implement the loadbang method.

hth
aa

andrea agostini's icon

("that won't be enough" refers to outputting stuff in the new method...)

ch's icon

Ah.. ok! :)
just add to implement a loadbang function..
seems I missed it in the doc.
thanks!

diablodale's icon

@Andrea, do you know where in the SDK docs is that loadbang approach? I'd like to take a quick look at it. I don't see it anywhere (sdk, examples, header, etc.)

diablodale's icon

meanwhile, this seems to work. Agreed?

addmess((method)max_mything_loadbang, "loadbang", 0);

void max_mything_loadbang(t_max_dp_kinect *x)
{ ... }

andrea agostini's icon

Uhm, I'm afraid it's something I recall from the doc of the Max 4 SDK - which, although outdated in some parts, still contains some very useful info and presents the whole thing in a way I tend to like more.

Anyway yes, that's how you should declare the loadbang method. On the other hand, be aware that if the loadbang message is sent to thispatcher, your object's loadbang method will be called.

aa