[alsa-devel] How to kill thread server_job() in snd_pcm_open()

Takashi Iwai tiwai at suse.de
Wed Apr 16 12:33:51 CEST 2008

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.


More information about the Alsa-devel mailing list