From: Takashi Iwai Subject: Re: How to kill thread server_job() in snd_pcm_open() Date: Wed, 16 Apr 2008 12:33:51 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 39071247C8 for ; Wed, 16 Apr 2008 12:33:57 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Rong-Jhe Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Mon, 14 Apr 2008 07:47:02 +0000 (UTC), Rong-Jhe wrote: > > > What you're trying to do? The server process will timeout (ends) > > itself when dmix clients are inactive. > > > > Jaroslav > > > > Thanks for your response. > My application uses two ways to play audio. > One is using pcm interface in ALSA library, and another is using dsp file. > My goal is to change the ways to play audio dynamically. > The pcm in ALSA library also uses the audio device. > There is only process can open the audio device at a time, so the audio device > must be closed before changing the way. > For example, if I open dsp file first and use write() to play audio, I need to > close the dsp file and then open pcm to use snd_pcm_writei(). > Similarly, if I open pcm first and use snd_pcm_writei(), I need to close the > pcm and then open the dsp file immediately. > Sometimes, when I change the way from using pcm to using dsp file, opening dsp > file will get errors. > I think it may be caused by the busy audio device. > Is there any methods that can indicate whether the audio device used by pcm is > free? Not quite, AFAIK. The server process keeps opening the device, so it actually "uses" it. BTW, with a recent version of ALSA drivers and libs, this server process won't be needed and won't be started at all. Think about updating the ALSA version, too. Takashi