From alsa-devel-owner@alsa.jcu.cz  Fri Feb  5 00:42:34 1999
Received: from renoir.op.net (root@renoir.op.net [209.152.193.4])
	by marvin.jcu.cz (8.9.1a/8.9.1) with ESMTP id AAA00134
	for <alsa-devel@alsa.jcu.cz>; Fri, 5 Feb 1999 00:38:03 +0100
Received: from someip.ppp.op.net (d-bm3-18.ppp.op.net [209.152.194.88]) by renoir.op.net (o1/$Revision: 1.18 $) with ESMTP id SAA11881 for <alsa-devel@alsa.jcu.cz>; Thu, 4 Feb 1999 18:37:22 -0500 (EST)
Message-Id: <199902042337.SAA11881@renoir.op.net>
To: alsa-devel@alsa.jcu.cz
Subject: Re: latency.. 
In-reply-to: Your message of "Thu, 04 Feb 1999 19:46:37 +0100."
             <Pine.LNX.3.96.990204192401.12560B-100000@entry.jcu.cz> 
Date: Thu, 04 Feb 1999 18:36:46 -0500
From: Paul Barton-Davis <pbd@op.net>
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

>I'm thinking about adding 'prepare' ioctls for playback and record to let
>an application control this behaviour. I'm also thinking about 
>synchronized playback and record, but only if the hardware allows it
>(something or same thing like TRIGGER in OSS PCM API). Any comments?

I'm just working on the guts of my new implementation of Csound, and
its turning out that the TRIGGER functionality in OSS seems pretty vital.
In order to get timing to work correctly, I write 2 fragments-worth of
data to the PCM buffer before starting its playback operation.  If the
card starts up as soon as I fill the first fragment, I can't
reasonably synchronize things so that I'm always writing into the
fragment 2 beyond where the hardware is currently reading.

So I think that the TRIGGER ioctl is very, very useful.

Another feature of the OSS API that I would be nice to see improved
(and this may already be done - I haven't checked) is support for
defining when select() returns. Right now, OSS requires you to mmap()
the buffer to get select() to return on fragment boundaries. Although
I'm a big fan of mmap(), I see no reason to have to use it to force
select() to work this way. I would like to do something like:

	 ioctl (fd, SNDCTL_DSP_SELECT_ON_FRAGMENT_BOUNDARY, 0);

	 while (select (....)) {
	       /* now we know that the hardware recently
	          crossed a fragment boundary, so we
		  can overwrite the previous
		  fragment and/or write-ahead a future
		  fragment.
		*/


		....
	}

--p

