indirect sound

Getting old Windows games working.

Re: APIs

Postby mirh » 2018-2-05 @ 18:14

So.. I guess like I missed the right time window for a proper reply, so I'll just try to keep this short.

If you want to develop with WASAPI (or XAudio2) out of personal interest that's a thing, you just have to say it and I'm fine.
Otherwise, I already underlined how "open" is really the least of my practical points. I don't want these to be conflated with the usual ideological, technical-poor ones.
Then, gosh, I guess like for two totally unknown people to collaborate some way, at least one of them has to have code somewhere in the wild to "trust the other", but this is an aside.

I got in touch with Chris eventually (hence [part of] the delay).. And there doesn't seem to be any intrinsic "added" requirement to specify buffers.
Furthermore for as much, yes, the "audio chain" would get conceptually lengthened, there's no indication of any significant penalty in latency (I have read on dolphin git that, with a X-fi, you can nonchalantly get down to 6ms for example)

And concluding, seriously, he seems as much available as humanly possible (he even came here to answer), and he already expressed in the past a vague desire to get EAX reimplemented - just not a work he'd do in first person.
If he saw a PR, it certainly wouldn't be rejected as out-of-scope. Imo.
But again, your call.
pcgamingwiki.com
mirh
Member
 
Posts: 332
Joined: 2014-9-13 @ 21:39

Re: indirect sound

Postby DosDaddy » 2018-2-17 @ 05:02

jonpol wrote:
UCyborg wrote: BTW, can IndirectSound work on Windows XP? I tried it on VMware virtual machine where it outputs:

The requested audio device {BD6DD71A-3DEB-11D1-B171-00C04FC20001} was not found!

I'm curious because without specific sound card, you get as much features via DirectSound on XP as on Vista+. At one point, I found a bit unstable driver for VMware's sound card (ES1371 chip) that exposes hardware accelerated 3D sound buffers and basic EAX (probably just 1.0). Random sound cards from VIA for example are still stuck with bare basics.


It doesn't work on XP, but it's been so many years since I've looked into it that I've forgotten most of what I knew. I think it had something to do with the way I am loading libraries, but I didn't spend time fixing it since I figured anyone using XP could just use a real SoundBlaster. My guess is that it probably could work (again, going off memory here), but I've been debating changing some of the way IndirectSound works internally to use WASAPI instead of XAudio2 and maybe moving to a newer version of Visual Studio, after which XP would no longer be an option.


Kind of late, but would you reconsider adding XP compatibility at some point? Turns out we now have these "pure", minimalist, homebrew CMI8738/68 super-low-latency drivers which are an absolute blessing for emulation. Unfortunately all of this comes with a price; no support for any type of hardware acceleration, and that's where IndirectSound fits into the picture.

https://code.google.com/archive/p/cmediadrivers/

Thanks a lot.
User avatar
DosDaddy
Newbie
 
Posts: 79
Joined: 2017-5-16 @ 09:37

Re: indirect sound

Postby lowenz » 2018-2-20 @ 18:34

UCyborg wrote: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.

Raven Shield (and maybe other DARE audio games) crashes:

OS: Windows NT 6.2 (Build: 9200)
CPU: GenuineIntel PentiumPro-class processor @ 3802 MHz with 2047MB RAM
Video: \\.\DISPLAY1 (0)

General protection fault!

History: UDareAudioSubsystem::SND_ResetVolume_AllTypeSound <- UDareAudioSubsystem::LoadBankMap <- ClientInit <- UGameEngine::LoadMap <- LocalMapURL <- UGameEngine::Browse <- ClientTravel <- UGameEngine::Tick <- UpdateWorld <- MainLoop


IndirectSound is working.
lowenz
Oldbie
 
Posts: 952
Joined: 2014-12-20 @ 01:30

Re: indirect sound

Postby jonpol » 2018-3-04 @ 18:15

UCyborg wrote: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.


