Re: [Alsa-user] snd_pcm_hw_params_set_buffer_size returns -EINVAL

2016-09-27 Thread Johannes Lorenz
On Tuesday 27 September 2016 08:28:42 Clemens Ladisch wrote: > And you must set a buffer size that is supported by the device. Thanks, I just found snd_pcm_hw_params_set_buffer_size_near(). However, for our app, it would be nice to get the preferred buffer size before any PCM handle and params

[Alsa-user] snd_pcm_hw_params_set_buffer_size returns -EINVAL

2016-09-26 Thread Johannes Lorenz
Hello, this happens in [1]. You can also call snd_pcm_hw_params_set_buffer_size() before snd_pcm_hw_params() (that's probably better?), it always results in (- EINVAL). The google-answers did not help. Any idea? In my case, the buffer size is 256, but it also fails is I use 32768. Thanks on

Re: [Alsa-user] Re-opening an ALSA connection

2016-09-26 Thread Johannes Lorenz
On Monday 26 September 2016 10:05:04 Clemens Ladisch wrote: > > * 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(). Thanks, snd_pcm_recover()

[Alsa-user] Re-opening an ALSA connection

2016-09-24 Thread Johannes Lorenz
Hello, 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: