PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.52k stars 308 forks source link

ALSA printing undesirable warnings to console (AlsaErrorHandler needs work?) #163

Open PortAudio-admin opened 13 years ago

PortAudio-admin commented 13 years ago

Issue created by @RossBencina

[Trac: Originally assigned to none]

Ralph Irving submits:

Since the snd_lib_error_set_handler(AlsaErrorHandler) call was commented out in r1543 of trunk/src/hostapi/alsa/pa_linux_alsa.c The ALSA implementation now prints all ALSA lib messages to stderr, which is the default if an error handler is not defined.

Before this change all error messages from the library were hidden, now there is a flurry of messages when enumerating devices which don't exist. The FindDeviceName function does this with the predefinedNames structure at line 991 in r1605 of src/hostapi/alsa/pa_linux_alsa.c

Here is an example of the messages now displayed since this change if the current sound device doesn't support the "feature" listed in the predefined names.

ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

Device enumeration is just one example of these ALSA lib messages output but all messages from ALSA are displayed on the console now.

Perhaps the original thought that the error handler wasn't providing any useful benefit was incorrect as mentioned in this comment in the r1543 diff;

+/** Uncommented because AlsaErrorHandler is unused for anything good yet.

I get regular inquires from users of squeezeslave worried that something is broken since this change, when in fact the messages can be ignored.

I think that perhaps the AlsaErrorHandler needs to be reinstalled with the additional changes described in the commit to avoid the seg fault of course, as this helps hide the ALSA layer from PA.

PortAudio-admin commented 13 years ago

Comment by @RossBencina

My 2cents: It seems to me that PA shouldn't really block all ALSA messages or we run the risk of missing real problems.

Perhaps we could just install the error handler while probing for unknown devices? or print everything ourselves from the error handler and then suppress errors like this that we know we're causing ourselves.

PortAudio-admin commented 12 years ago

Comment by @RossBencina

TRAC migration: propagating ticket status from TRAC

thebluetropics commented 5 days ago

hey this issue still exists, it still prints undesirable warnings to the console somehow

rkapuaala commented 4 days ago

These warning messages would be useful if the audio system were not working, but my audio system is working and every time I use the mic a stream of warnings is printed to stdrout about the sound cards not being found and being unable to open a slave.... yet the mic works, the sound works. So, if it works, what value are the warning messages?