Executing js before Max connects inlets, outlets

Jan 10, 2014 at 5:02am

Executing js before Max connects inlets, outlets

I wrote a custom dsp module, where the number of audio channels (means inlets, processing, parameter handling, outlets) is dynamically generated by a javascript. I call this module via bpatcher.

The problem
When I connect my module to other files, the next time, when I start my patcher, I get the error:
bpatcher: patchcord inlet out of range: deleting patchcord

This means the js code in my dynamic object is created after the wiring is done by Max.

The question
Is it possible to execute the javascript code before wiring is done (eg. before loadbang, etc. ) ?

#277902
Jan 11, 2014 at 11:29am

As far as I know there is no alternative to PureData’s [initbang] object in Max, that “gets executed just after the rest of the abstraction is built and _before_ the parent of the abstraction is finished”.

#278021
Jan 11, 2014 at 2:21pm

Maybe you could connect the lines using scripting with the thispatcher object.

#278031
Jan 13, 2014 at 1:42am

That could be a feature request for cycling74 to build a functionality like initbang in Pd.

#278056
Jan 13, 2014 at 5:47am

I found a workaround for presering the connections to my dynamic channel module.

In the original file, I create a max. number of inlets, outlets which I intend to use. All of them get their unique scripting name.

My javascript connects these in/outlets with my dsp processing and afterwards removes the inlets/outlets, which are not necessary.

It works. But a feature like initbang in Pd would be more elegant.

#278077
Jan 14, 2014 at 11:02am

@hardcoder
Nice hack! :) I think I will this in my patches sometime.

#278231

You must be logged in to reply to this topic.