Strange Yet Interesting Javascript Patch

bytezen's picture

Enclosed is a macro patch from the Travelator composition in the QC library.

If you look at the code window it seems to be using a type of Javascript format that I don't have access to with the standard QC 4.5 javascript patch. Namely, there is no call to function main.

What I find clever about this is that it enables you to access the last value on the output ports, in this case the previous patch time.

As a learning exercise, I am trying to replicate the same functionality with the standard Javascript patch but no dice so far. In particular the output ports are undefined and inaccessible.

Any thoughts?

PreviewAttachmentSize
Travelator Speed Macro.qtz2.87 KB

bytezen's picture
Re: Strange Yet Interesting Javascript Patch

A solution:

I am still curious about the "other" style of Javascript patch, but this inelegant solution seems to give the same result. I am using 2 Sample & Hold Patches feed back into the JS patch.

PreviewAttachmentSize
Travelator Speed Macro_v2.qtz2.27 KB

cybero's picture
Re: Strange Yet Interesting Javascript Patch

It's an example of the old style Javascript patch. Nothing unusual.