On Thu, 22 Nov 2001, James Courtier-Dutton wrote: > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED]]On Behalf Of Paul Davis > > Sent: 22 November 2001 13:13 > > To: Abramo Bagnara > > Cc: Tom Browne; [EMAIL PROTECTED] > > Subject: Re: [Alsa-devel] Restarting when in async mode > > > > > > what i am seeing the use of Hardware Abstraction Layer like ALSA or > > OSS doing to audio development on Linux is making me very unhappy. > > > > look over at MacOS X, where *every* audio program will be capable of > > (1) sharing audio interfaces in sample sync with other audio programs > > and (2) exchanging audio data in sample sync with other audio > > programs. > > > Well I don't think alsa has ever said it could do that, or has ever said it > wanted to. > > If one wishes to sample sync audio from two different programs, there has to > be a method for comparing the two streams to see if they are in sync or not. > One could take MPEG streams as a guide and use a concept of presentation > time stamp on a group of PCM samples. > I will take MPEG LPCM as an example. > An MPEG pack will contain a system clock counter, and a presentation time > stamp and a group of PCM Samples. > One uses the system clock counter to set/reference the master clock which > all applications/threads use to sync their samples. > The Presentation time stamp then tells the output device when to actually > play the PCM samples. > > For sample sync, the Presentation time stamp on two streams will be the > same, and would get mixed together before being sent to the speakers. > Without the Presentation time stamp, the program has no way of comparing two > audio stream to see if they are in sync or not. > > I don't know how MacOS X does it, but I would assume that it somehow encodes > the presentation time stamp into the audio streams being sent between > applications. > > One could probably add this feature to alsa quite easily, by adding a > "presentation time stamp" to the snd_pcm_write function call. The if two > applications were trying to output sound at the same time, alsa-lib could > compare presentation time stamps, and keep everything in sync.
We have one problem here. The Linux kernel doesn't know something like 'precise continous time', so it would be very difficult to build such system. We have already timestamp model (so application knows, where the stream was started or lastly updated), but absense of precise continuous time makes this a bit unuseable. I mean: The local time - gettimeofday is updated by clock programs like xntpd, ntpdate or date, so it is possible to have some time gaps or skips. Jaroslav ----- Jaroslav Kysela <[EMAIL PROTECTED]> SuSE Linux http://www.suse.com ALSA Project http://www.alsa-project.org _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel