next up previous contents
Next: The Sound Module Interface Up: Developer's Guide Previous: The Effects Architecture   Contents

The playback code

Events are recorded into a ''round-robin'' within the playback file. The structure for the playback file is (excuse my cheesy ansi art):

 Header (struct playback_h in playback.h always first
            sizeof(struct playback_h) bytes of file)
            |
            |
         Event loop (Number of events set by  ----|
                   a #define in Playback.h)       |
           |                                      |
           ----------------------------------------

The events are recorded as they are fed to the sound engine (in engine.c), and are time stamped write before they are written to the event log, using the mix_time field of the EVENT structure. One thing to note is that the structure contains a start position field which is set and written out to the file in the header section that specifies where the round-robin in the file begins. For robustness, if the header isn't written out upon shutdown (for whatever reason), the playback code can search through the file and determine where the round-robin begins based on the mix_time's. When peepd is started in playback mode, rather than starting the server thread, a playback thread starts and reads events in the file and feeds them to the engine thread just as though they were actually received by the server.



Collin Starkweather 2002-11-03