Player

Tue May 19 21:43:57 EDT 2009

This connector plays back events from a text file, usually for testing or demonstrations.

The player will read a given text file (specified via the "source" setting), playing it one line at a time, with configurable delays between lines. The default length of delay between lines is controlled by the "source.player.rate" property, in units of milliseconds.

This connector also supports timing instructions embedded in the source text file, for more precise control. The embedded timing instructions appear as XML-like tags on separate lines. The tag contains the time (in seconds) from the beginning of the file. The player will wait the appropriate length of time so that the next line is played at the given time offset. This is not an explicit delay, but the time at which the line should be played, assuming the player starts with a play clock at time=0. The example file below (simulating some farmyard events) illustrates its use:


<@ sec=0>
element=Duck, message="Quack" detected
element=Duck, message="Quack" detected
element=Duck, message="Quack" detected
<@ sec=10>
element=Barn, message=Suspicious fox lurking around
<@ sec=25>
element=Cow, message="Moos" detected

The player sets its play clock to zero when beginning. Note that the first line defines that the top of the file will start immediately. The second and third "Quack..." lines will be played according to the "source.player.rate" delay between lines since there is no timing tag immediately above each of those lines. Then the player will pause until the play clock is at 10 seconds. Assuming the "source.player.rate" was set to 1000 milliseconds (1-second), the player will have to wait approximately 8 seconds. Then in order to play the last line at a play clock value of 25, the player will wait approximately 15 seconds (since the "Suspicious fox..." line was played when the play clock was at about 10 seconds).

The "source.player.loop" value (true or false) determines if the player will replay after reaching the end of the source file. If the "source" setting does not specify an absolute path to the play file, then the setting is offset from the application's home directory.