From 9b65e9df6abd10d22a7f635ecb739db2e873ec64 Mon Sep 17 00:00:00 2001 From: stmSi Date: Sat, 24 Dec 2022 12:34:22 +0630 Subject: [PATCH] Fix Editor hanging if audiostream's pitch_scale is NaN --- scene/2d/audio_stream_player_2d.cpp | 2 +- scene/3d/audio_stream_player_3d.cpp | 2 +- scene/audio/audio_stream_player.cpp | 2 +- servers/audio/effects/audio_effect_pitch_shift.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index ba3c1056c..d2c45b239 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -324,7 +324,7 @@ float AudioStreamPlayer2D::get_volume_db() const { } void AudioStreamPlayer2D::set_pitch_scale(float p_pitch_scale) { - ERR_FAIL_COND(p_pitch_scale <= 0.0); + ERR_FAIL_COND(!(p_pitch_scale > 0.0)); pitch_scale = p_pitch_scale; } float AudioStreamPlayer2D::get_pitch_scale() const { diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 02ee4a39b..517027abc 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -684,7 +684,7 @@ float AudioStreamPlayer3D::get_max_db() const { } void AudioStreamPlayer3D::set_pitch_scale(float p_pitch_scale) { - ERR_FAIL_COND(p_pitch_scale <= 0.0); + ERR_FAIL_COND(!(p_pitch_scale > 0.0)); pitch_scale = p_pitch_scale; } float AudioStreamPlayer3D::get_pitch_scale() const { diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp index 675144e6c..1dc8137fb 100644 --- a/scene/audio/audio_stream_player.cpp +++ b/scene/audio/audio_stream_player.cpp @@ -231,7 +231,7 @@ float AudioStreamPlayer::get_volume_db() const { } void AudioStreamPlayer::set_pitch_scale(float p_pitch_scale) { - ERR_FAIL_COND(p_pitch_scale <= 0.0); + ERR_FAIL_COND(!(p_pitch_scale > 0.0)); pitch_scale = p_pitch_scale; } float AudioStreamPlayer::get_pitch_scale() const { diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp index 597a85518..6def92085 100644 --- a/servers/audio/effects/audio_effect_pitch_shift.cpp +++ b/servers/audio/effects/audio_effect_pitch_shift.cpp @@ -310,7 +310,7 @@ Ref AudioEffectPitchShift::instance() { } void AudioEffectPitchShift::set_pitch_scale(float p_pitch_scale) { - ERR_FAIL_COND(p_pitch_scale <= 0.0); + ERR_FAIL_COND(!(p_pitch_scale > 0.0)); pitch_scale = p_pitch_scale; }