From alsa-devel-owner@alsa.jcu.cz  Thu Aug 27 18:08:01 1998
Received: from monet.math.chalmers.se (monet.math.chalmers.se [129.16.167.74])
	by marvin.jcu.cz (8.8.8/8.8.8) with ESMTP id SAA06262
	for <alsa-devel@alsa.jcu.cz>; Thu, 27 Aug 1998 18:06:00 +0200
Received: from morisot.math.chalmers.se (morisot.math.chalmers.se [129.16.167.91])
	by monet.math.chalmers.se (8.8.5/8.8.5) with ESMTP id SAA28974;
	Thu, 27 Aug 1998 18:05:55 +0200 (MET DST)
Received: from localhost (pin@localhost)
	by morisot.math.chalmers.se (8.8.5/8.8.5) with SMTP id SAA02808;
	Thu, 27 Aug 1998 18:05:55 +0200 (MET DST)
Date: Thu, 27 Aug 1998 18:05:54 +0200 (MET DST)
From: Ivan Popov <pin@math.chalmers.se>
To: Jaroslav Kysela <perex@jcu.cz>
cc: alsa-devel@alsa.jcu.cz
Subject: 0.2.0-pre5 - strange behaviour?
In-Reply-To: <Pine.LNX.3.96.980824193603.13060B-100000@entry.jcu.cz>
Message-ID: <Pine.GSO.3.95.980827175411.1683C-100000@morisot.math.chalmers.se>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

Hello,

I've got a question and, sorry, did not find the right place in the code
to answer myself :)

What must happen if an application opens reading from say mike,
then sometimes makes long pauses before it proceeds with reading
from the filedescriptor.

My experience was (with speak-freely's "sfmike" that waits for a keypress
to switch between pause/talk modes) as follows:

the first time you open audio device it is perfect (you read what you say
to the mike).

Then you do something else.

After 15 seconds you make repeatedly non-blocking read() until it returns
0 (zero) and through away the results in the hope to clear the buffer.

Then you read() and still get sound with 2-6 seconds delay, i.e.
the buffer becomes not cleared by previous read()-s.

Is such behaviour OK and what is the right way to flush the input buffer?

"close(); open()" does the trick but it is not the appropriate method,
or is it?

Thanks,
--
Ivan


