No sound with older games (Age of Wonders, Divine Divinity)

Questions about Wine on Linux
Locked
didli
Level 2
Level 2
Posts: 15
Joined: Tue Mar 04, 2008 7:33 am

No sound with older games (Age of Wonders, Divine Divinity)

Post by didli »

Hi u all !
I'm running wine-1.7.18 in Fedora 20, and I'm trying to get sound working with Divine Divinity. I can get music & sound from Baldur's Gate EE 1 & 2, or from Black & White 2, but not a sound from Divine Divinity or Age of Wonders Shadow Magic. I've tried a new wineprefix, and got some sounds (crappy, slow as hell) when switching to winealsa.drv (with winetricks), but then the others games sounds stopped working ...
Any idea what I should try to stick to pulseaudio and get Divine Divinity sound working ?
Thanks in advance !
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: No sound with older games (Age of Wonders, Divine Divini

Post by dimesio »

If by "stick to pulseaudio" you mean the winepulse driver, that's not supported here. The winealsa driver should work with PulseAudio. One thing you could do is test the patch that was recently posted in http://bugs.winehq.org/show_bug.cgi?id=10495#c411 and report whether or not it fixes your sound issues when using winealsa.
didli
Level 2
Level 2
Posts: 15
Joined: Tue Mar 04, 2008 7:33 am

Re: No sound with older games (Age of Wonders, Divine Divini

Post by didli »

dimesio wrote:(...) One thing you could do is test the patch that was recently posted in http://bugs.winehq.org/show_bug.cgi?id=10495#c411 (...)
Thanks for your answer and advice. I do not intend to compile wine so I will give up on that. I thought there was something simpler to try since I can get sounds with a default wine setup (in Fedora 20, winepulse seems default) even if unfortunately it is choppy as hell.
didli
Level 2
Level 2
Posts: 15
Joined: Tue Mar 04, 2008 7:33 am

[Solved] No sound with older games (Age of Wonders, ...)

Post by didli »

Solved it ! ... and I have no idea how it works, but here's what I've done if you run into this problem (i have no idea "why" and "how" it works, this is higly experimental!! Be careful with this setup !) :
I had no .asoundrc file in my home and found one from a famous wiki. Since I don't know anymore where the wiki is, a copy/paste from the file :

Code: Select all

# Posted at http://dl.dropbox.com/u/18371907/asoundrc
# Info:  http://www.sabi.co.uk/Notes/linuxSoundALSA.html
# Soundcard roundup:  http://forums.gentoo.org/viewtopic-p-4192284.html#4192284

# Show programs currently opening ALSA:
# fuser -fv /dev/snd/* /dev/dsp*

# Show opened settings:
# cat /proc/asound/card0/pcm0p/sub0/hw_params

# Show codec:
# cat /proc/asound/card0/codec#0 | grep Codec
# Codec: Realtek ALC889

# Ignore alsaconf:  http://wiki.debian.org/alsaconf

# Maybe OSS can be compatible with dmix (aoss, alsa-oss):
# https://bbs.archlinux.org/viewtopic.php?pid=981179#p981179
# http://alsa.opensrc.org/Dmix
# http://forums.gentoo.org/viewtopic-t-856668.html
# http://www.knoppix.net/forum/threads/25372-HowTo-ALSA-Dmix-OSS

# dmix - plug:dmix supports 1-8 channels, and does use dmix!
# Whereas surround51 doesn't use dmix
# http://bbs.archlinux.org/viewtopic.php?pid=745946#p745946


# cat /proc/asound/card0/pcm0p/sub0/hw_params

# From https://bugs.launchpad.net/debian/+source/sdl-mixer1.2/+bug/66483
# Not needed.
#defaults.pcm.dmix_max_periods -1


#defaults.pcm.rate_converter "samplerate_best"

# See /usr/share/alsa/pcm/dmix.conf
#defaults.dmix.period_time 0
#defaults.dmix.periods 4
#defaults.pcm.surround51.device "0"

# softvol: https://bbs.archlinux.org/viewtopic.php?id=126789

# Duplicate output to 2 audio devices:
# http://forums.gentoo.org/viewtopic-t-902670.html

# Equalizer:  http://krustev.net/w/articles/Global_equalizer_for_ALSA/


# From https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1853
# Posted at http://bbs.archlinux.org/viewtopic.php?id=95582
# Is a dmix that actually works!
# To prove it, run these commands simultaneously, starting with the first one:
#     speaker-test -c 2 -D default
#     speaker-test -c 6 -D surround51 -t wav
# Reasons why needed:
# https://bbs.archlinux.org/viewtopic.php?pid=1252966#p1252966
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
		}
	}
	capture.pcm "hw:0"
}



