kondrak / vkQuake2

id Software's Quake 2 v3.21 with mission packs and Vulkan support (Windows, Linux, macOS, FreeBSD, Raspberry Pi 4)
GNU General Public License v2.0
896 stars 91 forks source link

Music volume decreases when other sounds are playing #74

Closed Marat-Tanalin closed 5 years ago

Marat-Tanalin commented 5 years ago

There is an unexpected sidechain-like effect: music volume decreases when other sounds (e.g. shots, explosions; or even hits played when moving between menu items) are playing, then music volume restores (increases), and this up/down volume changes happen constantly which does not correspond to the original Quake 2 behavior. Thanks.

kondrak commented 5 years ago

I had a look at this yesterday and it seems it's some sort of an inherent "feature" of the Windows mixer. Playing the music in VLC or some external media player and having the game running on top of it with music disabled impacts the volume as well. No idea if this is some audio setting that can be disabled but I've seen people complaining on similar behavior when having Skype calls with music playing in the background. Either way, doesn't seem to be a bug in vkQuake2.

Marat-Tanalin commented 5 years ago

How is the Windows mixer involved in the internal game mixing? Is this specific to the Miniaudio library?

It should be possible to do mixing entirely inside the game so that the Windows mixer would have no idea what parts the single monolithic sound the mixer “hears” was created from.

Sounds (such as those produced by VLC) not produced by the game itself don’t matter even if they are affected by a similar effect.

kondrak commented 5 years ago

Quake 2's original audio playback is handled by DirectSound and there is in fact also an internal mixer but Miniaudio relies strictly on the underlying API provided by the OS and nothing else. CD music never needed any additional mixing since it was handled independently from game sounds. I suppose it could be possible to rewrite this but it's far beyond the scope of what I'm trying to achieve with this project (ie. focus on Vulkan renderer).