Stéphane Letz wrote: > Hi, > > Our jack OSS (or Boomer) driver uses a 2 threads model (one used for > reading and one used for writing). In duplex mode, we typically open > the input and output devices separately, then use blocking "read" on > input side and blocking "write" on output side. Both threads are > synched using semaphores so that we know when to trigger a "server > cycle", that is when input have been read and ouput have been written. > > In some cases and some hardware (like RME MADI card), it seems record > in not correctly started and the input stream shows some missing > frames (like 128 frames of 0 value) or duplicated frames (like 128 > frames repeated twice.) > This problem is specific for RME MADI. In hardware level all the channels are bound together. When playback "DMA" engine is started then the recording engine will start too. If recording and playback streams are not started as an atomic operation then some samples may get lost or inserted. > It seems that the SNDCTL_DSP_SETTRIGGER ioctl (http:// > manuals.opensound.com/developer/SNDCTL_DSP_SETTRIGGER.html) should be > used for that. Is it still the case with OSS 4.0? > It is still the case. If recording and playback need to be started in sync then SETTRIGGER or SYNCGROUP/SYNCSTART must be used. > Are the following code example still correct? > > They are supposed to be correct. > http://manuals.opensound.com/developer/fulldup.c.html#LOC79 > > http://manuals.opensound.com/developer/iosync.c.html#LOC16 > > Any advice how to use SNDCTL_DSP_SETTRIGGER correctly? > SNDCTL_DSP_SETTRIGGER cannot be used with RME MADI because the input and output device files are separate. Instead you need to use SNDCTL_DSP_SYNCGROUP and SNDCTL_DSP_SYNCSTART. See http://manuals.opensound.com/developer/synctest.c.html for more info.
This may be easier to do if the input and output threads are created only after recording and playback have been started. The sync group ID returned by the first call to SYNCGROUP can be communicated between threads or processes if necessary but doing the setup in one thread is easier. Best regards, Hannu _______________________________________________ oss-devel mailing list oss-devel@mailman.opensound.com http://mailman.opensound.com/mailman/listinfo/oss-devel