OK, I changed my code to do as you suggested (using the ctl interface)  
and that works.  Thanks for the info.

However, I still feel that my original gripe (the error message
output) is valid.  In all other cases that I'm aware of, you never
automatically spit out an error message to stderr or stdout.  Why 
should it be different in this case?  There is an error retrieval 
mechanism in place, namely snd_strerror().

So, what is the validation for automatically printing an error for the 
function snd_pcm_open() and not, for example, for 
snd_pcm_hw_params_any()?  Why can I not determine whether a device can 
handle input by attempting to open it with the appropriate stream 
without incurring this error message?

-------------------------------------------------
Gary Scavone
Center for Computer Research in Music & Acoustics
Stanford University
[EMAIL PROTECTED]
http://www-ccrma.stanford.edu/~gary/
-------------------------------------------------


On Sun, 21 Jul 2002, Jaroslav Kysela wrote:

>>On Sun, 21 Jul 2002, Gary Scavone wrote:
>>
>>> Yes, I know that you can determine the number of devices via the CTL
>>> interface ... that's what I use.  But you cannot determine whether
>>> those devices support input and/or output without actually attempting
>>> to open them for playback or capture (please correct me if I'm wrong
>>> about this).  So, if indeed you still need to open each device to
>>> determine its capabilities (input and/or output channels, etc...),
>>> then the previously mentioned error message should not be
>>> automatically written.
>>> 
>>> Just to clarify, the device pcmC1D1c actually exists, as reported by 
>>> the CTL interface.  However, it only supports output, not input.
>>
>>Use snd_ctl_pcm_info(). If stream is not available, -ENOENT is returned.
>>Don't forget to set device #, subdevice # and stream type before this call 
>>(see snd_pcm_info_set_*() functions).
>>
>>                                              Jaroslav
>>
>>> On Sat, 20 Jul 2002, Jaroslav Kysela wrote:
>>> 
>>> >>On Fri, 19 Jul 2002, Gary Scavone wrote:
>>> >>
>>> >>> 
>>> >>> ALSA lib pcm_hw.c:797:(snd_pcm_hw_open) open /dev/snd/pcmC1D1c failed:
>>> >>> No such file or directory
>>> >>> 
>>> >>> 
>>> >>> This message automatically gets output by the alsa library when you
>>> >>> call snd_pcm_open with SND_PCM_STREAM_CAPTURE on a device which can
>>> >>> only provide output (such as the second device of the ensoniq 1370).  
>>> >>> Since you cannot probe a device's capabilities without opening it, it
>>> >>> seems to me that the library should not automatically print this
>>> >>> message to stderr (or stdout).  Rather, the user can check the return
>>> >>> value of the call and get an error string if desired.
>>> >>> 
>>> >>> The current behavior is very confusing.
>>> >>
>>> >>You can determine the number of PCM devices via the CTL interface.
>>
>>-----
>>Jaroslav Kysela <[EMAIL PROTECTED]>
>>Linux Kernel Sound Maintainer
>>ALSA Project  http://www.alsa-project.org
>>SuSE Linux    http://www.suse.com




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to