19
May
08

JavaScript & Single-Cable Connection

While messing around with the composition that generated the screenshots below, I decided I needed a way of connecting macro modules together using a single virtual cable, rather than a separate one for each parameter I needed to pass in. JavaScript seemed the best way to do this. The code below takes 2 inputs, and creates an output structure.

function (__structure outputStruct) main (__number parameter0, __number parameter1)
{
	var result = new Object();
	__structure params = new Object();
	
	if(!_testMode) {
		params["param0"]=parameter0;
		params["param1"]=parameter1;
	}
	
	result.outputStruct = params;
	return result;
}

This single output can then be passed to multiple Structure Key Member patches in the destination macro, to extract the parameter values from the structure. Saves a lot of patching time when you’re wiring up, for example, 64 identical macros.

I’ve added a little example composition to my Box.net download widget. Very unexciting, I’m afraid, but you may find it useful….

Advertisements

2 Responses to “JavaScript & Single-Cable Connection”


  1. 1 hob
    May 19, 2008 at 2:02 pm

    this looks very useful. i wonder if it will make some of my compositions more efficient? at the moment I have a couple that look like spaghetti junction…

  2. 2 toneburst
    May 19, 2008 at 2:13 pm

    Hi hob,

    not sure it will actually make compositions more efficient in terms of performance. It might save you a lot of time when you’re putting things together though. I’m not a big fan of cable spaghetti, so it’s a shame I didn’t think of doing this earlier..! I’ve also noticed the QC GUI slowing down quite a lot when it dealing with a lot of patches and connections.

    a|x


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Twitter

May 2008
M T W T F S S
« Apr   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

Links

Blog Stats

  • 470,209 hits

%d bloggers like this: