You are not logged in.

#1 2014-10-30 05:03:08

gdea73
Member
Registered: 2012-07-16
Posts: 34

[solved] Alsa: dmix not working

I believe my ALSA configuration isn't able to use dmix: despite it being enabled (by default), I cannot play audio on my default (Intel HDA) soundcard from more than one application at a time. Audio works in WINE applications, VLC, mplayer, and Firefox individually, but no combination thereof would work. Whichever application was opened first clearly opened (and thereby locked) the PCM device, and the other application would complain about the device being busy.

~/.asoundrc:

pcm.!default {
        type hw
        card 1
}
ctl.!default {
        type hw
        card 1
}

hardware:

ThinkPad T440p (i5)
Intel HDA & HDMI outputs

Any recommendations would be appreciated.

Last edited by gdea73 (2014-11-04 17:31:02)

Offline

#2 2014-10-30 08:56:07

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

Re: [solved] Alsa: dmix not working

Your config disables dmix, so why do you expect dmix to work?

How many speakers do you have? Because the default dmix config only works properly with *2* speakers.

See config in my sig, for a proper dmix setup.

Offline

#3 2014-10-30 18:23:35

gdea73
Member
Registered: 2012-07-16
Posts: 34

Re: [solved] Alsa: dmix not working

Ah, my bad. You see, I had no sound before writing that .asoundrc and the file allowed my speakers to work so I kept it. I thought dmix was a function of alsa that would be enabled elsewhere. I shall investigate and get back to you.

I have both analog and HDMI outputs, but desire primarily to use the analog. I could care less about the HDMI for now.

Offline

#4 2014-11-03 04:43:51

gdea73
Member
Registered: 2012-07-16
Posts: 34

Re: [solved] Alsa: dmix not working

I used the dmix part of your alsa configuration, but I still cannot use multiple applications with the same speaker.

~/.asoundrc
pcm.dmixed {
	type asym
	playback.pcm {
		# See plugin:dmix at http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
		type dmix

		# Don't block other users, e.g. the Timidity midi-player daemon
		# http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
		ipc_key_add_uid true

		ipc_key 5678293
		ipc_perm 0660
		ipc_gid audio

		# Don't put the rate here! Otherwise it resets the rate & channels set below, as shown by:  cat /proc/asound/card0/pcm0p/sub0/hw_params
		slave {
			# 2 for stereo, 6 for surround51, 8 for surround71
			channels 6
			pcm {
				# mplayer chooses S32_LE, but others usually S16_LE
				#format S32_LE
				format S16_LE

				# 44100 or 48000
				# 44100 for music, 48000 is compatible with most h/w
				#rate 44100
				rate 48000

				# http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
				# Maybe helps
				nonblock true

				type hw
				card 0
				device 0
				subdevice 0
			}

			# mplayer2 chooses 1024
			# period_size 512 with buffer_size 16384 stops crackling in xmame
			# 320 breaks flash - https://bbs.archlinux.org/viewtopic.php?id=129458
			#period_size 512
			period_size 1024
			#period_size 512

			# 4096 might make sound crackle
			# mplayer2 chooses 8192. Half-Life 2 chooses 16384.
			# If too large, use CONFIG_SND_HDA_PREALLOC_SIZE=2048
			buffer_size 16384
		}
	}
	# apulse (a cut-down replacement for pulseaudio) needs dsnoop
	# https://bbs.archlinux.org/viewtopic.php?id=187258
	capture.pcm "dsnoop"
}pcm.dmixed {
	type asym
	playback.pcm {
		# See plugin:dmix at http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
		type dmix

		# Don't block other users, e.g. the Timidity midi-player daemon
		# http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
		ipc_key_add_uid true

		ipc_key 5678293
		ipc_perm 0660
		ipc_gid audio

		# Don't put the rate here! Otherwise it resets the rate & channels set below, as shown by:  cat /proc/asound/card0/pcm0p/sub0/hw_params
		slave {
			# 2 for stereo, 6 for surround51, 8 for surround71
			channels 6
			pcm {
				# mplayer chooses S32_LE, but others usually S16_LE
				#format S32_LE
				format S16_LE

				# 44100 or 48000
				# 44100 for music, 48000 is compatible with most h/w
				#rate 44100
				rate 48000

				# http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
				# Maybe helps
				nonblock true

				type hw
				card 0
				device 0
				subdevice 0
			}

			# mplayer2 chooses 1024
			# period_size 512 with buffer_size 16384 stops crackling in xmame
			# 320 breaks flash - https://bbs.archlinux.org/viewtopic.php?id=129458
			#period_size 512
			period_size 1024
			#period_size 512

			# 4096 might make sound crackle
			# mplayer2 chooses 8192. Half-Life 2 chooses 16384.
			# If too large, use CONFIG_SND_HDA_PREALLOC_SIZE=2048
			buffer_size 16384
		}
	}
	# apulse (a cut-down replacement for pulseaudio) needs dsnoop
	# https://bbs.archlinux.org/viewtopic.php?id=187258
	capture.pcm "dsnoop"
}
pcm.!default {
	type hw
	card 1
}
ctl.!default {
        type hw
        card 1
}

Should I have removed the pcm.default lines?

Offline

#5 2014-11-03 23:20:07

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

Re: [solved] Alsa: dmix not working

Use the pcm.!default that's in my file. Without it, how do you expect "dmixed" to get *used*?

Also, you copied the "dmixed" code block *twice*.

Offline

#6 2014-11-04 17:30:33

gdea73
Member
Registered: 2012-07-16
Posts: 34

Re: [solved] Alsa: dmix not working

That was a careless error, my gosh.

I must have hit the center mouse button of my track pad twice when pasting it into my post.

I admit I'm totally clueless when it comes to ALSA configuration. Despite having used Arch for two years I have never mastered the mess that is the Linux soundscape.

Anyway, adding your default PCM key appears to have worked! Thanks for helping me see some blatant errors I really should've caught on my own

Offline

Board footer

Powered by FluxBB