I don't remember why (I think it was a thread on this site, actually), but I made a little demo program a few years ago that people could use to hear the differences between the different 3D software methods on different versions of Windows. If you're interested in trying it out it's still hiding on my website:

http://www.indirectsound.com/downloads/3dSoftware.exe
jonpol
Newbie
 
Posts: 56
Joined: 2013-9-24 @ 19:14

Re: APIs

Postby jonpol » 2018-3-04 @ 18:18

mirh wrote:I got in touch with Chris eventually (hence [part of] the delay).. And there doesn't seem to be any intrinsic "added" requirement to specify buffers.
Furthermore for as much, yes, the "audio chain" would get conceptually lengthened, there's no indication of any significant penalty in latency (I have read on dolphin git that, with a X-fi, you can nonchalantly get down to 6ms for example)

And concluding, seriously, he seems as much available as humanly possible (he even came here to answer), and he already expressed in the past a vague desire to get EAX reimplemented - just not a work he'd do in first person.
If he saw a PR, it certainly wouldn't be rejected as out-of-scope. Imo.
But again, your call.


Yes, it was great to have him here. Hopefully he'll continue to post!
jonpol
Newbie
 
Posts: 56
Joined: 2013-9-24 @ 19:14

Re: indirect sound

Postby jonpol » 2018-3-04 @ 18:24

DosDaddy wrote:
jonpol wrote:
UCyborg wrote: BTW, can IndirectSound work on Windows XP? I tried it on VMware virtual machine where it outputs:

The requested audio device {BD6DD71A-3DEB-11D1-B171-00C04FC20001} was not found!

I'm curious because without specific sound card, you get as much features via DirectSound on XP as on Vista+. At one point, I found a bit unstable driver for VMware's sound card (ES1371 chip) that exposes hardware accelerated 3D sound buffers and basic EAX (probably just 1.0). Random sound cards from VIA for example are still stuck with bare basics.


It doesn't work on XP, but it's been so many years since I've looked into it that I've forgotten most of what I knew. I think it had something to do with the way I am loading libraries, but I didn't spend time fixing it since I figured anyone using XP could just use a real SoundBlaster. My guess is that it probably could work (again, going off memory here), but I've been debating changing some of the way IndirectSound works internally to use WASAPI instead of XAudio2 and maybe moving to a newer version of Visual Studio, after which XP would no longer be an option.


Kind of late, but would you reconsider adding XP compatibility at some point? Turns out we now have these "pure", minimalist, homebrew CMI8738/68 super-low-latency drivers which are an absolute blessing for emulation. Unfortunately all of this comes with a price; no support for any type of hardware acceleration, and that's where IndirectSound fits into the picture.

https://code.google.com/archive/p/cmediadrivers/

Thanks a lot.


HI! Sorry for the delay in responding.

Sorry, I just briefly looked at your link, but I'm not understanding. Let me try to restate and you can correct anything I get wrong: You are doing emulation (of console games, I guess?) on an actual Windows XP system, but the drivers that you are using don't support hardware acceleration and so you are hoping to also use IndirectSound on the same system so that you can play standard PC games in addition to the emulation that you're doing?
jonpol
Newbie
 
Posts: 56
Joined: 2013-9-24 @ 19:14

Re: indirect sound

Postby mirh » 2018-3-08 @ 22:58

The right TL;DR should be: those revamped drivers are a blessing for "sensitive" (be it stability or latency) tasks, also audio creation and playback - but they lack standard "gaming" features.
XP being quite incidental to the issue, if not any probably the age of the "accompanying" pc.

The same probably also happens with open source driver for older Live/Audigy cards.
Except the thing becomes even funnier there, once you think you are trying the emulate the very same hardware you already have.
I previously had said screw hw acceleration, but I hadn't thought to such a odd situation. Another point to add to my reasons list I guess.
pcgamingwiki.com
mirh
Member
 
Posts: 332
Joined: 2014-9-13 @ 21:39

Re: indirect sound

Postby DosDaddy » 2018-3-10 @ 06:08

