QC “Multiplexer” and “Demultiplexer” Patches
April 7th, 2008Using the “Multiplexer” and “Demultiplexer” Patches
The Multiplexer Patch. Sounds impressive and complicated eh? Not so - the Multiplexer is a simple switching mechanism, which like a valve in plumbing allows one signal from a selection of signals to be directed to a single output.
In the simple example shown above, we have two different image sources, only one of which is passed to the Billboard at any one time.
When the left mouse button is clicked, the linkage to the “Source Index” Port is returned as Boolean value ‘true’ - that translates to a numerical value of “1″ (0 for false, 1 for true).
Since the value was ‘false’ to begin with (0), then the “Cat” Image port was being fed through, but while the Mouse Button is down, and the value is true, then Source Port #1 is being fed through instead, showing the Dog image instead of a Cat.
In this second example, we have more than 2 sources (the number of inputs is configurable from the “settings” section of the Inspector when you click on the Multiplexer). The Interpolation Patch shown above counts through a range of 0 - 3 (including 0 thats four numbers for four images) every 4 seconds. So every second, the next image is shown. This is a quick example of providing the number inputs necessary to change selections for the Multiplexer. You could also use a “Random” Patch with Min and Max values of 0 to 3.
The Demultiplexer
Now, the Demultiplexer is just what you’d expect - the reverse of the Multiplexer.
Example - An Effect Switch Macro Patch :

The Macro viewed from the inside.

The Macro viewed from the outside.
This example is essentially an Image Effects Macro Patch with an On/Off switch.
As you can see, the “Enable” Boolean state is sent to both the Multiplexer and the Demultiplexers’ “Source Index” Inputs. In the Off State or boolean ‘false’, the effect is off, and the Image signal is bypassing the filter section and being fed straight through the linkage between Multi and Demulti, to the Macro Patches’ Image Output. When the State of the “Enable” boolean changes to true, or “1″, the Image is redirected thru the Effect Processor section, and out the other side on the Multiplexer. If the Multiplexers’ “Source Index” was not linked to the same boolean state, then the image would go through the processing, but never come out the other side.
Just out of interest, the actual effect being produced here using “Spot Light” is similar to that of a spotlight pointing at a piece of artwork on a wall. The “Image Dimensions” Patch and the “width / 2″ Math Expression Patch are being used to accurately calculate a halfway point in pixels on the vertical (Y) axis of the image, at which the Spotlight should point.
The “Effect Thru” and “Effect Switch” patches there arent patches at all - they are renamed “Input Splitters” - not found in the Patch Creator Palette, but created by right-clicking a Patch, and selecting an input port from the submenu of “Insert Input Splitter” as shown below.
Without Input and Output Splitters, I wouldn’t be able to pass an Inputs’ signal to other patches in the composition. Another unique aspect to splitters is they allow an acceptable range for an input to be established, such as a Number Splitter could have the range 1-4, or Nan to NaN, (Not a Number) meaning it has no limits. This becomes especially useful for publishing inputs to cocoa application hosts, when a number outside the expected range may cause a crash of the host application.


