Divide effect volume by 3 when using the OpenAL backend

Since OpenAL 1.15 AL_GAIN has much more weight than before. That leeds
to overdriven effect samples unless the volume control is set to a very
low level. With this change volume can be set to a high level without
distorting. But there's one problem. A division by 2 is to low to rule
distortion out and by 3 the game is a little bit quieter than before. A
value of 2.5 would be optimal but is not applicable since the volume is
represented by an integer. I've choosen 3 to be aon the save side.

As a side note: This problem was very less worse on Linux than on
Windows and FreeBSD. Maybe Linux guys need to pump there volume up
to compensate this work-around.
This commit is contained in:
Yamagi Burmeister 2013-01-06 17:09:30 +01:00
parent 7e7d5d0f99
commit 2890dafbda

View file

@ -292,7 +292,7 @@ AL_PlayChannel(channel_t *ch)
qalGetError();
qalSourcei(ch->srcnum, AL_BUFFER, sc->bufnum);
qalSourcei(ch->srcnum, AL_LOOPING, ch->autosound ? AL_TRUE : AL_FALSE);
qalSourcef(ch->srcnum, AL_GAIN, ch->master_vol);
qalSourcef(ch->srcnum, AL_GAIN, ch->master_vol / 3);
qalSourcef(ch->srcnum, AL_REFERENCE_DISTANCE, SOUND_FULLVOLUME);
qalSourcef(ch->srcnum, AL_MAX_DISTANCE, 8192);
qalSourcef(ch->srcnum, AL_ROLLOFF_FACTOR, ch->dist_mult *
@ -476,7 +476,7 @@ AL_Update(void)
AL_CopyVector(listener_forward, orientation);
AL_CopyVector(listener_up, orientation + 3);
qalListenerfv(AL_ORIENTATION, orientation);
qalListenerf(AL_GAIN, s_volume->value);
qalListenerf(AL_GAIN, s_volume->value / 3);
qalDistanceModel(AL_LINEAR_DISTANCE_CLAMPED);
/* update spatialization for dynamic sounds */