There are two ways to get a signal stream flowing: recursively or iteratively.
Recursive control of the signal stream is very flexible. The function which controls recursive flow of the signal is the Signal class function tick:
tick | This function coordinates the order in which the action functions are called for various connected signal objects. This function may or may not need to be used. You can either figure out yourself the order in which to call the action function for each signal object, or you can tick a signal object and it will recursively tick all upstream objects. One an object has ticked all of its inputs, the tick function calls the action function. |
The tick function passes a tick values to upstream objects. If the tick value is not equal to the stored value, then the object ticks its input streams and then returns control to the downstream object that ticked it. The need to pass a tick value between objects is to enable using the recursive method of sample update as well as allowing feedback. Imagine what would happen is an object in a feedback loop did not know when to stop updating its output...
Put example flow graph here and explain it
Alternatively, you could update each signal object in correct order such that upstream elements are updated with new values which will in turn be used to update downstream objects. You might think this would be more efficient way to do things, but I have run the two different methods without seeing any difference in efficiency (not too extensive tests, however).
The Action class will be described more here later.
Code will go here. For now look at the example programs.