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?