jonpol wrote:HI! Sorry for the delay in responding.

Sorry, I just briefly looked at your link, but I'm not understanding. Let me try to restate and you can correct anything I get wrong: You are doing emulation (of console games, I guess?) on an actual Windows XP system, but the drivers that you are using don't support hardware acceleration and so you are hoping to also use IndirectSound on the same system so that you can play standard PC games in addition to the emulation that you're doing?


Sorry about the delay, and that's exactly a 100% right :)

There's also the problem with the original C-Media drivers that wouldn't even output at 16bit as they're supposed to, so these new drivers take care of it, which I recall was part of the original motivation behind them (so it's either this or this if you're stuck with a CMI8738 for whatever reason and can't seem to stomach the scratchiness of 15bit audio)

Another third party solution that operates in a similar fashion and also suffers from the same problem (lack of hardware acceleration) would be AC'97 ASIO (https://web.archive.org/web/20120307182 ... 97asio.htm)

And there's others, but that's the two I've extensively used.

Howbeit, hardware buffers being gone, I'm not sure if there can be a fallback mechanism here like there's in older games?
User avatar
DosDaddy
Newbie
 
Posts: 79
Joined: 2017-5-16 @ 09:37

Re: indirect sound

Postby jonpol » 2018-3-11 @ 05:56

DosDaddy wrote:
jonpol wrote:HI! Sorry for the delay in responding.

Sorry, I just briefly looked at your link, but I'm not understanding. Let me try to restate and you can correct anything I get wrong: You are doing emulation (of console games, I guess?) on an actual Windows XP system, but the drivers that you are using don't support hardware acceleration and so you are hoping to also use IndirectSound on the same system so that you can play standard PC games in addition to the emulation that you're doing?


Sorry about the delay, and that's exactly a 100% right :)

There's also the problem with the original C-Media drivers that wouldn't even output at 16bit as they're supposed to, so these new drivers take care of it, which I recall was part of the original motivation behind them (so it's either this or this if you're stuck with a CMI8738 for whatever reason and can't seem to stomach the scratchiness of 15bit audio)

Another third party solution that operates in a similar fashion and also suffers from the same problem (lack of hardware acceleration) would be AC'97 ASIO (https://web.archive.org/web/20120307182 ... 97asio.htm)

And there's others, but that's the two I've extensively used.

Howbeit, hardware buffers being gone, I'm not sure if there can be a fallback mechanism here like there's in older games?


Well, I guess that kind of makes sense, but I'm not sure if it's a common enough use case to convince me. It would be one thing if it were just a matter of spending time to try and figure out how to make it work in Windows XP, since I can't think of any technical reason that it shouldn't at the moment. If I switch from XAudio2 to WASAPI, however, then IndirectSound will no longer be able to work with XP, and the main motivation to do that is to try to get EAX working better than I have been able to so far. Unfortunately for you, there is a lot more desire for EAX than there is for XP support (not just from users but from me also hehe).

My guess is that XP support probably won't happen. Sorry :(
jonpol
Newbie
 
Posts: 56
Joined: 2013-9-24 @ 19:14

Re: indirect sound

Postby UCyborg » 2018-3-12 @ 12:34

Maybe ask on MSFN if someone has implemented MMDevAPI/WASAPI on XP, then future IndirectSound could work. Or you could try Vista with SP2. Seriously, Vista with SP2 and the Platform Update is decent. Also significantly less buggy than Windows 10.
UCyborg
Member
 
Posts: 202
Joined: 2015-9-04 @ 11:10

Re: indirect sound

Postby jonpol » 2018-3-13 @ 06:29

jonpol wrote:
DosDaddy wrote:Kind of late, but would you reconsider adding XP compatibility at some point? Turns out we now have these "pure", minimalist, homebrew CMI8738/68 super-low-latency drivers which are an absolute blessing for emulation. Unfortunately all of this comes with a price; no support for any type of hardware acceleration, and that's where IndirectSound fits into the picture.

There's also the problem with the original C-Media drivers that wouldn't even output at 16bit as they're supposed to, so these new drivers take care of it, which I recall was part of the original motivation behind them (so it's either this or this if you're stuck with a CMI8738 for whatever reason and can't seem to stomach the scratchiness of 15bit audio)

Another third party solution that operates in a similar fashion and also suffers from the same problem (lack of hardware acceleration) would be AC'97 ASIO (https://web.archive.org/web/20120307182 ... 97asio.htm)

And there's others, but that's the two I've extensively used.

Howbeit, hardware buffers being gone, I'm not sure if there can be a fallback mechanism here like there's in older games?


Well, I guess that kind of makes sense, but I'm not sure if it's a common enough use case to convince me. It would be one thing if it were just a matter of spending time to try and figure out how to make it work in Windows XP, since I can't think of any technical reason that it shouldn't at the moment. If I switch from XAudio2 to WASAPI, however, then IndirectSound will no longer be able to work with XP, and the main motivation to do that is to try to get EAX working better than I have been able to so far. Unfortunately for you, there is a lot more desire for EAX than there is for XP support (not just from users but from me also hehe).

My guess is that XP support probably won't happen. Sorry :(


Hey,

Since my last post I've been thinking about it and wondering if maybe it wouldn't be too hard to make IndirectSound work on Windows XP, and if I just bit the bullet and did it now there would be at least one version that would work with XP for you in case I did switch to WASAPI in the future. With that in mind I've spent some time looking into it and figuring out what the problem is.

The bad news is that it turns out that there is a technical reason that it doesn't work :depressed:

I hadn't realized it, but it looks like XAudio2 on Windows XP is actually implemented using DirectSound. In retrospect I guess this makes sense since DirectSound would be the low-level audio API until things were redone for Vista. It creates a funny circular/recursive problem for IndirectSound: I'm trying to emulate DirectSound using XAudio2, and XAudio2 is being "emulated" using DirectSound, and so a DirectSound function calls XAudio2, which calls DirectSound, which calls XAudio2, which calls DirectSound...

I haven't fully thought this through (I maybe shouldn't post this publicly until I have hehe), but I think it would still theoretically be possible to make it work, but I'd have to have a secondary layer of "hooking": Before every XAudio2 API call I'd have to hook the already hooked DirectSound functions, and make them point back to the real DirectSound functions, and then after XAudio2 was done I'd have to unhook those so that they pointed back to IndirectSound's versions for the game to use. Even though it might be possible to make this work I wouldn't want to add the extra complexity or take the performance hit for the standard use case of newer Windows versions.

So, sorry again; it doesn't look like IndirectSound will work in Windows XP.
jonpol
Newbie
 
Posts: 56
Joined: 2013-9-24 @ 19:14

Re: indirect sound

Postby DosDaddy » 2018-3-16 @ 23:14

Well, thanks for having looked into it anyways :cool:
User avatar
DosDaddy
Newbie
 
Posts: 79
Joined: 2017-5-16 @ 09:37

Re: indirect sound

Postby UCyborg » 2018-6-30 @ 20:05

I forgot to mention this the last time, those effects that The Suffering: Ties That Bind tries to use are unused feature. I NOPed those calls out in my patch.

With the patch, it also works great now with Microsoft's DirectSound, irregardless of operating system version and installed sound card.
UCyborg
Member
 
Posts: 202
Joined: 2015-9-04 @ 11:10

Re: indirect sound

Postby jonpol » 2018-7-01 @ 01:46

UCyborg wrote:I forgot to mention this the last time, those effects that The Suffering: Ties That Bind tries to use are unused feature. I NOPed those calls out in my patch.

With the patch, it also works great now with Microsoft's DirectSound, irregardless of operating system version and installed sound card.


Cool. I also changed IndirectSound in the newest 0.16 version so that it only prints an error about FX being unavailable once rather than making the log file huge. I guess I never mentioned that to you :blush:

