Android:pcm_open失败,无法打开设备'/dev/snd/pcmC0D1p' [英] Android: pcm_open failed cannot open device '/dev/snd/pcmC0D1p'
问题描述
一个自定义的硬件正在运行Android,并且安装了音频驱动程序.
A custom piece of hardware is running Android with the audio drivers installed.
创建了一个简单的Android应用程序,可以使用媒体播放器播放一些音频,并且该应用程序已在模拟器上进行了测试,因此可以正常运行.
An simple Android app is created to play some audio using media player, the app is tested on a emulator so it works for sure.
在硬件上运行设备时,logcat的错误消息会多次显示以下内容:
When running the device on the hardware, error message from logcat displays the following many times:
01-01 01:09:16.355 2792-3186/? E/audio_hw_primary﹕ pcm_open(PCM_CARD) failed: cannot open device '/dev/snd/pcmC0D1p': No such file or directory
01-01 01:09:16.375 2792-3186/? E/audio_hw_primary﹕ pcm_open(PCM_CARD) failed: cannot open device '/dev/snd/pcmC0D1p': No such file or directory
01-01 01:09:16.435 2792-375/? E/AudioSink﹕ received unknown event type: 1 inside CallbackWrapper !
在/dev/snd/下有
under /dev/snd/ there are
controlC0
pcmC0D0c
pcmC0D0p
timer
我可以播放系统通知,没有任何问题.我还可以通过创建指向pcmC0D0p的符号链接pcmC0D1p来解决该问题,并且它可以正常工作.为什么Android会尝试在pcmC0D1p上播放非系统音轨?谁在控制它输出到哪个输出?
I am able to play system notifications without any problem. I could also hack the problem by creating a symbolic link pcmC0D1p pointing to pcmC0D0p, and it works. Why is android trying to play non-system sound track on pcmC0D1p? Who is controlling which output it goes to?
推荐答案
pcmC0D1p
表示:
pcm
Card 0
Device 1
Capture/Playback p
很明显,从您的ls /dev/snd/
看,您的应用程序正在访问的节点都不存在.
Clearly, whatever the node your app is accessing is not present as seen through your ls /dev/snd/
.
通常,如果您正在播放mp3文件之类的非标准声音,请写入 AudioTrack ,将处理所有内容.
Normally, if you are playing non-standard sounds like mp3 files, writing to AudioTrack, will handle everything.
如果您通过执行ls /dev/snd
仅看到一个播放节点,则意味着您只存在一个播放节点,我认为(虽然不确定)是标准android声音所占据.
If you see only one playback node by doing ls /dev/snd
, it means you have only one playback node present, which I think (not sure though) is occupied for standard android sounds.
这篇关于Android:pcm_open失败,无法打开设备'/dev/snd/pcmC0D1p'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!