# Playing
#pcm.!default {
#	type asym
#	playback.pcm "upmix_20to51_resample"
#}


# Simple upmixing, from http://forums.bodhilinux.com/index.php?/topic/2493-how-to-51-surround-sound-with-alsa/
#pcm.!default {
#	type plug
#	slave.pcm "surround51"
#	slave.channels 6
#	route_policy duplicate
#}


# Flash, etc. use this "default" entry.
pcm.!default {
       	type plug
# Would need to always output to all 6 channels, so the dmixer actually works if e.g. 6-channel is attempted to be started, while 2-channel is playing.
	slave.pcm "dmixed"
}

pcm.!surround20 {
	type plug
	slave.pcm "dmixed"
}

pcm.!surround40 {
	type plug
	slave.pcm "dmixed"
}

pcm.!surround51 {
	type plug
	slave.pcm "dmixed"
}


pcm.wine {
	type plug
	# Output directly, for performance
	#slave.pcm "hw:0"
	slave.pcm "surround20"
}


# If get error "Slave PCM not usable", then need to use plug:
# If get error "Cannot find rate converter", then install libsamplerate and alsa-plugins

# Lunar Linux:  lin ladspa-bs2b
# listplugins
# analyseplugin bs2b
pcm.bs2b {
	type ladspa
	path "/usr/lib/ladspa"
	plugins {
		0 {
			id 4221  # Bauer stereophonic-to-binaural (4221/bs2b)
			input {
				controls [ 700 6 ]
			}
		}
	}
	# http://bbs.archlinux.org/viewtopic.php?id=95582
	slave.pcm "surround20"
}


# http://quitte.de/dsp/caps.html#Narrower  from caps-plugins
# Alternative to bs2b, for music via headphones
# analyseplugin caps | grep -A14 Narrow
pcm.narrower {
	type ladspa
	path "/usr/lib/ladspa"
	plugins {
		0 {
			id 2595  # Narrower - Stereo image width reduction
			input {
				controls [ 0 0.25 ]
			}
		}
	}
	slave.pcm "surround20"
}


# speaker-test -D headphones -c 2 -t wav
# audacious uses less CPU when running bs2b as a listed plugin, probably because of samplerate_best
# Posted at http://bbs.archlinux.org/viewtopic.php?pid=626573#p626573
pcm.headphones {
	type rate
	slave {
		pcm "plug:bs2b"
		#pcm "plug:narrower"
		#rate 44100
		rate 48000
	}
	# Choices: samplerate_best samplerate_medium samplerate samplerate_order samplerate_linear
	converter "samplerate_medium"

    hint {
        show on
        description "Headphones"
    }
}


# https://wiki.archlinux.org/index.php/Skype
pcm.skype {
	type plug
	slave.pcm "surround20"
	#slave.pcm "hw:0"

    hint {
        show on
        description "Skype"
    }
}


# speaker-test -D ch51dup -c 2 -t wav
pcm.ch51dup {
	slave.pcm "surround51"
	slave.channels 6
	type plug

	# Front and rear
	ttable.0.0 0.5
	ttable.1.1 0.5
	ttable.2.2 0.5
	ttable.3.3 0.5

	# Center and LFE
	ttable.4.4 1
	ttable.5.5 1

	# Front left/right to center
	ttable.0.4 0.5
	ttable.1.4 0.5

	# Front left/right to rear
	ttable.0.2 0.5
	ttable.1.3 0.5
}