When you say it's an unused feature, does that mean that the buffers are created with the FX flag, but then nothing is ever done once they are created?
jonpol
Newbie
 
Posts: 56
Joined: 2013-9-24 @ 19:14

Re: indirect sound

Postby UCyborg » 2018-7-01 @ 18:50

I forgot to mention this the last time, those effects that The Suffering: Ties That Bind tries to use are unused feature. I NOPed those calls out in my patch.

Forget I said that, I actually only NOPed out call to CoInitialize that is made every time before it tries to create FX buffer and moved it to the beginning of function of the engine's secondary thread that is created with call to _beginthreadex. I had 3D sound buffers disabled from last time I tested and this also skips FX buffer code...

I made an interesting discovery today. That FX buffer code actually does something. Right at the beginning of the game, when the riot starts and you proceed through the door and make it to the other side of the hallway, you hear the guard talking on the phone behind the locked door. If you wait or try to open the door, you'll hear him being killed.

Now, if we skip the FX buffer code, the sounds of him being murdered will play at normal pace (like it also does on PS2 version) while otherwise, they will play with delay so you have to wait a little longer before the guard is thrown through the locked the door.

So one thing that is definitely audible with FX code doing its thing is the delay. at least in that area, it creates reverb effect (aka. GUID_DSFX_STANDARD_I3DL2REVERB from dsound.h). If you download the patch again, play to the part where you get the shotgun and then go to address 0x4496F3 with OllyDbg (or whatever debugger you like) and change instruction there to read:

MOV DWORD PTR SS:[ESP+6C],20294

Can you hear any difference in sound compared to when you leave the number at 20290? I can't, but the delay is there. So skipping that code might actually be a good idea, this way we get 3D sound positioning without delays which normally occur.

jonpol wrote:I also changed IndirectSound in the newest 0.16 version so that it only prints an error about FX being unavailable once rather than making the log file huge. I guess I never mentioned that to you :blush:

I knew that, I don't skip readmes and changelogs. :)
UCyborg
Member
 
Posts: 202
Joined: 2015-9-04 @ 11:10

Re: indirect sound

Postby jonpol » 2018-7-10 @ 23:10

UCyborg wrote:
I made an interesting discovery today. That FX buffer code actually does something.

So one thing that is definitely audible with FX code doing its thing is the delay. at least in that area, it creates reverb effect (aka. GUID_DSFX_STANDARD_I3DL2REVERB from dsound.h). If you download the patch again, play to the part where you get the shotgun and then go to address 0x4496F3 with OllyDbg (or whatever debugger you like) and change instruction there to read:

MOV DWORD PTR SS:[ESP+6C],20294

Can you hear any difference in sound compared to when you leave the number at 20290? I can't, but the delay is there. So skipping that code might actually be a good idea, this way we get 3D sound positioning without delays which normally occur.


Sorry, I haven't had time to try this out. I've been distracted by Real Life, and when I have done gaming stuff it has primarily been for the latest IndirectSound release (plus some Dark Souls Remastered co-op while the servers were heavily populated :blush: ).

It seems like it would be interesting to play this part with a SoundBlaster. It's possible that Microsoft's software reverb implementation is poor, and just sounds like a delay, but the original intent and result was different. Have you tried that already? I actually did buy the game after your report, but I've only played the very beginning of the intro to test fixing the output messages, and don't know the game at all.

