Skip to content

If AudioStream is playing with NaN VolumeDb value, whole audio doesn't work. No errors displayed. #88133

Closed
@merksk8

Description

@merksk8

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 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.

Minimal reproduction project (MRP)

AudioStreamBug.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions