VOGONS

Common searches


indirect sound

Topic actions

Reply 81 of 228, by UCyborg

User metadata
Rank Member
Rank
Member

Good to know, thanks!

Arthur Schopenhauer wrote:

A man can be himself only so long as he is alone; and if he does not love solitude, he will not love freedom; for it is only when he is alone that he is really free.

Reply 82 of 228, by Chris2

User metadata
Rank Newbie
Rank
Newbie
UCyborg wrote:

I kinda ignored the fact that a lot can be done before the final result is send to the sound card. But it does depend on the particular implementation (eg. OpenAL Soft), correct?

Yes. Different implementations have different capabilities, so the exact capabilities it has depends on what the user has (and/or what the app or project ships with). And like OpenGL, you can query what capabilities/extensions a particular device has.

Couldn't also be said that the state of DirectSound today is like that because of the unfortunate historical reasons? The redesign of the whole audio architecture and how everything was relying on special hardware back then?

It's certainly understandable why the Windows audio stack changed like it did after XP. But I do think a bit more could've been done with DirectSound to at least optionally emulate hardware audio so that existing apps could retain some features, like surround sound and EAX. I can't presume to speak for Microsoft though, so who knows why it is like it is... perhaps there's too many edge cases and compatibility problems when simulating hardware audio, and they didn't want to put that much effort into an optional feature (just my guess).

I was told Raymond Chen has a lot of blog posts about how developers tend to mess up when using Windows APIs, but I'm guessing those are mostly related to non-gaming applications.

Games (most commercial software, actually) can be pretty notorious for using APIs in ways they aren't supposed to, because the developers need to fix some bug or implement some feature in as little time as possible and it just happens to work the way they did it, despite the API making no such guarantee. I actually remember running into a case where an app using DirectSound somehow used the vtable of a secondary buffer with the primary buffer object as the parameter, and expected it to work (at least, not crash). Given how the DirectSound API is set up with macros and such that automatically use the passed object's vtable, it boggles my mind trying to think of why and how they pulled that off (let alone that it worked).

So far, we haven't seen full-blown DirectSound -> OpenAL Soft wrapper. I remember the wrapper from dsoal.zip, but it's also incomplete.

Out of curiosity, what did you find missing? I think the only glaring feature missing was panning on a stereo sound, and the lack of obstruction/occlusion properties for EAX.

Yes, the router loves to put ct_oal.dll in the primary spot

Luckily, the current development version of OpenAL Soft is actually implementing a new router, which gives no preferential treatment to specific drivers and fixes a number of bugs and shortcomings in Creative's router. It searches specific directories in a fixed order (the router DLL's directory, the current directory, the executable's directory, then the system directory), but for each directory it loads the drivers it finds in whatever order the search function returns them in (probably alphabetical) without regard for what the driver's for. In the future, an option can be added for users to specify a desired list order for individual drivers if they want.

Reply 83 of 228, by UCyborg

User metadata
Rank Member
Rank
Member
Chris2 wrote:

Out of curiosity, what did you find missing? I think the only glaring feature missing was panning on a stereo sound, and the lack of obstruction/occlusion properties for EAX.

Actually, I haven't been able to give it a good spin because it refuses to work on Windows 8+, just crashes. Did anyone fix it and one could just download updated DLL?

Chris2 wrote:

It's certainly understandable why the Windows audio stack changed like it did after XP. But I do think a bit more could've been done with DirectSound to at least optionally emulate hardware audio so that existing apps could retain some features, like surround sound and EAX. I can't presume to speak for Microsoft though, so who knows why it is like it is... perhaps there's too many edge cases and compatibility problems when simulating hardware audio, and they didn't want to put that much effort into an optional feature (just my guess).

I wonder what HardwareAudioMixer compatibility shim does, which was also brought up in that thread. I've been using it long time ago when I didn't know about DirectSound wrappers to speed up the start time for the Call of Duty 1 - 2. For some reason there was some delay without it.

I would also guess that Microsoft wasn't too interested in those particular features, due to required effort to get them right with how things are today.

Arthur Schopenhauer wrote:

A man can be himself only so long as he is alone; and if he does not love solitude, he will not love freedom; for it is only when he is alone that he is really free.

