SpiritQuaddicted / reQuiem

reQuiem is a custom OpenGL Quake engine for Windows and Linux. It's designed for maximum compatibility with all things Quake - past, present and future. It's fast, reliable, and easy to configure. In short: it fixes what was broken, improves what needed improving, and leaves the rest alone. It was developed by jdhack.
GNU General Public License v2.0
17 stars 2 forks source link

music volume also affects "normal" sound volume #22

Open neogeographica opened 10 years ago

neogeographica commented 10 years ago

As expected, changing the "volume" console variable changes only the sound effects volume, and leaves the music volume unchanged.

However, changing the "bgmvolume" variable affects BOTH the normal sound effects and the music volume. So it's impossible to turn down the music while still keeping the normal sound effects.

This is on Windows 7, using fmod375.dll for the fmod library.

neogeographica commented 10 years ago

A few notes about this:

I don't know the first thing about fmod or DirectSound. However, I did dig up some fmod 3 API docs at http://delok.free.fr/Boulot1/RM'X%20Vibration/FMOD/fmod361html/HTML/FSOUND.html . Just spitballing some ideas:

If we knew what channel we could use for the music we could maybe use SetVolume or SetVolumeAbsolute to just set the volume for that channel, and avoid using SetSFXMasterVolume.

There's a lot of different code for setting the # of channels which I haven't fully looked at yet. For Windows it seems to always be 2 channels but snd_linux.c is apparently more flexible about setting the # of channels, accepting some arbitrary number if specified through an environment variable. That makes it difficult to reserve a specific "high channel" for music tracks, especially without knowing what the device might actually support. Couple of options there:

neogeographica commented 10 years ago

Welp, I tried the second approach above, and even when we only do SetVolumeAbsolute on the specific channel where the fmod music is playing, the DirectSound sound effects are still affected.

BTW the channel selected when using FSOUND_FREE (for playing the music stream) seems always be channel 0. I believe this is going to be a "software channel" as far as fmod is concerned. Since fmod is a DirectSound wrapper (I think?) on Windows, I guess it's not super-surprising that any fmod volume manipulations are stomping on the sound effects that are being handled "directly" through DirectSound.

But I could just be completely talking through my hat and an actual sound-savvy developer would know better what is going on.

SpiritQuaddicted commented 10 years ago

Weird, this works perfectly well on Linux (with "FMOD v3.75 initialized").

I wish for someone to switch sound (and other things) over to SDL, then probably https://github.com/SpiritQuaddicted/reQuiem/issues/3 and https://github.com/SpiritQuaddicted/reQuiem/issues/2 would solve itself too. I tried convincing someone but failed. Maybe something for https://github.com/ericwa ? ;)

I uploaded the original dll files from jdhack to http://chunk.io/f/dd7636ba5d7b464880f20abdb4dd9fed for the distant chance that it works with them.

neogeographica commented 10 years ago

Nope! Same fmod DLL there, same result.

SpiritQuaddicted commented 10 years ago

It works fine for me on Windows 7 and some onboard Realtek HD audio thing.

neogeographica commented 10 years ago

I've tried this on a couple of different Win7 systems, and I've noticed a couple of things:

In your experiments, were you changing bgmvolume while reQuiem was running, or changing it outside the game (editing the config)? And were you setting it to zero or to some nonzero value?