🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Untitled

posted in DruinkJournal
Published October 08, 2007
Advertisement
I installed Dungeon Keeper 2 because I felt like playing it again, and it works fine under XP, except some of the longer audio clips get garbled. I've heard this happening before in my own engine, and it's caused by my on-board sound failing miserably with notifications in hardware sound buffers. Notifications are only needed in streaming buffers, so short samples aren't affected, but it's annoying for longer samples - which tend to be the more important ones too.

It doesn't just affect me, it affects a lot of cheap or on-board sound cards. The solution is pretty simple though, just create a software sound buffer. So I thought I'd be "clever" and create a DirectSound proxy DLL. Then, when DK2 asks for a DirectSound interface, I can hand it a proxy interface, and then strip out the "create buffer in hardware" flag and force it to software. Simple, yes? Well, no.

The problem is that DK2 doesn't use DirectSound directly. It uses "QSound", which does "something" and ends up using OLE to do its dirty work. OLE takes great pleasure in making things difficult for me, by not calling DirectSoundCreate() at all, it insists on using the COM DllGetClassObject() function. That in its own wouldn't be too bad - I already have my DLL set up to intercept a DllGetClassObject() request for CLSID_DirectSound. The problem is what it does with the IDirectSound (or rather, the proxy object) pointer. The first thing it does with this pointer is call CreateSoundBuffer() on it, with a NULL buffer desc, a seemingly gibberish output interface pointer (*pointer = 0x279afa83, which is an odd value in both senses of the word), and with the COM aggregation interface non-NULL [sad]

So, I now have to learn how to do COM aggregation in order to just get my DSound interface constructed in the proper way. I have a feeling it'll be pretty simple for what I want, but it's still something I could do without. And there was me thinking this would be a one or two hour project...

So, if you know about COM aggregation, feel free to reply here or in My Thread. I'm going to bed. Joy joy joy...
Previous Entry Untitled
Next Entry Untitled
0 likes 1 comments

Comments

Sonnenblume
I guess this is where you and I differ, if it was annoying me that much i'd just have bought a £20 soundblaster sound card off ebay :)
October 09, 2007 10:31 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement