[alsa-devel] Raspberry PI reports no channels, period and buffer
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
participants (2)
-
Clemens Ladisch
-
Petr Kulhavy