Forums > Javascript

Handling coll objects from inside js objects

May 26, 2008 | 9:02 am

Hello,
I had posted this question under "MaxMSP" section, so far got no answers, perhaps I may try to duplicate it in this section:

I am planning to implement a max prg which generates variational transformations on performer inputs (MIDI). For the manipulations and analyses to be made on the input sequence, I want to use javascript objects. Could anyone give me ideas or inform me about a method for how I can reference/handle the data structure in "coll"s using js code, within js objects at various parts of patches?

Thanks again.


May 26, 2008 | 9:49 am

AFAIK this is not possible.

You could use patcher scripting methods to set and retrieve data
remotely, but that’s not the same as accessing the data structure
directly.

And since you’re in javascript already, why not use the much more
powerful data structures possible in this language?

/*j


May 26, 2008 | 9:51 am

On 26 mai 08, at 11:02, emerson wrote:

> be made on the input sequence, I want to use javascript objects.
> Could anyone give me ideas or inform me about a method for how I can
> reference/handle the data structure in "coll"s using js code, within
> js objects at various parts of patches?

See the Maxobj section in JavascriptingMax.pdf.

An easy way would be to be to give your [coll ] instance a name (let
say "mySuperColl_hider"), define in your js file a loadbang function
like this:

var myColl;
function loadbang ()
{
myColl = this.patcher.getnamed("mySuperColl_hider");
}

and send messages to the coll like this:

function foobar()
{

myColl.message (…);

}

If you need to get values, you may have a look at this thread:

http://www.cycling74.com/forums/index.php?t=msg&goto=112604&rid=0&S=fa8a096b2d60ea595614c0c356155f31&srch=straightforward#msg_112604

I know Jeremy B. compiled a [js] version with a get function, but I
dont know wether it has made its way to a public release…

In Max5, things may have changes, but I couldn’t find any serious
documentation yet.

p

_____________________________
Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl

http://www.crfmw.be/max


May 26, 2008 | 12:07 pm

Thanks very much for the replies.

Considering your advices, it seems easier not to get involved in ‘coll’s but staying more in js arrays from the start.

Again, thanks a lot for the advices.


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