Reply 84 of 228, by Falcosoft

User metadata
Rank Oldbie
Rank
Oldbie

I wonder what HardwareAudioMixer compatibility shim does, which was also brought up in that thread.

Since Windows Vista the classic win32 multimedia mixer API's behavior changed radically. Any applications that do not use Vista+ specific APIs but the classic mixer API has no other choices but use a per application waveout volume(the CD output is a fake one and controls the same per application volume). The API does not expose any other output controls anymore so the windows mixer API is practically useless if you want to control anything but wave volume. E.g. the HW Midi volume of SB cards or the playback volume of Mic/Line-in (not the recording inputs!) are unavailable through the mixer API.
The only solution to this problem is using Windows XP compatibility mode/HardwareAudioMixer compatibility shim. This way the application can access the real mixer topology of the sound hardware.
Upper picture: Mixer without compatibility shim. Lower picure: Mixer with compatibility shim.

mixer_shim.jpg
Filename
mixer_shim.jpg
File size
177.22 KiB
Views
3240 views
File license
Fair use/fair dealing exception

Website, Facebook, Youtube
Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
VST Midi Driver Midi Mapper

Reply 85 of 228, by Chris2

User metadata
Rank Newbie
Rank
Newbie
UCyborg wrote:

Actually, I haven't been able to give it a good spin because it refuses to work on Windows 8+, just crashes. Did anyone fix it and one could just download updated DLL?

I haven't touched the code in forever, and my own testing/use was under Wine (I use Linux and can't deal with the hassle of dual-booting, let alone dealing with my current lack of HD space and relatively low system specs). However the source is available here. The code's not in the greatest shape, and if I return to it there are definitely things I would like to redo, fix, and clean up using what I've learned since then, but it's there if anyone wants to take a poke at it.

Reply 86 of 228, by jonpol

User metadata
Rank Newbie
Rank
Newbie
Chris2 wrote:

It's certainly understandable why the Windows audio stack changed like it did after XP. But I do think a bit more could've been done with DirectSound to at least optionally emulate hardware audio so that existing apps could retain some features, like surround sound and EAX. I can't presume to speak for Microsoft though, so who knows why it is like it is... perhaps there's too many edge cases and compatibility problems when simulating hardware audio, and they didn't want to put that much effort into an optional feature (just my guess).

When I first heard about Vista breaking audio hardware acceleration I didn't know anything about how any of it worked, but as a gamer I knew that I liked surround sound and EAX with my Sound Blaster and I remember thinking something along the lines of "oh, it's Microsoft being their standard evil selves." Now that I understand a bit more what changed, though, it makes more sense why they changed it (or, said another way, it's clear that they had good reasons and weren't just motivated out of an evil desire to mess up game audio like my younger self thought 😊).

With that being said, I have wondered many times, like you say, "why didn't they at least put in some kind of fake hardware emulation?" It seems like they already must have done all of the hard work getting DirectSound to work under Vista, and it's puzzling to me why they didn't just take the next step. I know that there's always a tendency as an outsider to underestimate the difficulty of something like that, but it would be interesting to hear the behind-the-scenes story; if I had to guess I would bet that the engineers wanted to emulate hardware acceleration and it was a management decision to not do so (either because of not being able to guarantee corner cases, like you suggest, or because they (rightly?) assumed that not enough people would care about audio in older games to make it worth it from a financial return-on-investment perspective).

Reply 87 of 228, by Chris2

User metadata
Rank Newbie
Rank
Newbie
jonpol wrote:

It seems like they already must have done all of the hard work getting DirectSound to work under Vista, and it's puzzling to me why they didn't just take the next step.

