how to configure flash 9 in firefox to use a specific alsa device
My machine has a built in sound card and I also use USB headphones.
The machine is set to use ALSA. I figured how to configure amarok, xine such that when the headphones are plugged in the audio plays through the headphones, and when they are not plugged in it plays through the speakers However, I can not make firefox + flash 9 play through the headphones - the sound always go to the speakers. Using audacity I noticed that when I plug the headphones it lists new ALSA device, and also /dev/dsp1 . And indeed by selecting /dev/dsp or /dev/dsp1 I can tell audacity to play either through the speakers or the headphones. When I unplug the headphones, the additional alsa device and /dev/dsp1 disappear. I found a post that said use aoss (separate package from synaptic) and specify /dev/dsp1. That did not work and after more reading I learned that flash 9 in firefox uses ALSA (where the old flash 7 used OSS so the aoss solution might had worked for it) So my question is how do I tell flash 9 in firefox to use a specific alsa device. An alternative would be to swap the order of the ALSA devices so flash 9 finds the headphones first. Ideally, that would work in such a way that when the headphones are plugged they are the first device, and when not plugged the speakers are. Or it could use a script that you run to select which device is first (i.e. the default) |
Probably not a good solution, but on my Fedora 7 laptop, if you boot with the USB sound plugged in, it sets up the USB sound as the primary alsa device, while the built in sound is ignored. Thus fash 9 goes to the USB.
|
A solution is create a file .asoundrc in you home directory that specify the default audio device.
Since in my case I want to change the default device to be the USB headphones when they are plugged in and to the builtin speakers when the USB headphones are not plugged in, I created two different .asoundrc files and I swap them as necessary. You'd need to close programs that hold to the sound device when swapping (e.g. amarok) 1. Plug in your USB audio device and find out the names of the builtin audio, and the USB audio by running in a terminal (kconsole) Quote:
card 0: IHC6 card 1: Headset 2. Create two asoundrc files, one for each configuration and place them in you home directory (notice only the last two lines are different) .asoundrc.builtin Quote:
Quote:
switch-audio Quote:
Quote:
There should also be a way to run the script automatically when the headphones are plugged or unplugged, but I did not bother with that. |
Quote:
Thanks. |
There's also a defaults.pcm.card 0 option for .asoundrc
... defaults.pcm.card 0 ... Where the number represents the card / device as it appears in /proc/asound/cards. The scripted solution might work a little faster than manually editing .asoundrc each time. Another method since many web browsers default to card 0 is to re-index your alsamodules. One of the only ways to get things like Festival to use a specific card. #/etc/modprobe.d/alsa_custom options snd-usb-audio index=0 Or something more like this in full. #/etc/modprobe.d/alsa_custom START alias char-major-116 snd alias char-major-14 soundcore options snd major=116 cards_limit=3 options snd-usb-audio index=0 options snd-atiixp index=1 options snd-atiixp-modem index=2 alias snd-card-0 snd-usb-audio alias sound-slot-0 snd-card-0 alias sound-service-0-0 snd-mixer-oss alias sound-service-0-1 snd-seq-oss alias sound-service-0-3 snd-pcm-oss alias sound-service-0-8 snd-seq-oss alias sound-service-0-12 snd-pcm-oss alias snd-card-1 snd-atiixp alias sound-slot-1 snd-card-1 alias sound-service-1-0 snd-mixer-oss alias sound-service-1-1 snd-seq-oss alias sound-service-1-3 snd-pcm-oss alias sound-service-1-8 snd-seq-oss alias sound-service-1-12 snd-pcm-oss alias snd-card-2 snd-atiixp-modem alias sound-slot-2 snd-card-2 alias sound-service-2-0 snd-mixer-oss alias sound-service-2-1 snd-seq-oss alias sound-service-2-3 snd-pcm-oss alias sound-service-2-8 snd-seq-oss alias sound-service-2-12 snd-pcm-oss #/etc/modprobe.d/alsa_custom END In conjunction with rebooting, and/or just using /etc/init.d/alsasound stop|start (in debian), it gets the job done. For those troublesome OSS only applications. Like web browsers. Another option might be to start the app with aoss. Or artsdsp -m or esddsp -m as applicable. |
asoundrc worked
pcm.usb {type hw; card Headset;}
ctl.usb {type hw; card Headset;} pcm.!default pcm.usb ctl.!default ctl.usb gods, i was searching forever for this... |
All times are GMT -5. The time now is 02:55 PM. |