Executing js before Max connects inlets, outlets

    Jan 10 2014 | 1:02 pm
    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. ) ?

    • Jan 11 2014 | 7:29 pm
      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".
    • Jan 11 2014 | 10:21 pm
      Maybe you could connect the lines using scripting with the thispatcher object.
    • Jan 13 2014 | 9:42 am
      That could be a feature request for cycling74 to build a functionality like initbang in Pd.
    • Jan 13 2014 | 1:47 pm
      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.
    • Jan 14 2014 | 7:02 pm
      @hardcoder Nice hack! :) I think I will this in my patches sometime.