# From http://marcansoft.com/blog/2009/06/acer-aspire-8930g-linux-audio-support/
# To bring all the 8930g speakers into play.
# Works in mplayer but not audacious - weird!
# Have increased the volume, because mplayer is so quiet.
# speaker-test -D stereo8930 -c 2 -t wav
pcm.stereo8930 {
	type plug
	slave.pcm "surround51"
	slave.channels 6

    hint {
        show on
        description "Stereo speakers 8930g"
    }
	ttable.0.0 1.5
	ttable.1.1 1.5
	ttable.0.2 1.5
	ttable.1.3 1.5
	ttable.0.4 0.3
	ttable.1.4 0.3
	ttable.0.5 1.0
	ttable.1.5 1.0
}



# http://alsa.opensrc.org/SurroundSound
# http://alsa.opensrc.org/Low-pass_filter_for_subwoofer_channel_%28HOWTO%29
# Lunar:  lin ladspa tap-plugins swh-plugins cmt-plugins libsamplerate
# Fedora:  yum install ladspa ladspa-blop-plugins ladspa-caps-plugins ladspa-cmt-plugins ladspa-swh-plugins ladspa-tap-plugins libsamplerate
# Arch Linux:  pacman -S ladspa blop swh-plugins libsamplerate tap-plugins cmt
# For id 1672 - 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa), install blop-plugins
# listplugins
# analyseplugin cmt
# http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html
# http://forums.gentoo.org/viewtopic-p-4528619.html#4528619
# speaker-test -D upmix_20to51 -c 2 -t wav
# This is one big & nasty PCM, to stop Skype from querying the individual PCM definitions and then crashing with: Assertion `!snd_interval_empty(i)' failed
pcm.upmix_20to51 {
	# From http://alsa.opensrc.org/Low-pass_filter_for_subwoofer_channel_%28HOWTO%29
	# Set up a third channel for the subwoofer
	type plug
	slave.channels 3
	ttable {
		0.0     1       # left channel
		1.1     1       # right channel
		0.2     0.5     # mix left and right ...
		1.2     0.5     # ... channel for subwoofer
	}

	slave.pcm {
		# Apply subwoofer filter
		type ladspa

		# Set the path to ladspa, to fix this error:
		# Playback open error: -2,No such file or directory
		path "/usr/lib/ladspa"
		channels 3
		plugins {
			0 {
				id 1098  # Identity (Audio) (1098/identity_audio)
				policy duplicate
				input.bindings.0 "Input"
				output.bindings.0 "Output"
			}

			# From http://alsa.opensrc.org/Low-pass_filter_for_subwoofer_channel_%28HOWTO%29
			1 {
				id 1672 # 4 Pole Low-Pass Filter with Resonance (FCRCIA) (1672/lp4pole_fcrcia_oa)
				policy none
				input.bindings.2 "Input"
				output.bindings.2 "Output"
				input {
					controls [ 300 2 ]
				}
			}
		}

		slave.pcm {
			# Final mixing of 6-channel output
			type plug
			slave.channels 6
			ttable {
				0.0     1       # front left
				1.1     1       # front right
				0.2     1       # rear left
				1.3     1       # rear right

				# Front left/right to center
				0.4     0.5
				1.4     0.5

				# Subwoofer, more powerful to compensate for bass-removal from other speakers
				2.5     2
			}
			# This next line needs to be "dmixed" rather than e.g. "surround51" - bizarre
			slave.pcm "dmixed"
		}
	}
}



# Channels are wrong way around in Doom3! This fixes them.
# http://www.linuxforen.de/forums/archive/index.php/t-206470.html
# http://forums.seriouszone.com/showthread.php?t=49869&page=10
# http://forums.gentoo.org/viewtopic-p-4173170.html#4173170
# For Audigy 4
# Weird, Doom3 has crappy sound if I add an alsa rate converter.
# Posted at http://ubuntuforums.org/showthread.php?t=1304228
pcm.doom-surround51 {
	slave.pcm "dmixed"
	slave.channels 6
	type route
	ttable.0.0 1
	ttable.1.1 1
	ttable.2.4 1
	ttable.3.5 1
	ttable.4.2 1
	ttable.5.3 1
}


