Re: Re-opening an ALSA connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Lorenz wrote:
> the C++ app I am working on uses ALSA and usually works. However, when I s2ram
> my computer while an ALSA connection is active, and the computer starts again,
> the connection is broken (snd_pcm_writei returns < 0). In that case, I'd like
> to reopen the connection. This raises up questions:
>
>   * Do the calls of snd_pcm_... have to match per thread? I.e. can you call
>     snd_pcm_open() with one thread and then call snd_pcm_close() with another
>     one? Is there a portable answer, i.e. one that's true for all systems?

You can use one device from multiple threads, but all function calls
must be serialized.

>   * Do you need to init the hardware parameters again?

No.  When you get -ESTRPIPE, the stream was suspended, and all you have
to do is to reinitialize it with snd_pcm_prepare() or snd_pcm_recover().


Regards,
Clemens

------------------------------------------------------------------------------
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user



[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux