Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/147.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何禁用或重新路由ALSA lib日志记录 我有一个C++应用程序,使用ListBax,并且扩展,Alsa._C++_Logging_Alsa_Portaudio - Fatal编程技术网

如何禁用或重新路由ALSA lib日志记录 我有一个C++应用程序,使用ListBax,并且扩展,Alsa.

如何禁用或重新路由ALSA lib日志记录 我有一个C++应用程序,使用ListBax,并且扩展,Alsa.,c++,logging,alsa,portaudio,C++,Logging,Alsa,Portaudio,此应用程序第一次生成音频时,将在stderr上生成以下输出: ALSA lib pcm.c:2239:(snd_pcm_open_noupdate)未知pcm卡。pcm.rear ALSA lib pcm.c:2239:(snd_pcm_open_noupdate)未知pcm卡.pcm.center_lfe ALSA lib pcm.c:2239:(snd_pcm_open_noupdate)未知pcm卡.pcm.side ALSA lib pcm_dmix.c:961:(snd_pcm_dmi

此应用程序第一次生成音频时,将在stderr上生成以下输出:

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate)未知pcm卡。pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate)未知pcm卡.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate)未知pcm卡.pcm.side
ALSA lib pcm_dmix.c:961:(snd_pcm_dmix_open)dmix插件只支持播放流
无法连接到服务器套接字err=没有此类文件或目录
无法连接到服务器请求通道
jack服务器未运行或无法启动

我有自己的日志记录,希望禁用这些错误,或者通过自己的日志记录框架重新路由它们,以进行额外的处理和报告。

可以使用freopen重定向stderr的输出。()在我的情况下,这些错误是在
Pa_Initialize()时生成的,所以我在调用stderr之前将其重定向到/dev/null,之后又将其重定向回

freopen("/dev/null","w",stderr);
PaError err= Pa_Initialize();
freopen("/dev/tty","w",stderr);

您可能需要查看
snd_lib_error_set_handler
函数来注册任意错误处理回调


这些信息中只有一部分来自ALSA。这是一个很好的方法。谢谢,我来试一试。从几年前(关于CL链接的bug)的评论来看,这似乎不是PortAudio的优先考虑事项。在freopen的性能不会成为问题的情况下,这样的解决方案可能是最好的。