You are not logged in.

#1 2016-05-25 22:13:43

wma
Member
Registered: 2015-09-07
Posts: 10

ALSA switch audio device but keep dmix

I recently created a .asoundrc file in my home dir with the following lines in it:

pcm.!default {
   type plug
   slave.pcm {
      @func getenv
      vars [ ALSAPCM ]
      default "plughw:0,0"
   }
}

I've found these lines in the Arch Wiki. This configuration allows me to switch the output device by setting the ALSAPCM env variable at run time.

The side-effect is that it makes the audio device exclusive to the program that is using it. For example, I can't have mpd playing music and Firefox playing a sound at the same time.

I've done some reading and I've learned that to do that I need to use "dmix". However, I can't figure out how to include "dmix" in my config. Anything I've tried either breaks audio or has no effect.

Does anyone have any ideas?

Offline

#2 2016-05-26 22:16:40

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,922

Re: ALSA switch audio device but keep dmix

scroll a bit further down on that same wiki page until you get to the dmix section.
Try the lines shown there to enable dmix manually.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2016-05-27 05:42:37

wma
Member
Registered: 2015-09-07
Posts: 10

Re: ALSA switch audio device but keep dmix

Yes, I've tried those configurations. Anything I've tried either breaks audio or has no effect.

Offline

#4 2016-05-27 07:25:14

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: ALSA switch audio device but keep dmix

I would recommend you search through my previous ALSA threads, for ALSA debugging tips. E.g.:

# http://forums.gentoo.org/viewtopic-p-6688455.html#6688455
fuser -fv /dev/snd/*

Run an audio app from the command-line, to see any error messages.

You have to close the audio device and reopen it, for ALSA config file changes to take effect. This happens automatically, when you close the audio players, and you can check with the "fuser" line above.

Offline

Board footer

Powered by FluxBB