1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Music: Reset step_ms on every fade call.

Without this you end up with two problems:
- Fades will start past their fade time, causing it to just not fade at all
- Fades will start in the middle of their fade time, causing dramatic changes
  in volume that are unintentional

The fade system already preserves the volume that music is playing during a
previous fade, so we can always reset the timer and get a good result.

Part of #764
This commit is contained in:
Ethan Lee 2021-06-14 15:09:23 -04:00
parent a0c5724283
commit 8520533296

View file

@ -332,6 +332,7 @@ void musicclass::fadeMusicVolumeIn(int ms)
/* Fix 1-frame glitch */
Mix_VolumeMusic(0);
fade.step_ms = 0;
fade.duration_ms = ms;
fade.start_volume = 0;
fade.end_volume = MIX_MAX_VOLUME;
@ -342,6 +343,7 @@ void musicclass::fadeMusicVolumeOut(const int fadeout_ms)
m_doFadeInVol = false;
m_doFadeOutVol = true;
fade.step_ms = 0;
fade.duration_ms = fadeout_ms;
fade.start_volume = musicVolume;
fade.end_volume = 0;