dsoal icon indicating copy to clipboard operation
dsoal copied to clipboard

X-Wing Alliance missing sounds with DSOAL

Open morallo opened this issue 2 years ago • 5 comments

Hello, I am trying to make X-Wing Alliance work with DSOAL, but when the 3D sound is active, there are sounds missing (mainly your own spacecraft engine).

These are the debug messages that the game provides:

[11232] { 16,4865 (16,4865)} 3D sound supported in hardware with 64 sounds.
[11232] { 16,4866 ( 0,0001)} Speaker config set to: Unknown
[11232] { 16,4866 ( 0,0000)} Primary sound buffer originally at 22050 hz, 16 bits, 2 channels.
[11232] { 16,4866 ( 0,0000)} Primary sound buffer set to 22050 hz, 16 bits, 2 channels.
[...]
[11232] { 33,3844 (13,9088)} Failed to queue sound; out of range.
[11232] { 33,3845 ( 0,0001)} Failed to queue sound; out of range.
[...]

And from dsoal_error.txt:

[...]
414c:err:dsound:DSBuffer_SetLoc Out of software sources
414c:err:dsound:DSBuffer_SetLoc Out of software sources
414c:warn:dsound:DSBuffer_Unlock Invalid parameters (0x1c2f7fb0,29184) (1C2F7FB0,29184,0019F2D8,0)
[...]

The last warning appears when actually playing sounds that work fine. The Out of software sources happens as soon as in the loading screen for the mission.

Any idea of a typical root cause for this, or how to troubleshoot? I can have a look at the game code in IDA but I need some tips on what to look for. Thanks in advance!

morallo avatar Sep 26 '22 21:09 morallo

Can you provide a full trace log from DSOAL? The "Out of software sources" error could indicate an older build that had fewer "software" sources, or it may be an app that uses many more sources/buffers than anticipated.

The DSBuffer_Unlock Invalid parameters warning/failure may indicate DSound should ignore the second pointer if the size is 0. Or maybe it's supposed to fail to make the app behave like it does with normal DSound. It looks like Wine would return the same error with those parameters.

kcat avatar Sep 26 '22 23:09 kcat

Thanks for the help!

dsoal_log.zip

The game is supposed to use 32 channels/sources. I configured 256 in a local alsoft.ini. I have tried also with lower values, even 32.

morallo avatar Sep 27 '22 23:09 morallo

That's using an older DSOAL. I'd try using a newer version. Also, I wouldn't modify the sources in alsoft.conf. DSOAL requests how many it wants to use, so modifying it with alsoft.conf will just limit it and make it behave less well.

kcat avatar Sep 28 '22 02:09 kcat

dsoal_log.zip This is with the latest version from 18 Aug 2022.

There are still "out of software sources" errors, and missing sounds. The main missing sound is the user spacecraft engine, which I expect to be one of the first ones to be requested to DSOAL before the software sources can be exhausted...

This is the alsoft.ini:

 [General]
default-hrtf=Built-In HRTF
hrtf=true

[decoder]
hq-mode=true

Any ideas or next steps for troubleshooting? Thank you!

morallo avatar Oct 01 '22 22:10 morallo

The latest commits for DSOAL increase the max source count, which allows for more software sources and should avoid that error (unless there's a deeper issue that just will use up all sources regardless of how many there are).

The DSBuffer_Unlock Invalid parameters error I'm less sure about. Wine's dsound should return a similar error, so either it's something the app normally does and the error is normal, or something else is causing it to provide a bad pointer.

kcat avatar Mar 14 '23 08:03 kcat