FunkinCrew / Funkin

A rhythm game made with HaxeFlixel
https://www.newgrounds.com/portal/view/770371
Other
2.96k stars 2.29k forks source link

Enhancement: Freeplay song previews should fade out before restarting #2832

Open JackXson-Real opened 4 months ago

JackXson-Real commented 4 months ago

Why does it only fade in, but not out lmao

EliteMasterEric commented 3 weeks ago

Definitely would like this implemented. I took a stab at it and had a lot of trouble but if anyone wants to make a PR I'd gladly review it.

JackXson-Real commented 3 weeks ago

Definitely would like this implemented. I took a stab at it and had a lot of trouble but if anyone wants to make a PR I'd gladly review it.

Have you tried just making it fade in once the preview restarts? It would basically be the same effect, but I imagine would be easier to implement since the preview already fades in on the first listen

Hundrec commented 3 weeks ago

I'd prefer if it faded out too, so that it doesn't abruptly cut off after a while. It would be important to indicate whether the face-out begins or ends at the specified freeplay preview time.

EliteMasterEric commented 3 weeks ago

I was originally thinking that the fade out should end at the time specified by the song metadata's playData.previewEnd time, but on reflection it would actually be easier to make the fade start at that time, and then restart the song once the fade is done.

I had a lot of trouble because I was trying to make the fade out end at the specified time, which required doing a lot of additional math and checks. Might work on this myself later.

EDIT: Of note, there is a related issue in which FlxPartialSound relies on PERCENTAGES of total song duration, rather than timestamps, and provides no easy means of conversion.