(Side note that is only vaguely related: I also played the intro to the first Suffering again because I was curious to verify what your patch said about EAX not being used. I was surprised to find that none of the characters showed up! Since I've never played it and only use it to test IndirectSound I'm reasonably sure that I haven't changed any of the game files (and it's GOG and not Steam so they shouldn't auto-update), which makes me wonder if something with Windows 10 or an NVIDIA driver has messed it up. :depressed: )
jonpol
Newbie
 
Posts: 56
Joined: 2013-9-24 @ 19:14

Re: indirect sound

Postby jonpol » 2018-7-10 @ 23:29

If anyone is interested, a new version of IndirectSound has been released:


One change that may be of interest to Vogonites is the new Miles Sound System compatibility mode. Games using Miles that have historically only supported 5.1 rear surround can now be played with 7.1, 5.1 theater, and other less common speaker configurations. The way this works is kind of hacky (Miles still mixes everything internally at 5.1), but it is based on the same technique that Source engine games use when snd_legacy_surround is enabled and in my opinion sounds pretty good in practice.
jonpol
Newbie
 
Posts: 56
Joined: 2013-9-24 @ 19:14

Re: indirect sound

Postby ZellSF » 2018-7-11 @ 15:57

Any chance you can look at Elite Starfighter and Thandor: The Invasion?

Elite Starfighter currently requires Creative ALchemy as there's audio distortion natively and with IndirectSound.

Thandor: The Invasion has audio distortion problems natively and with IndirectSound, Creative ALchemy seems to be missing sounds (but the sounds it does have doesn't sound distorted).
ZellSF
Oldbie
 
Posts: 1071
Joined: 2006-1-01 @ 18:19

Re: indirect sound

Postby UCyborg » 2018-7-11 @ 16:15

jonpol wrote:It seems like it would be interesting to play this part with a SoundBlaster. It's possible that Microsoft's software reverb implementation is poor, and just sounds like a delay, but the original intent and result was different. Have you tried that already?

I would try if I had one, but the last time I had a PC with a dedicated sound card was in the previous century. The only things I still have from that ancient PC is the Windows 95's manual and the manual of that PC's sound card (the front page says SF16-FMP 16-Bit Sound Board with FM Radio), which specs boast compatibility with Adlib, Sound Blaster 2.0 and Sound Blaster 16.

Watching some videos from the console versions does indicate that part might actually sound different, see this.

jonpol wrote:(Side note that is only vaguely related: I also played the intro to the first Suffering again because I was curious to verify what your patch said about EAX not being used.

Creative ALchemy has a hidden API logger for DirectSound, which would show if EAX support was queried. It doesn't look like the games actually do anything useful with EAX flag.

jonpol wrote:I was surprised to find that none of the characters showed up! Since I've never played it and only use it to test IndirectSound I'm reasonably sure that I haven't changed any of the game files (and it's GOG and not Steam so they shouldn't auto-update), which makes me wonder if something with Windows 10 or an NVIDIA driver has messed it up. :depressed: )

That's a famous bug that happens if you play the second game before the first. It happens because both games store graphics config in registry at HKLM\Software\(WOW6432Node)\Surreal\Riot Engine, in SettingsDX105. I changed the second game to use SettingsDX106 and both games to use HKCU instead of HKLM to avoid permission issues/invoking of registry virtualization.

jonpol wrote:Sorry, I haven't had time to try this out.

That's OK, I've also been distracted with other things. But if you do find the time to mess with The Suffering: TTB, particularly on the PC with the actual Sound Blaster (you still have it, right?), I would appreciate if you let me know whether that FX code actually does something useful or is it safe to skip it without compromising anything.
UCyborg
Member
 
Posts: 202
Joined: 2015-9-04 @ 11:10

Re: indirect sound

Postby jonpol » 2018-7-11 @ 17:29

ZellSF wrote:Any chance you can look at Elite Starfighter and Thandor: The Invasion?

Elite Starfighter currently requires Creative ALchemy as there's audio distortion natively and with IndirectSound.

Thandor: The Invasion has audio distortion problems natively and with IndirectSound, Creative ALchemy seems to be missing sounds (but the sounds it does have doesn't sound distorted).


I don't have either of those, and it doesn't appear that they're available digitally.

Have you checked the dsound.log files when using IndirectSound to see if any errors or warnings are reported?
jonpol
Newbie
 
Posts: 56
Joined: 2013-9-24 @ 19:14

PreviousNext

Return to Windows

Who is online

Users browsing this forum: No registered users and 2 guests