# Pulseaudio workaround: http://ubuntuforums.org/showthread.php?t=1705760
pcm.doom3-8930g {
	type plug
	slave.pcm {
		type dmix
		ipc_key 1093  # Must be unique
		ipc_key_add_uid false
		ipc_perm 0660
		slave {
			pcm "hw:0,0"
			rate 44100
			channels 2
			#period_time 0
			# period_size was 1024 - maybe 512 is better to stop clicks - not sure
			period_size 1092
			#buffer_time 0
			# Doom 3 wants buffer_size 8192
			# In ~/.doom3/base/autoexec.cfg
			# And ~/.quake4/q4base/autoexec.cfg
			# seta s_alsa_pcm "doom3-8930g"
			buffer_size 8192
		}
	}
}

# From https://bbs.archlinux.org/viewtopic.php?id=99185
# And in ~/.mplayer/config:  ao=alsa:device=movie
# Alternative, in ~/.mplayer/config:  af-add=volnorm=2:0.75
# speaker-test -D movie -c 2 -t wav
pcm.movie {
	type plug
	slave.pcm "ladcomp_compressor"
	slave.channels 6
    hint {
        show on
        description "Movie Volume"
    }
}

pcm.ladcomp_compressor {
	type ladspa
	slave.pcm "ladcomp_limiter"
	path "/usr/lib/ladspa"
	plugins [
		{
			label dysonCompress
			input {
				# peak limit, release time, fast ratio, ratio
				controls [0 1 0.5 0.99]
			}
		}
	]
}

pcm.ladcomp_limiter {
	type ladspa
	slave.pcm "plug:movie8930"
	path "/usr/lib/ladspa"
	plugins [
		{
			label fastLookaheadLimiter
			input {
				# InputGain(Db) -20 -> +20 ; Limit (db) -20 -> 0 ; Release time (s) 0.01 -> 2
				# also possible... 20 0 0.8
				# If movie is too quiet, increase the first number.
				controls [ 5 0 0.8  ]
			}
		}
	]
}

pcm.movie8930 {
	type route
	slave.pcm "dmixed"

	ttable.0.0 1.0
	ttable.1.1 1.0
	ttable.2.2 1.0
	ttable.3.3 1.0
	ttable.4.4 1.0
	ttable.0.5 0.6
	ttable.1.5 0.6
	ttable.4.5 0.6
	ttable.5.5 0.8
}


pcm.downmix_51to20 {
	# From http://www.halfgaar.net/surround-sound-in-linux
	# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503839
	type route
	slave.pcm "surround20"

	# Front and rear, at 33% of original signal strength
	ttable.0.0 0.33
	ttable.1.1 0.33
	ttable.2.0 0.33
	ttable.3.1 0.33

	# Center channel routing (routed to front-left and front-right),
	# 6dB gaindrop (gain half of main channels) per channel
	ttable.4.0 0.16
	ttable.4.1 0.16

	# LFE channel routing (routed to front-left and front-right),
	# 6dB gaindrop (gain half of main channels) per channel
	ttable.5.0 0.16
	ttable.5.1 0.16
}
With this, I have the sound working for every game, including the ones I mention. But then I run into another problem : Now, I had no sound for flash videos (youtube and the like). I found another (old) wiki suggesting to edit again my .asoundrc file. Search for the line "Flash, etc. use this default entry" and copy/paste this :

Code: Select all

# Flash, etc. use this "default" entry.
#pcm.!default {
#        	type plug
# Would need to always output to all 6 channels, so the dmixer actually works if e.g. 6-channel is attempted to be started, while 2-channel is playing.
#	slave.pcm "dmixed"
#}

pcm.pulse {
    type pulse
}
ctl.pulse {
    type pulse
}
pcm.!default {
    type pulse
}
ctl.!default {
    type pulse
}
For now, I didn't run into another problems but again, as i have no idea "why" and "how" it works, this is higly experimental!! Be careful with this setup ! (well, you can still backup/delete the file and kill pulseaudio to get your default setup running if you didn't have the file previously).
didli
Level 2
Level 2
Posts: 15
Joined: Tue Mar 04, 2008 7:33 am

Re: No sound with older games (Age of Wonders, Divine Divini

Post by didli »

huh ... Stupid question now : How can I edit my topic as solved ?!
Locked