Closed wlsnmrk closed 8 months ago
Hey, thanks! Probably an oversight on my part. I think I was trying to make the music fade correctly and maybe didn't catch this. I think a hard stop is unavoidable if you interrupt it while its still fading, so that's fine. I don't want to mess with the polyphony, but you're welcome to try the other approaches and see what's best.
After the player dies (runs off the level into water), if the "Try Again" menu option is selected to restart the game, the game music doubles. It looks like the old, pre-death music stream keeps playing, while a new one is spun up in response to the game restarting.
Here's a video of the behavior: https://github.com/chickensoft-games/GameDemo/assets/23439518/8a26caa1-c7da-417f-afa9-44712d78e51c
I did a little digging and came up with some possible (simple) fixes, depending on desired behavior:
InGameAudio::StartGameMusic()
to callGameMusic::Stop()
beforeGameMusic::FadeIn()
.Max Polyphony
property of theMainMenuMusic
scene -- which is also used for theGameMusic
node inInGameAudio
-- back to1
(currently4
), to automatically stop the first stream when the new one starts.GameMusic
node specifically, in theInGameAudio
scene.InGameAudio::StartGameMusic()
to skip the call toGameMusic::FadeIn()
ifGameMusic::Playing
is true.I'd be happy to submit a PR if any of those are acceptable! It does seem like both options above for restarting the music would hard-stop the first stream, with no cross-fade.