https://bugs.winehq.org/show_bug.cgi?id=43173
Bug ID: 43173 Summary: Far Cry 4 sound stops Product: Wine Version: 2.10 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-dsound Assignee: wine-bugs@winehq.org Reporter: noonetinone@gmail.com Distribution: ---
Created attachment 58436 --> https://bugs.winehq.org/attachment.cgi?id=58436 a run of FC4 with steam logs excised
After the cut scenes from Ubisoft, Dunia, and Nvidia the sound cuts out. When this happens you are at the main menu. A few releases ago, I tested a new game and during the 'Stop the Bus' routine as well as the main menu and there was sound. Something happened.
There is some information in my console log.
DirectSoundDevice_RemoveBuffer is called multiple time until it has no buffers left. At this point you are at the main menu, at line 2102 in the attachment. The following are the last few lines from +dsound,+alsa.
_________________________________________________________________________________
warn:dsound:DSOUND_PrimaryDestroy Destroying primary buffer while references held (1 1) trace:alsa:AudioClient_Stop (0x24887040) trace:alsa:alsa_rewind_best_effort rewinding 1015 frames, now held 3404 trace:alsa:AudioClient_Release (0x24887040) Refcount now 2 trace:alsa:AudioClient_Release (0x24887040) Refcount now 1 trace:alsa:AudioClient_Release (0x24887040) Refcount now 0 trace:alsa:AudioClient_Stop (0x24887040) trace:dsound:DirectSoundDevice_Release (0x24888050) released trace:dsound:directsound_destroy (0x2487a8d0) released
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #1 from Anthony Jagers noonetinone@gmail.com --- This seems to have fixed its self. I'm closing this as invalid.
https://bugs.winehq.org/show_bug.cgi?id=43173
Anthony Jagers noonetinone@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |WORKSFORME
--- Comment #2 from Anthony Jagers noonetinone@gmail.com --- The sound works.
https://bugs.winehq.org/show_bug.cgi?id=43173
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|WORKSFORME |INVALID
https://bugs.winehq.org/show_bug.cgi?id=43173
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|directx-dsound |-unknown
https://bugs.winehq.org/show_bug.cgi?id=43173
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Austin English austinenglish@gmail.com --- Closing.
https://bugs.winehq.org/show_bug.cgi?id=43173
Anthony Jagers noonetinone@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CLOSED |UNCONFIRMED Resolution|INVALID |---
--- Comment #4 from Anthony Jagers noonetinone@gmail.com --- I want to rethink this. Maybe the xaudio2 component is at play here. I can only get sound with overrides. But it maybe time to retest with the latest work in staging.
https://bugs.winehq.org/show_bug.cgi?id=43173
Anthony Jagers noonetinone@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |xaudio2
https://bugs.winehq.org/show_bug.cgi?id=43173
Anthony Jagers noonetinone@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|2.10 |4.3 Hardware|x86 |x86-64
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #5 from Anthony Jagers noonetinone@gmail.com --- For Far Cry 4, I get audio during the videos only. This is with a development 4.3 release, with FAudio added as system libraries. Wine compiles with xaudio2 support. I compile wine with Pulseaudio support.
Trying to find out where the stream is going, I watched the game with the pulse volume control. It is as below. <-vol+> when the videos are playing is clearly normal. <-vol+> jumps up and down as you would expect for any stream. Then, when the videos are finished and you are at the main menu in the game, audio stream #2 disappears. <-vol+> for the wine preloader app is dead. No audio is being sent to pulse by SDL2.
from a screenshot of pulseaudio volume control ------------------- FarCry4.exe: audio stream #2 on [HD-Audio Generic Analog Stereo] <-vol+> <- this jumps up/down wine64-preloader: Simple DirectMedia Layer on [HD-Audio Generic Analog Stereo] <nothing> -------------------
To get audio working for this game, I would have to override xaudio 2.7. Is there some way to find out what exactly SDL2 is sending pulse? I was thinking that sdl2 might be misconfigured. Since I compile my own, I don't use any special configure options. I did see how debian configures theirs.
---
--enable-sdl-dlopen --disable-nas --disable-esd --disable-arts --disable-alsa-shared --disable-pulseaudio-shared
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #6 from Anthony Jagers noonetinone@gmail.com --- Created attachment 63762 --> https://bugs.winehq.org/attachment.cgi?id=63762 a +xaudio2 log of Far Cry 4
This is a -all,+xaudio2 log. Two lines were repeated over 5,000 times.
https://bugs.winehq.org/show_bug.cgi?id=43173
Ethan Lee flibitijibibo@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |flibitijibibo@gmail.com
--- Comment #7 from Ethan Lee flibitijibibo@gmail.com --- The log makes me wonder - I think the reason it's calling XA27_GetDeviceDetails so much is because it's not finding the default device, which might be happening because of the failure on line 1. Sadly whenever I google "open /dev/snd/seq failed: No such file or directory" all the posts date back to ~2005-2010, which is... interesting.
So there's two possibilities I can think of:
- It _really_ wants a specific detail in DeviceDetails that FAudio doesn't provide - Something's wrong with that audio setup, but unfortunately I couldn't tell you what
This isn't the only report I've seen with a similar issue though: https://github.com/ValveSoftware/Proton/issues/2143
So I'm leaning towards idea #1, unless their setup is miraculously acting up too. I wonder how we can figure out what FC4's engine wants from device 0?
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #8 from Anthony Jagers noonetinone@gmail.com --- You don't need the staging patches to run uplay or Far Cry 4.
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #9 from Anthony Jagers noonetinone@gmail.com --- Created attachment 63785 --> https://bugs.winehq.org/attachment.cgi?id=63785 an unaltered log
+tid,+mmdevapi,+winmm,+midi,+dsound,+dmusic,+oss,+alsa,+coreaudio,+xaudio2
maybe worth a read
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #10 from Ethan Lee flibitijibibo@gmail.com --- Ah, now THAT log is interesting. Particularly the part where it only calls GetDeviceDetails twice, and then never creates a source! This means that it makes a context (which is the SDL device you're seeing), but then does nothing with it, which is why you're hearing silence. In fact, it seems to do a whole bunch of work with DirectSound instead. This may explain why setting the OS to WinXP fixes the issue for others. I would try that next and see if setting XP makes it ignore XAudio2 altogether.
Even more interesting is that the bug may be with the games themselves; googling "Far Cry 4 XAudio2" brings up some results regarding specific driver configurations that cause the game to be silent even on Windows. I've not seen this before when looking up XAudio2 behavior/usage for other games, so we're mostly likely looking at an engine bug. I'll have to see if I can figure out a device configuration that the Ubi sound engine likes...
https://bugs.winehq.org/show_bug.cgi?id=43173
Anthony Jagers noonetinone@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #63785|0 |1 is obsolete| |
--- Comment #11 from Anthony Jagers noonetinone@gmail.com --- Created attachment 63786 --> https://bugs.winehq.org/attachment.cgi?id=63786 Far Cry 4 in win 7 mode
With the same debug channels, I have put Far Cry 4 in Win 7 mode. Indeed it was in Win XP mode with log 63785. I can't remember why I did that. But I needed it at the time. For what ever reason, it is now not necessary. Hurray for wine progress I guess.
It didn't fix the audio. But the log is certainly more usable.
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #12 from Ethan Lee flibitijibibo@gmail.com --- After playing with this on Windows (FAudio doesn't work there either) I'm now reasonably convinced that they're using their DirectSound stuff to interact with XAudio2 in some way. In particular, I think they might be reusing some of this:
https://blogs.msdn.microsoft.com/chuckw/2012/05/02/xinput-and-xaudio2/
If I'm right (which is admittedly unlikely, this code is for 360 controller audio support, why would we be getting near that...?), the problem is with FAudio's XAUDIO2_DEVICE_DETAILS.DeviceID value. From the above post...
On Windows XP, the deviceID from XAudio2 is a DirectSound GUID, while on Windows Vista and later it is a WASAPI Audio Endpoint Device Identifier.
FAudio is producing neither of these, and in particular, it's not producing anything that matches Wine's DSound/WASAPI endpoint IDs. So it's possible that they're comparing device info against the other audio IDs that are already in use by the engine, then bailing on their own XAudio2 context when the device info doesn't match.
A quick and dirty way to fix this would be to figure out what Wine is using for the default endpoint ID, then shove that into FAudio (either hardcoded for via an environment variable):
https://github.com/FNA-XNA/FAudio/blob/master/src/FAudio_platform_sdl2.c#L20...
The long-term solution would most likely be to revisit the WASAPI backend, which still isn't pretty since FAudio_platform continues to change internally ~once a month.
That's all assuming that my DeviceID guess is right. I really, REALLY hope it isn't.
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #13 from Anthony Jagers noonetinone@gmail.com --- How is the audio in this game? I'll give it a try.
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #14 from Ethan Lee flibitijibibo@gmail.com --- I revisited this and decided to try out my idea that the game had a hard dependency on DSound/WASAPI endpoint IDs. And yes, this actually worked:
https://github.com/FNA-XNA/FAudio/commit/ceadb9b14ca256f82b0c0c344aef742dfea...
If you set this variable to the one I list as an example (it's the default ID that winepulse.drv emits) both Far Cry 3 and 4 will have audio. Bizarrely the Ubisoft Bink logo will be silent, but you can get to the menu without crashing and menu sounds work properly. It crashes later on but I haven't confirmed that it's related to this.
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #15 from Anthony Jagers noonetinone@gmail.com ---
it's the default ID that winepulse.drv emits
I'm assuming your referring to FAUDIO_FORCE_DEFAULT_DEVICEID found in your sources. I don't know how to find that ID. I upgraded to the latest FAUDIO tag and am willing to try this but still get audio only in the bink videos.
https://bugs.winehq.org/show_bug.cgi?id=43173
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #16 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-5.14?
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #17 from Anthony Jagers noonetinone@gmail.com ---
Does the bug still occur with wine-5.14?
Yes, the problem still persists. I just tried the game with 5.14 and the latest release of FAudio. I get sound during the cut scenes from Ubisoft, Dunia, and Nvidia. But the sound at the main menu cuts out.
Ethan can get the sound working but I didn't follow and couldn't get him to explain his hack.
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #18 from Andrey Gusev andrey.goosev@gmail.com --- Sound works for me with FAudio 20.12-4-g23470c3
https://bugs.winehq.org/show_bug.cgi?id=43173
--- Comment #19 from Anthony Jagers noonetinone@gmail.com --- I have sound. Closing.
https://bugs.winehq.org/show_bug.cgi?id=43173
Anthony Jagers noonetinone@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #20 from Anthony Jagers noonetinone@gmail.com --- Closing.
https://bugs.winehq.org/show_bug.cgi?id=43173
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #21 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.13.