DirectSound already had basic software mixing with XP (and 2K?) in case you didn't have a proper sound card, so there likely wasn't much effort to make it work on Vista with WASAPI. But with Vista, they also started focusing on XAudio to take over for DirectSound3D, which also contributed to the lack of DS3D hardware emulation (didn't want to incentivize devs to stick with DSound anymore than they had to).

Reply 88 of 228, by UCyborg

User metadata
Rank Member
Rank
Member

One obvious difference between XP's basic DirectSound and Vista+'s basic DirectSound, most sounds in Max Payne don't play in Vista+ unless converted. There's something about those WAVE files. Anyone knows?

Chris2 wrote:

DirectSound already had basic software mixing with XP (and 2K?) in case you didn't have a proper sound card, so there likely wasn't much effort to make it work on Vista with WASAPI.

Software mixing has always been available. The first set of tests on dxdiag's Sound tab use software buffers.

I fixed that problem with DirectSound -> OpenAL wrapper so now it at least works on Windows 8+. There are issues:

  • Max Payne - complete silence
  • Mafia - crashes after the intro cinematics if using OpenAL Soft, with Creative OpenAL Host there is music in menus, but no sounds. Crashes after loading the map. Options "Software mixing only" and "Disable EAX" don't help.
  • The Suffering - there are audio glitches in the prologue level, the one you unlock after finishing the game for the first time, must be something about that water sound. Only happens with OpenAL Soft, Creative OpenAL Host is fine.
  • Half-Life wants EAX 1.0 before it enables 3D sound.
Arthur Schopenhauer wrote:

A man can be himself only so long as he is alone; and if he does not love solitude, he will not love freedom; for it is only when he is alone that he is really free.

Reply 89 of 228, by jonpol

User metadata
Rank Newbie
Rank
Newbie
UCyborg wrote:
One obvious difference between XP's basic DirectSound and Vista+'s basic DirectSound, most sounds in Max Payne don't play in Vis […]
Show full quote

One obvious difference between XP's basic DirectSound and Vista+'s basic DirectSound, most sounds in Max Payne don't play in Vista+ unless converted. There's something about those WAVE files. Anyone knows?

I fixed that problem with DirectSound -> OpenAL wrapper so now it at least works on Windows 8+. There are issues:

  • Max Payne - complete silence
  • Mafia - crashes after the intro cinematics if using OpenAL Soft, with Creative OpenAL Host there is music in menus, but no sounds. Crashes after loading the map. Options "Software mixing only" and "Disable EAX" don't help.

I know that Max Payne is silent for some people without IndirectSound (on my machine it plays some sounds, but some/most are missing). Unfortunately I haven't investigated to try and figure out what IndirectSound does to fix it.

There are two things that I know about Mafia that are kind of unusual:

  • It uses "notifications". (It was the first game I ran across that did, and I had to fix some bugs with my notification implementation before it would work work properly.)
  • It uses a lot of deferred buffers (buffers that can be played in either software or hardware depending on what is available). I had to completely redo the way that IndirectSound handled deferred buffers to get Mafia to work at a decent frame rate 😊

[/list]

Edit: Reading this reminded me of one other crash bug IndirectSound had that I think may have been in Mafia. The cbSize field of a WAVEFORMATEX should be ignored if the format is WAVE_FORMAT_PCM (most games set it to 0, but I found out the hard way that not all do).

Reply 90 of 228, by UCyborg

User metadata
Rank Member
Rank
Member

This thread makes you realize that sound isn't as simple as one may think. Max Payne's original file with theme music is ADPCM while converted version is PCM. So majority of sound files are probably ADPCM. I wonder what goes wrong, the "DirectSound can't do ADPCM" seems strange to me.

Nice that you got Mafia figured out. I did notice you mentioned it in the changelog. Version 0.12 was out when I became aware of IndirectSound. Since you've mentioned the performance, you reminded me that Mafia has some memory management bugs. If you run it in debugger, it will break somewhere in ntdll.dll at certain points telling that some freed memory was written to. Running it with EmulateHeap shim, which puts Windows 9x's ancient heap manager in charge, slows it down a lot. Crashes on exit are also a norm. At least that's how patched version behaves, 1.0 is supposedly better in that regard.

Here comes the strangest thing, if you load the savegame number 15-8, right after the loading screen and before the cutscene starts, the game triggers one of the standard Windows sounds, the one titled Default Deep (Windows Ding.wav by default sound scheme).

Arthur Schopenhauer wrote:

A man can be himself only so long as he is alone; and if he does not love solitude, he will not love freedom; for it is only when he is alone that he is really free.

Reply 91 of 228, by jonpol

User metadata
Rank Newbie
Rank
Newbie

You reminded me of a [possibly?] interesting story about Mafia. I never played it when it came out, so I bought it just to fix some bugs that a guy was reporting with IndirectSound and consequently I was just playing the introduction over and over with that in mind. No matter what I did, though, I couldn't reproduce the bugs (mine seemed to behave a lot better than his). The only thing we could figure out that was different was that I had the English version and he had the Polish version; it didn't seem likely that this would matter, but after weeks of back and forth without progress we finally decided to have him send me all of the files from his installation to look at. It turned out that the problems weren't caused by the language difference, but because I had just installed the game from CD and didn't patch it. This was all obvious and embarrassing in retrospect haha

But, yes, there were some pretty major audio changes they made in the patch. If I recall correctly all of the issues that I mentioned in my previous post are only in the patched version.

Reply 92 of 228, by lowenz

User metadata
Rank Oldbie
Rank
Oldbie
jonpol wrote:
I know that Max Payne is silent for some people without IndirectSound (on my machine it plays some sounds, but some/most are mis […]
Show full quote
UCyborg wrote:
One obvious difference between XP's basic DirectSound and Vista+'s basic DirectSound, most sounds in Max Payne don't play in Vis […]
Show full quote

One obvious difference between XP's basic DirectSound and Vista+'s basic DirectSound, most sounds in Max Payne don't play in Vista+ unless converted. There's something about those WAVE files. Anyone knows?

I fixed that problem with DirectSound -> OpenAL wrapper so now it at least works on Windows 8+. There are issues:

  • Max Payne - complete silence
  • Mafia - crashes after the intro cinematics if using OpenAL Soft, with Creative OpenAL Host there is music in menus, but no sounds. Crashes after loading the map. Options "Software mixing only" and "Disable EAX" don't help.

I know that Max Payne is silent for some people without IndirectSound (on my machine it plays some sounds, but some/most are missing). Unfortunately I haven't investigated to try and figure out what IndirectSound does to fix it.

There are two things that I know about Mafia that are kind of unusual:

  • It uses "notifications". (It was the first game I ran across that did, and I had to fix some bugs with my notification implementation before it would work work properly.)
  • It uses a lot of deferred buffers (buffers that can be played in either software or hardware depending on what is available). I had to completely redo the way that IndirectSound handled deferred buffers to get Mafia to work at a decent frame rate 😊

[/list]

Edit: Reading this reminded me of one other crash bug IndirectSound had that I think may have been in Mafia. The cbSize field of a WAVEFORMATEX should be ignored if the format is WAVE_FORMAT_PCM (most games set it to 0, but I found out the hard way that not all do).

Max Payne (1) got an "unofficial patch" 10 years ago (Vista times) because of this 😁
That patch re-codes the sound files to bypass the problem.

https://steamcommunity.com/sharedfiles/filede … s/?id=945164243

Reply 93 of 228, by lowenz

User metadata
Rank Oldbie
Rank
Oldbie
UCyborg wrote:
One obvious difference between XP's basic DirectSound and Vista+'s basic DirectSound, most sounds in Max Payne don't play in Vis […]
Show full quote

One obvious difference between XP's basic DirectSound and Vista+'s basic DirectSound, most sounds in Max Payne don't play in Vista+ unless converted. There's something about those WAVE files. Anyone knows?

Chris2 wrote:

DirectSound already had basic software mixing with XP (and 2K?) in case you didn't have a proper sound card, so there likely wasn't much effort to make it work on Vista with WASAPI.

Software mixing has always been available. The first set of tests on dxdiag's Sound tab use software buffers.

I fixed that problem with DirectSound -> OpenAL wrapper so now it at least works on Windows 8+. There are issues:

  • Max Payne - complete silence
  • Mafia - crashes after the intro cinematics if using OpenAL Soft, with Creative OpenAL Host there is music in menus, but no sounds. Crashes after loading the map. Options "Software mixing only" and "Disable EAX" don't help.
  • The Suffering - there are audio glitches in the prologue level, the one you unlock after finishing the game for the first time, must be something about that water sound. Only happens with OpenAL Soft, Creative OpenAL Host is fine.
  • Half-Life wants EAX 1.0 before it enables 3D sound.

Maybe add this reminder to the readme 😁

http://www.indirectsound.com/registryIssues.html

Reply 94 of 228, by jonpol

User metadata
Rank Newbie
Rank
Newbie

A new version of IndirectSound has been released:

Version 0.15

It no longer uses X3DAudio, and instead implements its own 3D calculations trying to emulate the behavior of my Sound Blaster X-Fi in Windows XP. Subjectively I feel that the 3D effect is much improved and it fixes some long-standing problems people have experienced with some games (one example).

Reply 95 of 228, by UCyborg

User metadata
Rank Member
Rank
Member

The log file is spammed with those when playing The Suffering: Ties That Bind:

Emulated hardware buffers don't support the requested controls

Arthur Schopenhauer wrote:

A man can be himself only so long as he is alone; and if he does not love solitude, he will not love freedom; for it is only when he is alone that he is really free.

Reply 96 of 228, by jonpol

User metadata
Rank Newbie
Rank
Newbie
UCyborg wrote:

The log file is spammed with those when playing The Suffering: Ties That Bind:

Emulated hardware buffers don't support the requested controls

Thanks for letting me know!

That error means that it's trying to use one of the effects listed here. I just played through the intro cutscene a few times (up until you gain control), and I don't see that in my log file, so it must happen later in the game. (This is another game I only have for IndirectSound, so I've never actually seen anything past the introduction hehe.)

If you were able to figure out an easy way to get that message to appear it would be nice, because up until now I haven't been aware of any game using those (they're mentioned at the bottom of the known issues page).

Do you think that these error messages are new with the new 0.15 version? I would have guessed they would have been displayed in any version, back to the initial release, but maybe I broke something that I'm not thinking of.

Since I can't repro I can't be sure, but I bet that if you disable "Environment FX" in the Audio menu those errors will no longer show up.

Reply 97 of 228, by UCyborg

User metadata
Rank Member
Rank
Member

No, those messages are not new in 0.15, I just forgot to report it earlier. I think the reason you're not getting them is because you're testing with The Suffering instead of the sequel: The Suffering: Ties That Bind. The message does not appear in the first game and the first game is the only one that has Environmental FX option in menu with sound settings. I don't hear any difference with this one on or off and both games have EAX option in the dialog you get when you hold SHIFT during startup, likely a left-over from Drakan. The games even accept "-dedicated" parameter on the command line for starting multiplayer server, which just crashes.

Anyway, you don't have to play far, the messages appear right away with the intro cutscene. I wonder what kind of difference they're supposed to make to the sound. I don't have an actual Sound Blaster to be able to test in the environment the game expects.

It's quite problematic and IndirectSound appears to handle it best. My observations with other wrappers:

  • Creative ALchemy - sound glitches right after the intro cutscene and some other points in the game, messing with Buffers and Duration settings doesn't help
  • Creative ALchemy with DisableNativeAL=true - hangs during intro cutscene when the guard cocks his shotgun
  • dsoal - bad performance under certain conditions and 3D is a bit off, judging by the intro cutscene

BTW, Windows XP and earlier actually let you select headphones as the speaker configuration. So are you able to get proper 3D sound with headphones on such system with Sound Blaster in DirectSound3D games?

Arthur Schopenhauer wrote:

A man can be himself only so long as he is alone; and if he does not love solitude, he will not love freedom; for it is only when he is alone that he is really free.

Reply 98 of 228, by jonpol

User metadata
Rank Newbie
Rank
Newbie
UCyborg wrote:

No, those messages are not new in 0.15, I just forgot to report it earlier. I think the reason you're not getting them is because you're testing with The Suffering instead of the sequel: The Suffering: Ties That Bind. The message does not appear in the first game and the first game is the only one that has Environmental FX option in menu with sound settings.

Anyway, you don't have to play far, the messages appear right away with the intro cutscene. I wonder what kind of difference they're supposed to make to the sound. I don't have an actual Sound Blaster to be able to test in the environment the game expects.

Ah, ok, that makes sense. You are correct, and I missed that you were playing the sequel.

If nothing else, I should change IndirectSound so that it only outputs one error message instead of spamming an error every time a voice is attempted to be created.

UCyborg wrote:

BTW, Windows XP and earlier actually let you select headphones as the speaker configuration. So are you able to get proper 3D sound with headphones on such system with Sound Blaster in DirectSound3D games?

I hope other people with more experience will chime in because I always use speakers and not headphones. There is a way of making audio played through headphones sound like it's 3D, called Head Relative Transfer Functions (or "HRTFs"). Sound Blasters had an implementation of this called CMSS-3D. From what I can tell people really like it and so I assume that it works well (I've read people who think it is more convincing than 3D speakers), but I've personally never tried it.

OpenAL Soft has HRTF support. IndirectSound doesn't for hardware buffers (it uses Microsoft's implementation for software buffers, which is the same as what you'd get without IndirectSound).

That's about all I know, but I'm sure there are many others here who can tell you more if you're interested 😊

Reply 99 of 228, by UCyborg

User metadata
Rank Member
Rank
Member
jonpol wrote:

If nothing else, I should change IndirectSound so that it only outputs one error message instead of spamming an error every time a voice is attempted to be created.

Good idea.

jonpol wrote:

There is a way of making audio played through headphones sound like it's 3D, called Head Relative Transfer Functions (or "HRTFs"). Sound Blasters had an implementation of this called CMSS-3D.

True, I've read about that, I was just thinking that maybe Microsoft also have their own implementation. While not explicitly listed on the features list, CMSS-3D must also be part of Sound Blaster X-Fi MB3, pure software package intended to bring features of hardware Sound Blasters to plain integrated sound cards. When installed, you get a new sound device, for which if you set its speaker setup to some surround variant through Windows' sound control panel and select Headphones in Sound Blaster's settings program, you get 3D like sound on headphones. Applications can send multi-channel sound to the Sound Blaster virtual device, which then process it and sends it to the actual sound card.

I did some poking around executables of The Suffering games, read some docs on DirectSound APIs and discovered some things along the way previously unknown to me. Both games have default limits when it comes to number of concurrent playing sounds. They raise them only if number of available hardware buffers are higher. They call GetCaps method of DirectSound interface and check dwMaxHwMixingAllBuffers and dwMaxHw3DAllBuffers members of DSCAPS structure. DirectSound typically reports values of 1 and 0. Raising default limits in the engine, which are 20 and 8 in the first game and 32 for both values in the second to something higher like 64 or 128 gets rid of the problem of sounds dropping/not playing when 3D buffers are disabled. When we enable 3D buffers, almost nothing plays. The reason for that is DSBCAPS_LOCHARDWARE flag in the dwFlags member of DSBUFFERDESC passed to CreateSoundBuffer method. Removing that flag is the final step in making the engine neutral when it comes to hardware vs. software sound dilemma and removes all glitches that occur out-of-the box running through DirectSound.

Some old book says it's the best to either go full software or full hardware for most consistent results rather than let the system decide automatically based on what's free at the time of a function call. On Windows XP in VMware virtual machine with some older drivers for emulated ES1373 chip, which enable 3D hardware buffers, 64 of them are reported, which might be enough for this type of game. But in some multiplayer title with 32 people making noise at once, I can imagine that number being exceeded quickly. They removed the stats feature present in the first iteration of the engine, probably due to focus at the time being the console releases. Judging by extremely muffled sound from behind I got with them enabled confirms that how 3D effect is produced is dependent on sound card's driver. The results could likely be skewed compared to the real card. I've read some anecdote somewhere how going from one type of Audigy 2 card to newer X-Fi card made positional sound on headphones significantly better.

Another interesting thing, guid3DAlgorithm member of DSBUFFERDESC structure. Setting it to DS3DALG_HRTF_FULL or DS3DALG_HRTF_LIGHT when creating secondary buffers with 3D control will enable HRTF processing for software buffers. It's only implemented on Windows 98 - XP though. The default behavior (DS3DALG_DEFAULT) makes a difference (probably on most Windows versions) to sounds coming from behind as long as you have some sort of surround setup, be it real or virtual.

Arthur Schopenhauer wrote:

A man can be himself only so long as he is alone; and if he does not love solitude, he will not love freedom; for it is only when he is alone that he is really free.