Marsyas
0.6.0-alpha
|
Accumulate result of multiple ticks. More...
#include <Accumulator.h>
Inherits MarSystem.
Public Member Functions | |
Accumulator (std::string name) | |
Accumulator (const Accumulator &a) | |
bool | addMarSystem (MarSystem *marsystem) |
MarSystem * | clone () const |
void | myProcess (realvec &in, realvec &out) |
Processes data. | |
~Accumulator () |
Accumulate result of multiple ticks.
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: - mrs_string/mode [rw] : in "countTicks" mode accumulates and outputs the result of multiple tick process calls (specified by the value in the 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
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 outputDefinition at line 115 of file Accumulator.h.
Accumulator | ( | std::string | name | ) |
Definition at line 25 of file Accumulator.cpp.
Accumulator | ( | const Accumulator & | a | ) |
Definition at line 33 of file Accumulator.cpp.
~Accumulator | ( | ) |
Definition at line 44 of file Accumulator.cpp.
bool addMarSystem | ( | MarSystem * | marsystem | ) | [virtual] |
Reimplemented from MarSystem.
Definition at line 77 of file Accumulator.cpp.
Implements MarSystem.
Definition at line 49 of file Accumulator.cpp.
Processes data.
in | Input data to read. |
out | Output data to write. |
Implement this method in subclass to define specific data processing.
Implements MarSystem.
Definition at line 156 of file Accumulator.cpp.