最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Match Mixer.Info of USB sound card to physical USB port it's connected to - Stack Overflow

programmeradmin1浏览0评论

I will potentially have several USB sound cards connected to a single Raspberry PI and I want to play be able to play sound on speciffic sound card identified by physical USB port it's connected to

I can find USB sound cards using shell script

find /sys/devices/ -name id | grep sound | grep usb

Which results in something like that (currently only one is connected)

/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.0/soundCard1/id

The 1-1.5.2 part describes the physical USB port it's connected to.

In Java when I fetch Mixer.Info using AudioSystem.getMixerInfo() none of the properties of that sound card get me the info about USB port or specific device in /sys/devices/:

info.getName();    // "Device [plughw:1,0]"
info.getDescription()    // Direct Audio Device: USB Audio Device, USB Audio, USB Audio
info.toString()    // Device [plughw:1,0], version 5.10.103-v7+

Is there a way to match Mixer.Info to a speciffic device found in /sys/devices/ ? Or any other way to identify device by USB port it's connected to?

发布评论

评论列表(0)

  1. 暂无评论