All of lore.kernel.org
 help / color / mirror / Atom feed
* Raspberry PI reports no channels, period and buffer
@ 2017-09-03  9:46 Petr Kulhavy
  2017-09-03 13:32 ` Clemens Ladisch
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Kulhavy @ 2017-09-03  9:46 UTC (permalink / raw)
  To: alsa-devel

Hi,

I'm writing an audio decoding program for ALSA, which among others 
detects audio capabilities.
It uses the snd_pcm_hw_params_get_XXX() functions for that.
This works well on my Ubuntu PC but on Raspberry PI 3 these calls return 
no information. They return success but the min and max values are 
meaningless.

For instance the period:

     err = snd_pcm_hw_params_get_period_size_min(hw_params, 
&m_period_min, NULL);
     if (err < 0) {
         LOG(LOG_ERROR, LOG_OBJ "Failed to get minimum period time: 
%s\n", snd_strerror(err));
         goto fail;
     }
     err = snd_pcm_hw_params_get_period_size_max(hw_params, 
&m_period_max, NULL);
     if (err < 0) {
         LOG(LOG_ERROR, LOG_OBJ "Failed to get maximum period time: 
%s\n", snd_strerror(err));
         goto fail;
     }
     err = snd_pcm_hw_params_get_period_time_min(hw_params, 
&m_period_min_us, NULL);
     if (err < 0) {
         LOG(LOG_ERROR, LOG_OBJ "Failed to get minimum period time: 
%s\n", snd_strerror(err));
         goto fail;
     }
     err = snd_pcm_hw_params_get_period_time_max(hw_params, 
&m_period_max_us, NULL);
     if (err < 0) {
         LOG(LOG_ERROR, LOG_OBJ "Failed to get maximum period time: 
%s\n", snd_strerror(err));
         goto fail;
     }
     LOG(LOG_DEBUG, LOG_OBJ "Supported period: %lu to %lu frames (%u to 
%u us)\n",
             (unsigned long)m_period_min, (unsigned long)m_period_max,
             m_period_min_us, m_period_max_us);


This prints:
Supported period: 0 to 0 frames (1 to 0 us)


     // query buffer size
     err = snd_pcm_hw_params_get_buffer_size_min(hw_params, &m_buffer_min);
     if (err < 0) {
         LOG(LOG_ERROR, LOG_OBJ "Failed get minimum buffer time: %s\n", 
snd_strerror(err));
         goto fail;
     }
     err = snd_pcm_hw_params_get_buffer_size_max(hw_params, &m_buffer_max);
     if (err < 0) {
         LOG(LOG_ERROR, LOG_OBJ "Failed get maximum buffer time: %s\n", 
snd_strerror(err));
         goto fail;
     }
     err = snd_pcm_hw_params_get_buffer_time_min(hw_params, 
&m_buffer_min_us, NULL);
     if (err < 0) {
         LOG(LOG_ERROR, LOG_OBJ "Failed get minimum buffer time: %s\n", 
snd_strerror(err));
         goto fail;
     }
     err = snd_pcm_hw_params_get_buffer_time_max(hw_params, 
&m_buffer_max_us, NULL);
     if (err < 0) {
         LOG(LOG_ERROR, LOG_OBJ "Failed get maximum buffer time: %s\n", 
snd_strerror(err));
         goto fail;
     }
     LOG(LOG_DEBUG, LOG_OBJ "Supported buffer size: %lu to %lu frames 
(%u to %u us)\n",
             (unsigned long)m_buffer_min, (unsigned long)m_buffer_max,
             m_buffer_min_us, m_buffer_max_us);

This prints:
Supported buffer size: 0 to 0 frames (1 to 0 us)


And so on. Same for the number of periods and channels.
On the other hand the snd_pcm_hw_params_test_XXX() calls do work and 
that way I can detect the rates, formats, accesses.
Why is that? Am I doing something wrong? And more importantly, how can I 
get the buffering and channel information?

Thanks
Petr

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Raspberry PI reports no channels, period and buffer
  2017-09-03  9:46 Raspberry PI reports no channels, period and buffer Petr Kulhavy
@ 2017-09-03 13:32 ` Clemens Ladisch
  0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2017-09-03 13:32 UTC (permalink / raw)
  To: alsa-devel

Petr Kulhavy wrote:
> I'm writing an audio decoding program for ALSA, which among others detects audio capabilities.
> It uses the snd_pcm_hw_params_get_XXX() functions for that.

How did you get the hw_params?


Regards,
Clemens

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-03 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-03  9:46 Raspberry PI reports no channels, period and buffer Petr Kulhavy
2017-09-03 13:32 ` Clemens Ladisch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.