Go Back   Steam Users' Forums > Steam Game Discussions > Q - S > Serious Sam series > Serious Sam 3: BFE

Reply
 
Thread Tools Display Modes
Old 04-29-2012, 05:28 AM   #1
m_nadal
 
Join Date: Mar 2007
Reputation: 5
Posts: 119
Question Surround sound

Surround sound is a vital part of the Serious Sam experience, unfortunately it doesn't work on my system.

My PC specs:
CPU Intel i5 2500k
COOL Antec KÜHLER H?O 620
MOBO Gigabyte Z68XP-UD3
GPU VTX3D AMD Radeon HD6950 2GB
RAM 2 x 4 GB Corsair Vengeance DDR3
SSD 120 GB OCZ Agility 3
PSU Silverstone Strider 750 W
OS Windows 7 SP1 Home Premium

I have my PC connected to a dolby 5.1 receiver using TOSLINK (optical)
I switch the receiver to auto-detect on optical input.

Now it gets confusing, there are at least 3 different audio control panels on the PC:

Realtek HD Audio Manager - Select Digital Output(Optical) tab, push Dolby Digital Live button, makes it 'Default Format'.

Dolby Home Theater - Has profiles for Movie, Music or Game, with Equalizer, Volume Leveler, Surround Virtualizer etc. I just use Game with default settings.

