Generate patches dynamically JS

Boogie's icon

Hey,

i'm new to Max/Msp and i'm writing a script which should generate my patches dynamically. So basicly it goes like this:

var first_module = this.patcher.getnamed( "first_module" );
var second_module = this.patcher.getnamed( "second_module" );

function patch ( val ) {
    this.patcher.newdefault(  first_module );
}

module 1 and 2 are simple filters in a patch..but it won't work! maybe somebody can give me a hint.. thxx in advance!

best

boogie

Lee's icon

Iirc, the new default creates a named entity, not an entity from an object, which is what you have. I'm not at computer now, but you should be able to grab the maxclass property of you're second_module and use that to create the new object... But I'm not entirely sure what you're trying to achieve here?