diff --git a/src/client/sound/header/local.h b/src/client/sound/header/local.h index 56d60093..2f1f15fc 100644 --- a/src/client/sound/header/local.h +++ b/src/client/sound/header/local.h @@ -99,6 +99,7 @@ typedef struct qboolean autosound; /* from an entity->sound, cleared each frame */ #if USE_OPENAL int autoframe; + float oal_vol; int srcnum; #endif } channel_t; diff --git a/src/client/sound/snd_al.c b/src/client/sound/snd_al.c index de37ecdc..ce4f0446 100644 --- a/src/client/sound/snd_al.c +++ b/src/client/sound/snd_al.c @@ -292,11 +292,10 @@ 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 / 3); + qalSourcef(ch->srcnum, AL_GAIN, ch->oal_vol); qalSourcef(ch->srcnum, AL_REFERENCE_DISTANCE, SOUND_FULLVOLUME); qalSourcef(ch->srcnum, AL_MAX_DISTANCE, 8192); - qalSourcef(ch->srcnum, AL_ROLLOFF_FACTOR, ch->dist_mult * - (8192 - SOUND_FULLVOLUME)); + qalSourcef(ch->srcnum, AL_ROLLOFF_FACTOR, ch->dist_mult * (8192 - SOUND_FULLVOLUME)); AL_Spatialize(ch); diff --git a/src/client/sound/snd_dma.c b/src/client/sound/snd_dma.c index 76557346..947ada3a 100644 --- a/src/client/sound/snd_dma.c +++ b/src/client/sound/snd_dma.c @@ -689,7 +689,6 @@ S_IssuePlaysound(playsound_t *ps) ch->dist_mult = ps->attenuation * 0.0005f; } - ch->master_vol = (int)ps->volume; ch->entnum = ps->entnum; ch->entchannel = ps->entchannel; ch->sfx = ps->sfx; @@ -699,11 +698,13 @@ S_IssuePlaysound(playsound_t *ps) #if USE_OPENAL if (sound_started == SS_OAL) { + ch->oal_vol = ps->volume; AL_PlayChannel(ch); } else #endif { + ch->master_vol = (int)ps->volume; S_Spatialize(ch); } @@ -870,7 +871,7 @@ S_StartSound(vec3_t origin, int entnum, int entchannel, sfx_t *sfx, if (sound_started == SS_OAL) { ps->begin = paintedtime + timeofs * 1000; - ps->volume = fvol * 384; + ps->volume = fvol; } else #endif