How to register a virtual card to alsa from user-space?

ⅰ亾dé卋堺 提交于 2019-12-07 22:17:29

问题


I'm developing a virtual device from the user space

(using umview http://wiki.virtualsquare.org/wiki/index.php/UMview) so, i need to register my device to the system's sound cards list

(I've never used alsa in a kernel module so I think that I need to call the snd_card_register() function)

but I can't find a way to do that from the userspace...

maybe I can write a syscall to do that?


回答1:


I think you should stop bothering about overriding any particular file (i.e. stop using umview, it's not needed) and simply use the "file" plugin to create device in the ALSA config that will pipe the data to your virtual device over a named pipe in /var/run/virtualsound/output or somewhere like that.

Unlike the umview approach, this will work in all applications without having to run them in any special way.




回答2:


I've solved this problem some times ago,

Alsa user-space lib simply open every /dev/snd/controlC# from 0 to 32 and launch

ioclt(SNDRV_CTL_IOCTL_CARD_INFO,...);

in order to build a list with the installed sound-cards

so, if we mount our UmView module on /dev/snd/control# and we hijack the ioctl and answer to it, our module will be identified as a sound-card by ALSA

I've created a virtual sound device with that technique, you can find it at https://github.com/berdav/umdevaudio

this is a simple way to build a simple user-space driver.



来源:https://stackoverflow.com/questions/15134751/how-to-register-a-virtual-card-to-alsa-from-user-space

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!