You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 or AudioStreamPlayer3D has an invalid VolumeDb value
Preventing AudioStreamPlayer, AudioStreamPlayer2D and AudioStreamPlayer3D to have an invalid VolumeDb value
Preventing to play the AudioStreamPlayer, AudioStreamPlayer2D and AudioStreamPlayer3D if VolumeDb is not a valid VolumeDb value
Steps to reproduce
Create a new project and a new scene
Add two AudioStreamPlayer, AudioStreamPlayer2D or AudioStreamPlayer3D
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.
Added check in AudioStreamPlayer, AudioStreamPlayer2D, and AudioStreamPlayer3D set_volume_db functions to prevent setting volume to NaN, and give an error. Using NaN for volume and playing the AudioStreamPlayer could prevent all audio from playing, even from other AudioStreamPlayers.
Fixesgodotengine#88133
theromis
pushed a commit
to theromis/godot
that referenced
this issue
Apr 29, 2024
Added check in AudioStreamPlayer, AudioStreamPlayer2D, and AudioStreamPlayer3D set_volume_db functions to prevent setting volume to NaN, and give an error. Using NaN for volume and playing the AudioStreamPlayer could prevent all audio from playing, even from other AudioStreamPlayers.
Fixesgodotengine#88133
dimitry-
pushed a commit
to AndroidWasm/godot
that referenced
this issue
May 16, 2024
Added check in AudioStreamPlayer, AudioStreamPlayer2D, and AudioStreamPlayer3D set_volume_db functions to prevent setting volume to NaN, and give an error. Using NaN for volume and playing the AudioStreamPlayer could prevent all audio from playing, even from other AudioStreamPlayers.
Fixesgodotengine#88133
MewPurPur
pushed a commit
to MewPurPur/godot
that referenced
this issue
Jul 11, 2024
Added check in AudioStreamPlayer, AudioStreamPlayer2D, and AudioStreamPlayer3D set_volume_db functions to prevent setting volume to NaN, and give an error. Using NaN for volume and playing the AudioStreamPlayer could prevent all audio from playing, even from other AudioStreamPlayers.
Fixesgodotengine#88133
Tested versions
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
orAudioStreamPlayer3D
is playing with an invalidVolumeDb
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 afloat.NaN
, and it can be a common mistake. Since there's no error given, finding this error can be hard.Possible solutions could be:
AudioStreamPlayer
,AudioStreamPlayer2D
orAudioStreamPlayer3D
has an invalidVolumeDb
valueAudioStreamPlayer
,AudioStreamPlayer2D
andAudioStreamPlayer3D
to have an invalidVolumeDb
valueAudioStreamPlayer
,AudioStreamPlayer2D
andAudioStreamPlayer3D
ifVolumeDb
is not a validVolumeDb
valueSteps to reproduce
AudioStreamPlayer
,AudioStreamPlayer2D
orAudioStreamPlayer3D
VolumeDb
from script to a NaN valueMinimal reproduction project (MRP)
AudioStreamBug.zip
The text was updated successfully, but these errors were encountered: