Factor fade amount calculation to separate function

This makes it so to reuse this code, we don't have to copy-paste it.

Additionally, I added a check for the milliseconds being 0, to avoid a
division by zero. Logically and mathematically, if the fade amount is 0
milliseconds, then that means the fade should happen instantly -
however, dividing by zero is undefined (both in math and in C/C++), so
this check needs to be added.
This commit is contained in:
Misa
2021-04-02 12:02:01 -07:00
committed by Ethan Lee
parent f6ea05f521
commit 92b3c0b413
2 changed files with 13 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ public:
void resume(const int fadein_ms = 0);
void haltdasmusik(void);
void silencedasmusik(void);
void setfadeamount(const int fade_ms);
void fadeMusicVolumeIn(int ms);
void fadeout(const bool quick_fade_ = true);
void fadein(void);