#include <Accumulator.h>
Inherits Marsyas::MarSystem.
Accumulate result of multiple tick process calls to child (i.e internal) MarSystem. Spit output only once when all the results are accumulated (either using a predefined number of processing ticks or when explicitly "flushed"). Used to change the rate of process requests.
For example, if mode is "countTicks" and nTimes is 5, then each time the Accumulator receives a tick(), it sends 5 tick()s to the MarSystems that are inside it.
Controls:
nTimes control) to the child MarSystem. In "explicitFlush" mode, it keeps accumulating the result of multiple tick process calls to the child MarSystem until the flush control is set to true, subsequently sending the accumulated data to the output.
timesToKeep control allows the specify how many ticks "into the future" it will need to accumulate in order to be able to decide a flush. In such a case, the onset event (which should correspond to a flush to the accumulator) should have benen issued "timesToKeep" ticks ago... a way to achieve that is to output the accumulated data minus the last "timesToKeep" ticks, which will be held internally for the next accumulation process. A graphical example, where each dot (".") represents an accumulated output from the child MarSystem, and the X is a special output where some flush decision should be made:..........X.
So, having the graphic above in mind, supose we have an Accumulator in "explicitFlush", with a child onset detector MarSystem that at each tick, looks at its previous output and compares it to the current one, deciding if an onset existed one output ago (so, it need to look one output into the future - which is the current one! - to be able to decide). In case it determines an onset occured one output ago (marked as X in the picture above), it sets an "onset deteted" control (which should be linked to the flush control in the parent Accumulator), making the Accumulator to stop accumulating and output the accumulated data till the detected onset. However, if the timesToKeep value is set to zero, the Accumulator will output the entire accumulated data, and usually in such an onset detection scenario, it would be more interesting to have it just output the data till the detected onset, keeping the remaining data for further accumulation. The way to achieve that is to specifiy a non-zero value to the timesToKeep control, which in the current example could be set to 2 (i.e. both the previous and current data outputs will be kept internally, and all the previous accumulated data output - we could call it the pre-onset data).
Definition at line 61 of file Accumulator.h.
1.5.6