Hi, Now for almost all devices syncstart is emulated with a sequence of SNDCTL_DSP_SETTRIGGER calls. I want however to have a possibility to start several devices really simultaneously for envy24ht devices (this may be useful for instance for accurate synchronization of input and output streams for recording full-duplex applications). As far as I can see from audio core code, device driver adrv_sync_control is supposed to be used for such things. However I can't quite understand how it should work. handle_syncstart() calls sync_control for all devices first with SYNC_PREPARE flag, then with SYNC_TRIGGER one. These calls are independent so device driver does not know anything about how many devices and what exactly devices it should start simultaneoulsy. Without this knowledge device driver won't be able to start several device at one time even if sound card supports this. Now I could find the only way to do what I want: Device driver supposes that for all devices SYNC_PREPARE should be called fisrt, then SYNC_TRIGGER for the same devices. Thus it memorizes the last device for which SYNC_PREPARE was called. When SYNC_TRIGGER are called driver links all devices into a chain and starts all devices when a SYNC_TRIGGER is called for the device memorized on SYNC_PREPARE stage. But it's quite tricky, besides I see some potential problems: 1) handle_syncstart potentially may be terminated prematurely, in this case some devices may get SYNC_PREPARE command without SYNC_START, it's rather confusing situation (it depends of course on sync_control implementation, this is not a problem for the approach described above). 2) If several processes call syncstart in parallel, the order of sync_control calls may be totally messed up, in this case it's rather difficult to predict driver behaviour.
So my questions are: 1) Is there any sane and simple (not so tricky) way to start several devices simultaneously with the current framework? Maybe I missed something? 2) What about potential multi process problems? Wouldn't be worth to use a lock in handle_syncstart itself? 3) I'm not sure about that, but may be there is a way to improve the framework itself (this probably may require changes in some drivers though)? I understand that syncgroups may contain devices belonging to different sound cards etc, this complicates things a lot, but anyway... Regards, Zakhar Levchenko
_______________________________________________ oss-devel mailing list oss-devel@mailman.opensound.com http://mailman.opensound.com/mailman/listinfo/oss-devel