OK, I'm not real up on how to work the Javascript patch for this. I'm testing an idea for a 4x4 matrix switcher. The JS patch has 2 inputs and 4 outputs. The ins are reading a source # and destination # as numbers, which is working good. The first input says which output is to receive the number, the 2nd input has the value to go to the designated output. Here's what I cooked up and it is not pushing anything out other than 0:

function (__number outputs[4]) main (__number inputs[2])
{
        if (inputs[0] ==1)
        {
                if (inputs[1] == 1) {outputs[0] = 1; }
                if (inputs[1] == 2) {outputs[0] = 2; }
                if (inputs[1] == 3) {outputs[0] = 3; }
                if (inputs[1] == 4) {outputs[0] = 4; }
        }
        if (inputs[0] ==2)
        {
                if (inputs[1] == 1) {outputs[1] = 1; }
                if (inputs[1] == 2) {outputs[1] = 2; }
                if (inputs[1] == 3) {outputs[1] = 3; }
                if (inputs[1] == 4) {outputs[1] = 4; }
        }
        if (inputs[0] ==3)
        {
                if (inputs[1] == 1) {outputs[2] = 1; }
                if (inputs[1] == 2) {outputs[2] = 2; }
                if (inputs[1] == 3) {outputs[2] = 3; }
                if (inputs[1] == 4) {outputs[2] = 4; }
        }
        if (inputs[0] ==4)
        {
                if (inputs[1] == 1) {outputs[3] = 1; }
                if (inputs[1] == 2) {outputs[3] = 2; }
                if (inputs[1] == 3) {outputs[3] = 3; }
                if (inputs[1] == 4) {outputs[3] = 4; }
        }
}

Is this a reasonable approach or am I missing something? Do I need to have some sort of result object like I'm seeing in some of the examples?

Thanks for any advice,

Greg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to