How can I solve a conflict between openFrameworks and other audio applications?

旧城冷巷雨未停 提交于 2019-12-21 06:17:19

问题


When I try executing the audioOutputExample shipped with openFrameworks, I get

RtApiAlsa::getDeviceIno: snd_pcm_open error for device (hw:0,0), Device or resource busy.

RtApiAlsa::probeDeviceOpen: pcm device (hw:0,0) won't open for output.

RtApi:: a stream is not open!

Process returned 0 (0x0) execution time : 3.462 s Press ENTER to continue.

when

  • Rhythmbox is playing
  • Rhythmbox has played recently (under ~5 seconds ago)
  • Firefox has a tab with Grooveshark, either playing a tune or on pause
  • The Groovshark tab has been recently closed (under ~5 seconds ago)
  • Firefox has a tab with a Youtube Video, either playing or on pause
  • The Youtube tab has been recently closed (under ~5 seconds ago)

Otherwise, the example works fine, even if I've used Rhythmbox, Grooveshark or Youtube before.

How can I solve this conflict to allow simultaneous use of audioOutputExample and, say, Rythmbox.

P.S. I am on Ubuntu 11.04, using openFrameworks_v0062_linux64_FAt...


回答1:


I found a solution. The problem was, that I have two internal sound devices registered - HDMI and PCH. The HDMI device was always assigned to be card0, which can be checked by typing

aplay -l 

into the terminal. This will list the different devices.

I then changed my alsa configuration using

gksudo gedit /etc/modprobe.d/alsa-base.conf

and adding at the end

options snd-hda-intel index=-2

thereby forcing the HDMI to be assigned to card1 and the other device to card0. Another option there is to put

options snd-hda-intel id=PCH,HDMI index=0,1

assigning the card index. However, I read here HDMI,PCH that this did not work for everybody.

Note the details of this method depend on the devices that you have in your computer. Find those known to alsa by typing aplay -l.




回答2:


this is just a guess since I'm not up on OF on Linux, but I think OF needs access to the low-level ALSA device in order to get the RT functionality. As such, it can't share the device with PulseAudio (or whatever they're using these days) which allows the audio device to be shared between apps. You could try looking at JACK to multiplex between PulseAudio and your ALSA program.



来源:https://stackoverflow.com/questions/6400950/how-can-i-solve-a-conflict-between-openframeworks-and-other-audio-applications

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