Forums > Javascript

Executing js before Max connects inlets, outlets

January 10, 2014 | 5:02 am

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

January 11, 2014 | 11:29 am

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".

January 11, 2014 | 2:21 pm

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

January 13, 2014 | 1:42 am

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

January 13, 2014 | 5:47 am

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.

January 14, 2014 | 11:02 am

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

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

Forums > Javascript