Closed
Description
Tested versions
- Reproducible in 4.2.1-stable_mono_win64
- Reproducible in 4.2.2-rc1_mono_win64
- Reproducible in 4.3-dev3_mono_win64
System information
Godot v4.2.1.stable.mono - Windows 10.0.19044 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.5123) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)
Issue description
If an AudioStreamPlayer
, AudioStreamPlayer2D
or AudioStreamPlayer3D
is playing with an invalid VolumeDb
float value ( NaN ), the whole audio stops working. There's no error displayed anywhere, so it can be confusing to find the reason. It seems to happen only if this invalid audio is playing before anything else is playing.
This can be a problem since giving a negative value to Mathf.LinearToDb( float value )
returns a float.NaN
, and it can be a common mistake. Since there's no error given, finding this error can be hard.
Possible solutions could be:
- Displaying an error when an
AudioStreamPlayer
,AudioStreamPlayer2D
orAudioStreamPlayer3D
has an invalidVolumeDb
value - Preventing
AudioStreamPlayer
,AudioStreamPlayer2D
andAudioStreamPlayer3D
to have an invalidVolumeDb
value - Preventing to play the
AudioStreamPlayer
,AudioStreamPlayer2D
andAudioStreamPlayer3D
ifVolumeDb
is not a validVolumeDb
value
Steps to reproduce
- Create a new project and a new scene
- Add two
AudioStreamPlayer
,AudioStreamPlayer2D
orAudioStreamPlayer3D
- Assign one loop audio to the first one.
- Set the
VolumeDb
from script to a NaN value - Play the audio
- Here the audio doesn't play, but the node stills try to play it infinitely. From here audio doesn't work even if it's played from another node.