Fix volume of looped sounds in OpenAL backend, fixes #111

AL_PlayChannel() is only called by AL_AddLoopSounds() and
S_IssuePlaysound() - but only the latter set a volume there.
Because of that, loopsounds weren't hearable anymore after the last
commit which removed adding s_volume to all volumes in AL_PlayChannel().
This is fixed by setting the volume for looped sounds in
AL_AddLoopSounds() as well.
Looped sounds don't seem to have a customizable volume and are always
played at full volume (the volume is only changed by distance, but
OpenAL does that automatically).
This commit is contained in:
Daniel Gibson 2015-11-02 01:48:52 +01:00
parent 4e13e3ee69
commit 4cbe5f25e0

View file

@ -445,6 +445,11 @@ AL_AddLoopSounds(void)
ch->dist_mult = SOUND_LOOPATTENUATE; ch->dist_mult = SOUND_LOOPATTENUATE;
ch->end = paintedtime + sc->length; ch->end = paintedtime + sc->length;
/* it seems like looped sounds are always played at full volume
* see SDL_AddLoopSounds() which calls SDL_SpatializeOrigin() with volume 255.0f
* so set it to full volume (1.0 * s_volume). */
ch->oal_vol = s_volume->value;
AL_PlayChannel(ch); AL_PlayChannel(ch);
} }
} }