#Audio Completely Cutting Out When Tweening Volume

1 messages · Page 1 of 1 (latest)

civic beacon
#

Hello! I know this is a small piece of code out of a larger script, but I'm positive my issue lies in the chunk in the picture and I'll try my best to explain. This function is intended to fade individual instruments (AudioStreamPlayer, here called player) using a tween. Normally when this function is triggered, it works as I expect it to, but sometimes it causes all audio in the game to cut out for about a second before starting back up again. I have tried removing the tween and setting the volume directly and this issue no longer occurs. I also have a system in place to check if a tween is currently occurring with the given player and to wait til that tween is finished to start a new one. Does anybody have a clue why the audio is cutting out? I can give more details if needed, thank you!

chilly kernel
#

Can you try using tween_method instead? I thought I remembered that working better

civic beacon
#

And just create a method that sets the volume_db?

chilly kernel
civic beacon
#

That works like a charm, thank you so much! I guess it makes sense that decibels don't fade very well linearly. I had no idea that you could declare functions in-line like that either