Errors, warnings, and other issues

Events are a powerful tool, as they make it possible for you to control exactly when each node in your composition executes. However, events fired at the wrong place or time can lead to problems. This section covers several problems you might encounter and the ways that Vuo can help you identify and fix them.

Infinite feedback loops

Each event is only allowed to travel once through a feedback loop. When it comes back to the first node of the feedback loop, it needs to be blocked by a walled input port. If your composition isn’t set up like this, then Vuo will tell you there’s an infinite feedback loop and won’t allow your composition to run.

The above composition is an example of an infinite feedback loop. Any event from the Fire Periodically node would get stuck forever traveling in the feedback loop from the Add node’s Sum port back to the Item 1 port. Because there’s no event wall in the feedback loop, there’s nothing to stop the event. Every feedback loop needs a node like Hold Value to block events from looping infinitely.

If your composition has an infinite feedback loop, there are several ways you can fix it. Let’s walk through a composition where you encounter a feedback loop, and look at ways to solve it.

You can use Vuo’s Blend Images node to blend two images together. This first composition creates one checkerboard image, and the image moves across the window because events from the Fired at Time trigger port are incrementing the count that becomes the X value of the 2D point that is the center of the checkerboard.

But you want to see the effect of taking the produced image from the Blend Images node and feeding it back into the Foreground input port of the node. If you try that, you see that you create an infinite feedback loop, because there is no event wall on the Foreground input port to stop an event from entering the node a second time.

So, let’s introduce a Hold Value and connect the output from the Blend Images to the New Value input port of the Hold Value node and the output from the Hold Value node to the Foreground input port of the Blend Images node. Now, what event source can we use? The composition has two nodes with trigger ports, the Fire Periodically and the Render Image to Window.

One strategy is to see if you can use the same trigger port that is already providing events to the node that will be part of the feedback loop. So, you can connect up the Fired at Time trigger port to the Update port of the Hold Value node.

This works. An event from the Fire Periodically node travels through the Count node to the Make Checkerboard Image node, to the Blend Images Node. The same event travels through a separate cable to the Hold Value node, and then to the Blend Images node. There the two events are joined.

Notice that the first event through the Hold Value node will output the value present at the Initial Value port (which has no image present), and the second event will output the value present at the New Value port. It’s not until the second event with its data reaches the Blended Images node that two images are blended. This is not important in this composition because the time between the first and second events reaching the node is small, but properly initializing your Hold Value nodes and understanding when the New Value port’s data will arrive may be important in other compositions you create.

What about using the trigger port from the Render Image to Window node? When you look at your composition, using an event from a different trigger port may work better. So, a second strategy is to see if you can use the trigger port of another node in your composition to provide events to your Hold Value node’s Update port. This composition uses the events that are generated by the Render Image to Window node’s Refreshed at Time trigger port.

In this case, you can use the same stream of events into the Count’s Increment port, simplifying your composition. Using events from a Rendered Frame trigger port is usually the best way to provide events for any type of animation in your composition.

A third approach is to insert a Spin Off Event node into your composition to generate a separate event. This is covered in the section Run slow parts of the composition in the background.

Deadlocked feedback loops

In most cases, an event needs to travel through all of the cables leading up to a node before it can reach the node itself. (The one exception is the node that starts and ends a feedback loop, since it has some cables leading into the feedback loop and some coming back around the loop.) A problem can arise if the nodes and cables in a composition are connected in a way that makes it impossible for an event to travel through all the cables leading up to a node before reaching the node itself. This problem is called a deadlocked feedback loop. If your composition has one, Vuo will tell you so and won’t allow your composition to run.

This composition is an example of a deadlocked feedback loop. Because the top Hold Value node could receive an event from the Fire on Start node through the cable from the bottom Hold Value node, the top Hold Value node needs to execute after the bottom one. But because the bottom Hold Value node could receive an event from the Fire on Start node through the cable from the top Hold Value node, the bottom Hold Value node needs to execute after the top one. Since each Hold Value node needs to execute after the other one, it’s impossible for an event to travel through the composition. To fix a deadlocked feedback loop, you need to remove some of the nodes or cables involved.

Buildup of events

What if a trigger port is firing events faster than the downstream nodes can process them? Will the events get queued up and wait until the downstream nodes are ready (causing the composition to lag), or will the composition skip some events so that it can keep up? That depends on the trigger port’s event throttling setting.

Each trigger port has two options for event throttling: enqueue events or drop events. If enqueuing events, the trigger port will keep firing events regardless of whether the downstream nodes can keep up. If dropping events, the trigger port won’t fire an event if the event would have to wait for the downstream nodes to finish processing a previous event (from this or another trigger port).

Each of these options is useful in different situations. For example, suppose you have a composition in which a Play Movie node fires events with image data and then applies a series of image filters. If you want the composition to display the resulting images in real-time, then you’d probably want the Play Movie node’s trigger port to drop events to ensure that the movie plays at its original speed. On the other hand, if you’re using the composition to apply a video post-processing effect and save the resulting images to file, then you’d probably want the trigger port to enqueue events.

When you add a node to a composition, each of its trigger ports may default to either enqueuing or dropping events. For example, the Play Movie node’s trigger port defaults to dropping events, while each of the Receive Mouse Clicks node’s trigger ports defaults to enqueuing events.

You can right-click on a trigger port and go to the Set Event Throttling menu to view or change whether the port enqueues or drops events.