Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #76797
merksk8 opened this issue Feb 9, 2024 · 0 comments · Fixed by #90861
Closed
Tracked by #76797

Comments

@merksk8
Copy link

merksk8 commented Feb 9, 2024

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

@akien-mga akien-mga added this to the 4.3 milestone Apr 19, 2024
divshekhar pushed a commit to divshekhar/godot that referenced this issue Apr 23, 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.

Fixes godotengine#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.

Fixes godotengine#88133
ev1313 pushed a commit to ev1313/godot that referenced this issue May 8, 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.

Fixes godotengine#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.

Fixes godotengine#88133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants