Access #0 in JavaScript

Mar 30, 2013 at 7:28am

Access #0 in JavaScript

Alright, so I have a buffer, “#0-mixer-1″ which is inside a subpatcher. I want to populate the contents of buffer into waveform~. To do so, I would normally send a message like “set #0-mixer-1 1″ to the first inlet of waveform~, BUT you can’t put #0 inside of a message box.

So If I could figure out how to do that my problem would be solved. sprintf doesn’t work, a bunch of other things I’ve tried don’t work, so I thought I’d try JavaScript.

So I’m wondering, how can I access a patcher’s #0 variable within JavaScript?

#67429
Mar 30, 2013 at 7:39am

Attached are the pertinent files. If you open up either MixerChannel or MixerChannel2 you will see that everything is prefixed with #0 except for everything referencing the buffers, because of the aforementioned waveform~ “set” problem.

#242581
Mar 30, 2013 at 8:33pm

Is it not possible to access #0 from JavaScript?

#242582
Mar 30, 2013 at 10:19pm

You can only get the #0 from a js object argument, but in your case you don’t even need to. If you just prepend the #0, as you did for the send and receive, to the buffer related objects, it works fine.

Mixer.maxpat would look like that:

– Pasted Max Patch, click to expand. –
#242583
Mar 31, 2013 at 1:10am

Oh yikes it works. Thanks for taking a look! I honestly tried to do something similar to what you did but I must have done something wrong. But when I embed your version of MixerChannel twice into my Mixer patch they are indeed completely independent which is what I wanted. Thanks!

And thanks for the tip about passing #0 to JS using an argument. I didn’t think of that.

(If anyone is curious what I’m trying to do with this…. https://github.com/OpenEmu/OpenEmu/issues/546)

#242584

You must be logged in to reply to this topic.