From: Clemens Ladisch <clemens@ladisch.de>
To: Erik de Castro Lopo <mle+la@mega-nerd.com>, alsa-devel@alsa-project.org
Subject: Re: Using snd_pcm_set_params() on a capture handle
Date: Sun, 25 Oct 2015 21:11:26 +0100 [thread overview]
Message-ID: <562D376E.7000308@ladisch.de> (raw)
In-Reply-To: <20151025174442.b318e489f0568566a4b82908@mega-nerd.com>
Erik de Castro Lopo wrote:
> * Is snd_pcm_set_params() supposed to work on capture handles?
Yes.
> * Is my use of snd_pcm_set_params() missing something and if so what?
No. But it does not set exactly the same parameters as the manual
hw_params calls.
Please check for differences with snd_pcm_hw_params_dump() (or look into
/proc/asound/cardX/pcm0c/sub0/hw_params).
> The program can be compiled and run in two ways:
>
> gcc -Wall -O2 -DUSE_SET_PARAMS=1 alsa_capture.c -lasound -o alsa_capture
> ./alsa_capture
>
> which fails with:
>
> Read from audio interface failed (Input/output error)
Which driver? Any messages in the system log?
> if ((err = snd_pcm_prepare (capture_handle)) < 0) {
This is done automatically by snd_pcm_hw_params().
> if ((err = snd_pcm_readi (capture_handle, buffer, buffer_frames)) != buffer_frames) {
If less than the full number of frames have been read, you get a return
value that is not an error code but a positive number.
Regards,
Clemens
next prev parent reply other threads:[~2015-10-25 20:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-25 6:44 Using snd_pcm_set_params() on a capture handle Erik de Castro Lopo
2015-10-25 20:11 ` Clemens Ladisch [this message]
2015-10-26 8:47 ` Erik de Castro Lopo
2015-10-26 9:17 ` Clemens Ladisch
2015-10-26 9:23 ` Erik de Castro Lopo
2015-10-26 9:44 ` Clemens Ladisch
2015-10-26 9:54 ` Erik de Castro Lopo
2015-10-26 11:27 ` Lars-Peter Clausen
2015-10-26 15:26 ` Raymond Yau
2015-10-26 20:00 ` Erik de Castro Lopo
2015-10-27 5:01 ` Raymond Yau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=562D376E.7000308@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=mle+la@mega-nerd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.