From mboxrd@z Thu Jan 1 00:00:00 1970 From: Clemens Ladisch Subject: Re: Non-blocking snd_pcm_drain? Date: Sat, 10 Nov 2012 18:28:45 +0100 Message-ID: <509E8ECD.7080205@ladisch.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by alsa0.perex.cz (Postfix) with ESMTP id 75CD7261614 for ; Sat, 10 Nov 2012 18:29:02 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Daniel Sanz Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org Daniel Sanz wrote: > I noticed that the snd_pcm_drain call blocks until the buffer is > completely drained. Is there any way to drain the buffer without > a block? Try calling snd_pcm_nonblock(handle, 1). > I've tried calling snd_pcm_nonblock(handle, 1) before the call to > snd_pcm_drain but it does not work. How so? > The context is that this is an application that plays a particular WAV > sound repeatedly, so I don't want to wait until the sound is played > completely before it is played again. Then why do you drain at all? Just write the new data into the buffer. Regards, Clemens