Hello. I've recently used this plugin on a project, and came across some limitations of the AutoLayer container. Thus I edited it a bit to obtain what I needed. I think those changes could benefit other users:
Fade-out takes track_speed into account to be (approximately) the same length as the fade- in
Both AutoLayer and AutoFade initialize the AudioStreamPlayers volumes on _ready, so that there isn't an immediate fade-out when the song starts
Fixed the volume calculation according to ranges in AutoFade, and set default values for ranges
Some remarks:
The fade-out I implemented doesn't follow exactly the same curve as the fade-in. It would require a reversed logarithm, which is quite tricky to compute giving how the volume is updated at each beat. Instead I opted for a linear function that feels close to the fade-in. When the fade-in is slow, so is the fade-out, etc… It's not perfect, but at least it prevents having always a constant slow fade out.
Using tween for fading would be much more efficient than updating the volume on the beat, and would ensure a symmetry. However that would take a bit more time to implement. This PR is mostly a quick fix.
I marked the functions init_layers and init_volume as public by choice. It seems reasonable that a dev would need to "reset" the layers at some point (if layers are dynamically calculated before the start of the song, or if the song is stopped and played later, etc…). Another solution would be for the MixingDesk to call these functions when it starts a song, maybe by emitting a signal.
I had a lot of trouble figuring out what Min Range and Max Range were for and how to use them (for both auto containers), even after reading the code! Now that I see what they do, I'm not sure a lot of people will want to use them. Sure it's a neat system, but it's way too specific and confusing. Most users will just want to fade in and out some layers, and add their own logic on top. On AutoFade especially, I think toggle should be the default mode. However that being said…
AutoFadeContainer does basically the same thing as AutoLayerContainer, except that it's harder to use and can only have one layer. I suggest to remove it, as it brings too much confusion and redundancy. Most users will want to use the AutoLayer to do vertical layering with fading, by just selecting the layers they want and the length of the fading.
That being say thank you for this plugin! Dynamic music is tricky to implement, and I'm glad that there is now a tool for that in Godot.
Hello. I've recently used this plugin on a project, and came across some limitations of the AutoLayer container. Thus I edited it a bit to obtain what I needed. I think those changes could benefit other users:
track_speed
into account to be (approximately) the same length as the fade- in_ready
, so that there isn't an immediate fade-out when the song startsSome remarks:
init_layers
andinit_volume
as public by choice. It seems reasonable that a dev would need to "reset" the layers at some point (if layers are dynamically calculated before the start of the song, or if the song is stopped and played later, etc…). Another solution would be for the MixingDesk to call these functions when it starts a song, maybe by emitting a signal.Min Range
andMax Range
were for and how to use them (for both auto containers), even after reading the code! Now that I see what they do, I'm not sure a lot of people will want to use them. Sure it's a neat system, but it's way too specific and confusing. Most users will just want to fade in and out some layers, and add their own logic on top. On AutoFade especially, I thinktoggle
should be the default mode. However that being said…That being say thank you for this plugin! Dynamic music is tricky to implement, and I'm glad that there is now a tool for that in Godot.