Windows Sound dialog - Has Digital Audio (HDMI), Realtek HDMI Output, Rear headphones, Internal ATAPI and Realtek Digital Output(Optical). The last one is set as Default Device.
In its Properties, I can test for
Encoded formats: DTS, DD work (WMA Pro doesn't work)
Sample rates: 44.1, 48, 96 kHz supported (192 kHz not supported)

I have a sound file called “dolby digital 5.1 test.ac3” and when I play it through Media Player Classic, it switches my receiver into DD mode and all speakers work as expected.

Relevant part from Steam\steamapps\common\serious sam 3\Log\Sam3.log:

16:58:27 INF: Sfx API: XAudio2
16:58:27 INF: Device: Realtek Digital Output(Optical) (Realtek High Definition Audio)
16:58:27 INF: Mixer frequency: 48000 Hz
16:58:27 INF: Mixer voices: 2
16:58:27 INF: Max sound sources: 35
16:58:27 INF: Max total volume: 3
16:58:27 INF: Speaker config: stereo
16:58:27 INF: Environment FX: enabled
16:58:27 INF: Current environment: Padded cell

I get no sound whatsoever from my rear speakers while playing this game.
I do get them when playing source games, DVD movies, Skulltag and so on.

Is there a command line switch I could try to make SS3 force surround output?

What else could I try?

Thanks for reading!
m_nadal is offline  
Reply With Quote
Old 05-01-2012, 06:31 AM   #2
m_nadal
 
Join Date: Mar 2007
Reputation: 5
Posts: 119
Post surround sound part 2

Cue the sound of crickets... :-P

Surround sound in Windows is a Linux-like clusterƒƲčķ of competing APIs, chipsets, encoding/decoding standards that devs and end-users have to negotiate to get the intended effect.

I'm prepared to invest some time and energy into this, because I like technical challenges, and digital sound is so awesome when it does work as intended.

Here is what I was able to figure out:

My Z68 motherboard sound chip is a Realtek ALC889. Driver Version is latest from Gigabyte website: 6.0.1.6449.

SS engine 3.5 supports three different APIs:

DirectSound is deprecated under Vista and Seven. Many older games, like Doom 3, use DirectSound (DS3D) calls for 3D positional audio.

XAudio2, which is for Windows and XBox 360, is the successor to DirectSound.

EAX is a library of hardware-accelerated digital signal processing presets, originally for Creative Technology's sound hardware. If a game with EAX support, such as Doom 3 or Prey, is running on a system with an audio driver that has OpenAL support, you will get the 3D effects.

EAX is now deprecated, and has been replaced by OpenAL.

OpenAL is the audio corollary of OpenGL. It does the 3D audio positioning, as well as support for EAX.

In Vista and Seven, Microsoft removed HAL for DirectSound, so Creative made Alchemy to convert DirectSound calls to OpenAL to provide EAX support and surround sound for games designed to use hardware accelerated DirectSound. Alchemy only works with certain Creative Technology sound hardware, though. (is this true?)
Realtek made an Alchemy equivalent called 3D Soundback, though only the 0.1beta is available.

Games can also support EAX through OpenAL natively, like Doom 3 and Serious Sam 3 for example.

1. In console, sfx_iAPI=1(OpenAL), 2(DirectSound), 3(XAudio2)
You can type in sfx, press Tab and then Cursor Up/Down to highlight an item in the list, then type =<number><Enter> to change the variable.
This is the best Tab completion I have ever seen, as it shows syntax and current state of each possible variable.

2. Changing the value for sfx_iAPI is sticky, that is, once it is changed in the console, the value will stay changed on subsequent sessions. I had a look at \Steam\steamapps\common\serious sam 3\Content\SeriousSam3\Config\, but I could not figure out how the game stores the setting.

3. Once the value for API has been changed, the sound system will NOT restart. I don't know if there is a command to do this. I had to restart the entire game to see the response from the engine, as reflected in the excerpts from the log file below
\Steam\steamapps\common\serious sam 3\Log\Sam3.log

3.1 OpenAL

21:18:33 INF: Sfx API: OpenAL
21:18:33 INF: Device: Generic Software
21:18:33 INF: Mixer frequency: 44100 Hz
21:18:33 INF: Mixer voices: 64
21:18:33 INF: Max sound sources: 35
21:18:33 INF: Max total volume: 3
21:18:33 INF: Speaker config: (unknown)
21:18:33 INF: Environment FX: enabled
21:18:33 INF: Current environment: Padded cell

Sound does come out of the rear speakers. I don't know if it is 3D positional, though.
The rear speakers seem to output the same audio as the front speakers.

I read an article comparing the 3D audio in Bad Company 2 to SS3, and it declared that whereas the source of every sound in BC2 was quite distinct, in SS3 you are faced with a "wall of sound" that makes it difficult to pinpoint the source.

3.2 DirectSound

20:45:21 INF: Sfx API: DirectSound
20:45:21 INF: Device: Realtek Digital Output(Optical) (Realtek High Definition Audio)
20:45:21 INF: Mixer frequency: 44100 Hz
20:45:21 INF: Mixer voices: 0
20:45:21 INF: Max sound sources: 35
20:45:21 INF: Max total volume: 3
20:45:21 INF: Speaker config: 5.1 (surround with subwoofer)
20:45:21 INF: Environment FX: not supported

No sound from the game at all, presumably because of Mixer voices = 0.

3.3 XAudio2

16:58:27 INF: Sfx API: XAudio2
16:58:27 INF: Device: Realtek Digital Output(Optical) (Realtek High Definition Audio)
16:58:27 INF: Mixer frequency: 48000 Hz
16:58:27 INF: Mixer voices: 2
16:58:27 INF: Max sound sources: 35
16:58:27 INF: Max total volume: 3
16:58:27 INF: Speaker config: stereo
16:58:27 INF: Environment FX: enabled
16:58:27 INF: Current environment: Padded cell

Sound output, but only in stereo.

***

The next logical step would be to create a sound test map in the SeriousEditor.
m_nadal is offline   Reply With Quote
Old 05-01-2012, 06:47 AM   #3
m_nadal
 
Join Date: Mar 2007
Reputation: 5
Posts: 119
I tried Realtek 3D Sound Back with sfx_iAPI=2 and it had very distinct 3D positional audio. Unfortunately, effects would cut out abruptly instead of fading in and out, so not even close to correct. There was also noise, pops and artifacting.

I tested XAudio2 on my system with the utility supplied on this webpage , and indeed, XAudio2 only uses 2 speakers on my system. So it seems the Realtek audio driver does NOT support XAudio2.

Last edited by m_nadal: 05-01-2012 at 06:49 AM.
m_nadal is offline   Reply With Quote
Old 05-01-2012, 03:29 PM   #4
Shad0WeN
 
 
 
Join Date: Oct 2009
Reputation: 109
Posts: 1,007
wish I could help but I just use headphones and don't have a surround sound speaker setup, sorry
Shad0WeN is offline   Reply With Quote
Old 05-08-2012, 08:38 AM   #5
m_nadal
 
Join Date: Mar 2007
Reputation: 5
Posts: 119
Red face

Apparently this is a bug in the XAudio2 API, not the Realtek driver.

Quote:
XAudio2 seems to query PKEY_AudioEngine_DeviceFormat to determine the speaker configuration. This is a WAVEFORMATEXTENSIBLE structure. XAudio2 does not check its "SubFormat" field for AC3/Dolby Digital. It always assumes some kind of PCM. And apart from the subformat GUID, a DDLive WAVEFORMATEX looks like stereo (2channel, 48kHz, 16bit - because an AC3 bitstream is compressed and fits into the bandwitdth of stereo PCM)!

A proper solution would to fix the XAudio2 speaker detection, e.g. query the MixFormat with IAudioClient::GetMixFormat, which is 6ch 48kHz 32bit float for DDLive.

A hacky work-around involves patching the XAudio DLLs (XAudio2_*.dll in both \Windows\System32 and \Windows\SysWOW64). I replaced the binary value for the PKEY_AudioEngine_DeviceFormat property key (hex: 4D 06 9F F1 2C 08 27 4E BC 73 68 82 A1 BB 8E 4C 00 00 00 00) in these DLLs with a value for a key from the registry which looked more like 6-channel. In my system with a Realtek HDAudio chip, I chose the registry key "{e4870e26-3cc5-4cd2-ba46-ca0a9a70ed04},0", which might be related to the "OEMFormat". The hex value to replace the value above is accordingly "26 0e 87 e4 c5 3c d2 4c 46 ba ca 0a 9a 70 ed 04 00 00 00 00".

I checked this with the Xaudio2 sample from the DX10 SDK and with a Xaudio2-enabled game. Both give me proper 5.1 surround sound now.
From: XAudio2 recognizes Dolby Digital Live output format as Stereo
m_nadal is offline   Reply With Quote
Old 05-08-2012, 02:15 PM   #6
AMX
 
 
 
Join Date: May 2012
Reputation: 0
Posts: 1
Quote:
Originally Posted by m_nadal View Post
I had a look at \Steam\steamapps\common\serious sam 3\Content\SeriousSam3\Config\, but I could not figure out how the game stores the setting.
I'm pretty sure it's not in the steamapps directory at all.

Have a look at \Steam\userdata\<ID>\41070\local\SeriousSam3.ini
AMX is offline   Reply With Quote
Old 05-08-2012, 06:10 PM   #7
m_nadal
 
Join Date: Mar 2007
Reputation: 5
Posts: 119
I just tested microphone in the game and that don't work, either.

My microphone works in source games. It is connected to the Realtek rear port.

Seriously, what is the reference sound card for SS3? What do the devs use?
I can't even find one sound card on the market with xaudio2 surround support.

Getting very frustrated ATM.
m_nadal is offline   Reply With Quote
Old 05-08-2012, 11:02 PM   #8
Dean Sekulic
 
Dean Sekulic's Avatar
 
Croteam
Join Date: Nov 2009
Reputation: 45
Posts: 160
You can experiment with OpenAL and (if you're brave enough) DirectSound.
In console type
sfx_iAPI=1
and restart.
That's for OpenAL. =2 is for DS. =3 is the default and that's XAudio2.
HTH
Dean Sekulic is offline   Reply With Quote
Old 05-08-2012, 11:44 PM   #9
m_nadal
 
Join Date: Mar 2007
Reputation: 5
Posts: 119
Thanks for your continuing work on Serious Engine 3.5 and Serious Sam 3!

I have tried OpenAL but it does not detect my speaker configuration.

Could you please clarify the situation:

- Does Serious Engine 3.5 support 3D positional audio?

- If yes, can you reveal which PC sound hardware you used for development and testing?

Until Microsoft fixes the bug in xaudio2_*.dll, is it possible that Croteam introduce a console variable that allows manual selection of speaker configuration?

Something like this:

sfx_iSpeakerConfig=0 (autodetect) default value*
sfx_iSpeakerConfig=1 (stereo)
sfx_iSpeakerConfig=2 (5.1)
sfx_iSpeakerConfig=3 (7.1)

*So that existing setups will not be broken, 0 would keep the current behaviour.

Regarding the Xaudio2 bug,

Quote:
XAudio2 seems to query PKEY_AudioEngine_DeviceFormat to determine the speaker configuration. This is a WAVEFORMATEXTENSIBLE structure. XAudio2 does not check its "SubFormat" field for AC3/Dolby Digital. It always assumes some kind of PCM. And apart from the subformat GUID, a DDLive WAVEFORMATEX looks like stereo (2channel, 48kHz, 16bit - because an AC3 bitstream is compressed and fits into the bandwitdth of stereo PCM)!

A proper solution would to fix the XAudio2 speaker detection, e.g. query the MixFormat with IAudioClient::GetMixFormat, which is 6ch 48kHz 32bit float for DDLive.
Thanks for reading.

Last edited by m_nadal: 05-09-2012 at 12:29 AM. Reason: additional detail
m_nadal is offline   Reply With Quote
Old 11-11-2012, 06:41 AM   #10
ovisis
 
Join Date: Mar 2010
Reputation: 0
Posts: 11
Hi gang!

I finally managed to get UNGLITCHY 3D positional audio to work.
Basically it involved buying an X-Fi card (X-Fi Bravura in my case), changing the sfx_iAPI to OpenAL (sfx_iAPI=1) and then adding the game to the Creative Alchemy App. GOOD TO GO!
ovisis is offline   Reply With Quote
Old 11-16-2012, 10:23 PM   #11
m_nadal
 
Join Date: Mar 2007
Reputation: 5
Posts: 119
Thumbs up

I managed to hack the correct values into the .DLL to enable 3D surround in the Serious Engine using XAudio2. It now works correctly both in the test utility and the game.

So there are at least two solutions, I'd mark this one up as [CLOSED].
m_nadal is offline   Reply With Quote
Old 11-21-2012, 02:20 PM   #12
Vonje
 
 
 
Join Date: May 2007
Reputation: 307
Posts: 4,510
No, OpenAL has not replaced EAX.
EAX is an extension to existing APIs. It's still working alongside OpenAL. EAX has however been replaced by EFX. I'm not sure what it changes, but I think it has something to do with better OpenAL integration.
Either way, hardware audio has unfortunately vanished.
Vonje is offline   Reply With Quote
Old 01-07-2015, 07:49 PM   #13
Fenrir007
 
Join Date: Jul 2011
Reputation: 8
Posts: 13
Quote:
Originally Posted by m_nadal View Post
I managed to hack the correct values into the .DLL to enable 3D surround in the Serious Engine using XAudio2. It now works correctly both in the test utility and the game.

So there are at least two solutions, I'd mark this one up as [CLOSED].
Sorry to necro this thread, but I am wrestling with the same problem and I see you managed to fix it with a modified .dll.

Would you mind uploading it? Thanks!
Fenrir007 is offline   Reply With Quote
Old 06-09-2015, 05:30 AM   #14
klauspost
 
 
 
Join Date: Jun 2015
Reputation: 0
Posts: 1
Quote:
Originally Posted by Fenrir007 View Post
Sorry to necro this thread, but I am wrestling with the same problem and I see you managed to fix it with a modified .dll.

Would you mind uploading it? Thanks!
I have written a small utility to help you patch the DLL files. You can find it along with instructions on my blog page. I hope it helps.
klauspost is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Game Discussions > Q - S > Serious Sam series > Serious Sam 3: BFE


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -7. The time now is 03:44 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2015, All Rights Reserved.