The following code illustrates how to establish a group of streams to synchronize.
#include "os2.h" #include "os2me.h" ULONG ulRC; /* Error return code */ HSTREAM hStream1, /* Stream 1 handle */ hStream2; /* Stream 2 handle */ SLAVE slave[1]; /* Sync slave structure */ . . /*--------------------------------------------------------------*/ /* Create digital audio stream (hStream1). Create second */ /* digital audio stream (hStream2). (See SpiCreateStream, */ /* SpiAssociate, and SpiStartStream.) */ /*--------------------------------------------------------------*/ . . . /*---------------------------------------------------------------*/ /* Set up synchronization between the two streams. */ /*---------------------------------------------------------------*/ slave[0].hstreamSlave = hStream2; /* 2nd stream is slave. */ slave[0].mmtimeStart = 0; /* Time slave will start.*/ if (ulRC = SpiEnableSync (hStream1, /* Audio stream is master. */ &slave[1], 1, /* Number of slaves */ 0 )) /* Use SPCB sync granularity.*/ return (ulRC); /* error! */