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:
parent
a0c5724283
commit
8520533296
1 changed files with 2 additions and 0 deletions
|
@ -332,6 +332,7 @@ void musicclass::fadeMusicVolumeIn(int ms)
|
||||||
/* Fix 1-frame glitch */
|
/* Fix 1-frame glitch */
|
||||||
Mix_VolumeMusic(0);
|
Mix_VolumeMusic(0);
|
||||||
|
|
||||||
|
fade.step_ms = 0;
|
||||||
fade.duration_ms = ms;
|
fade.duration_ms = ms;
|
||||||
fade.start_volume = 0;
|
fade.start_volume = 0;
|
||||||
fade.end_volume = MIX_MAX_VOLUME;
|
fade.end_volume = MIX_MAX_VOLUME;
|
||||||
|
@ -342,6 +343,7 @@ void musicclass::fadeMusicVolumeOut(const int fadeout_ms)
|
||||||
m_doFadeInVol = false;
|
m_doFadeInVol = false;
|
||||||
m_doFadeOutVol = true;
|
m_doFadeOutVol = true;
|
||||||
|
|
||||||
|
fade.step_ms = 0;
|
||||||
fade.duration_ms = fadeout_ms;
|
fade.duration_ms = fadeout_ms;
|
||||||
fade.start_volume = musicVolume;
|
fade.start_volume = musicVolume;
|
||||||
fade.end_volume = 0;
|
fade.end_volume = 0;
|
||||||
|
|
Loading…
Reference in a new issue