Forums > Dev

outlet something at creation


Ch
September 5, 2012 | 12:10 pm

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


September 5, 2012 | 1:10 pm

Something like loadbang ?


September 5, 2012 | 3:16 pm

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
September 5, 2012 | 3:51 pm

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 …


September 5, 2012 | 4:02 pm

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


September 5, 2012 | 4:03 pm

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



Ch
September 5, 2012 | 4:10 pm

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


September 6, 2012 | 11:36 am

@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.)


September 6, 2012 | 12:24 pm

meanwhile, this seems to work. Agreed?

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

void max_mything_loadbang(t_max_dp_kinect *x)
{ … }


September 6, 2012 | 12:48 pm

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


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