i-rinat / apulse

PulseAudio emulation for ALSA
MIT License
609 stars 35 forks source link

Problems with certain games. #92

Closed Catoptrix closed 6 years ago

Catoptrix commented 6 years ago

Hi,

First of all, thank you for this. Finally Discord works now. I have an usb card and alsa 80% of times detects it. Sometimes on startup it chooses the motherboard soundcard as default. No idea why that happens sometimes.

Unfortunately still have some problems with certain games like "Pyre", which still has no sound:

Number of audio devices: 24
Driver #0: default:CARD=PCH, Speaker Mode: STEREO
Driver #1: default:CARD=CODEC, Speaker Mode: STEREO
Driver #2: sysdefault:CARD=CODEC, Speaker Mode: STEREO
Driver #3: front:CARD=CODEC,DEV=0, Speaker Mode: STEREO
Driver #4: surround21:CARD=CODEC,DEV=0, Speaker Mode: STEREO
Driver #5: surround40:CARD=CODEC,DEV=0, Speaker Mode: QUAD
Driver #6: surround41:CARD=CODEC,DEV=0, Speaker Mode: STEREO
Driver #7: surround50:CARD=CODEC,DEV=0, Speaker Mode: SURROUND
Driver #8: surround51:CARD=CODEC,DEV=0, Speaker Mode: _5POINT1
Driver #9: surround71:CARD=CODEC,DEV=0, Speaker Mode: _7POINT1
Driver #10: iec958:CARD=CODEC,DEV=0, Speaker Mode: STEREO
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

Driver #11: pulse, Speaker Mode: STEREO
Driver #12: sysdefault:CARD=PCH, Speaker Mode: STEREO
Driver #13: front:CARD=PCH,DEV=0, Speaker Mode: STEREO
Driver #14: surround21:CARD=PCH,DEV=0, Speaker Mode: STEREO
Driver #15: surround40:CARD=PCH,DEV=0, Speaker Mode: QUAD
Driver #16: surround41:CARD=PCH,DEV=0, Speaker Mode: STEREO
Driver #17: surround50:CARD=PCH,DEV=0, Speaker Mode: SURROUND
Driver #18: surround51:CARD=PCH,DEV=0, Speaker Mode: _5POINT1
Driver #19: surround71:CARD=PCH,DEV=0, Speaker Mode: _7POINT1
Driver #20: hdmi:CARD=NVidia,DEV=0, Speaker Mode: STEREO
Driver #21: hdmi:CARD=NVidia,DEV=1, Speaker Mode: STEREO
Driver #22: hdmi:CARD=NVidia,DEV=2, Speaker Mode: STEREO
Driver #23: hdmi:CARD=NVidia,DEV=3, Speaker Mode: STEREO
Using driver #0

Driver 0 should be the usb default soundcard, isn't it? Since I installed apulse nothing changed in regard of other games which had sound, they still have sound. Like wine with Path of Exile works fine, Halcyon6 or caves of qud.

Not sure if it is apulse related, any ideas? :)

Catoptrix commented 6 years ago

Ok Drive 0 is not my default soundcard defined by .asoundrc it should be driver 1. Where can I define that? How do I change this default?

i-rinat commented 6 years ago

I can't say whenever it's related to apulse or not. My first guess would be "yes", since there are a ton of API not implemented in apulse. By the way, if you build from source, and use -DWITH_TRACE=1 option for CMake, apulse will spam to the standard output (usually goes to the terminal you're starting programs from) list of unimplemeted calls. Some calls are not crucial, but some are actually important. And their absence could be a reason for non-working sound. By default, apulse is built without tracing.

As for the multiple card issues, I can only give link to the ALSA wiki: https://alsa.opensrc.org/MultipleCards. I'm by no means an ALSA expert. Sorry.

Catoptrix commented 6 years ago

Thank you for the quick reply. Well the sound works, I plugged in my headphones on the motherboard soundcard output. Unfortunately that's the wrong card. I think I will try the -DWITH_TRACE=1 option if I don't hear back from the game developer, I wrote them too :) Just the fact that the game choses the driver for you and you can't intervene seems weird. I leave this open so I can show the solution. Thx again.

i-rinat commented 6 years ago

I don't think it's the game that chooses which driver to choose. It's likely that order of cards is chosen at startup time. Which module initializes hardware faster, becomes first. And after that apulse just uses default which corresponds to the first card in the list.

Catoptrix commented 6 years ago

Well according to https://alsa.opensrc.org/MultipleCards

Problems with alsa.conf and udev On modern GNU/Linux systems, udev takes care of discovering hardware and loading/unloading Alsa. There is one drawback to udev. Udev will load Alsa modules in an undefined order. After each reboot or plugging/unplugging a device, there is no guarantee that a device is renamed using the same hw:x,y numbers. For example, if you have two USB devices on your systems, for example an Audeon USB and an Edirol UA-25, after each reboot, a card can be "hw:0,0" and the other "hw:1,0", each time randomly. /etc/init.d/alsasound is an udev wrapper that will take care of loading the ALSA modules during booting. But even with it, a few problems may still occurs.

And the game actually does choose a driver, from the email with the developer:

Due to an issue with FMOD Studio's device selection the game will sometimes select the incorrect Audio output device at startup. We exposed this in a text file so it can be fixed client-side. Check this entry for more details: http://pcgamingwiki.com/wiki/Transistor#OS_X.2FLinux_audio_missing (NOTE: Yes, that article is for Transistor, but Pyre should also have an FMODDriver.txt file!)

And all the FMODDRIVER.txt included was 0 :rofl: I changed it to 1 and it worked. But still sometimes udev/eudev would change the order of my soundcards.

And the only way I found fixing this problem of random indexing my cards by udev (or eudev in my case) is to blacklist snd_hda_intel in /etc/modprobe.d/alsa-base.conf

which is kind of ridiculous, isn't it? :tired_face:

mviereck commented 6 years ago

You probably can fix this with setting environment variable ALSA_CARD. Check card names in output of aplay -l. In my case, I have to set export ALSA_CARD=Generic. Otherwise ALSA tries to access my non-connected HDMI port.

Catoptrix commented 6 years ago

Hey thanks for this information. I will try it out. Also if somebody else comes around, I will post this link: https://ptspts.blogspot.com/2009/03/how-to-select-alsa-sound-card-and-have.html

Thx all, I will close this now. Peace