Browse Source

Merge pull request #70515 from stmSi/fix-hanging-audio-pitch-scale

Fix hanging if audiostream's pitch_scale is NaN
Rémi Verschelde 2 years ago
parent
commit
9583c20171

+ 1 - 1
scene/2d/audio_stream_player_2d.cpp

@@ -234,7 +234,7 @@ float AudioStreamPlayer2D::get_volume_db() const {
 }
 }
 
 
 void AudioStreamPlayer2D::set_pitch_scale(float p_pitch_scale) {
 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;
 	pitch_scale = p_pitch_scale;
 	for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
 	for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
 		AudioServer::get_singleton()->set_playback_pitch_scale(playback, p_pitch_scale);
 		AudioServer::get_singleton()->set_playback_pitch_scale(playback, p_pitch_scale);

+ 1 - 1
scene/3d/audio_stream_player_3d.cpp

@@ -559,7 +559,7 @@ float AudioStreamPlayer3D::get_max_db() const {
 }
 }
 
 
 void AudioStreamPlayer3D::set_pitch_scale(float p_pitch_scale) {
 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;
 	pitch_scale = p_pitch_scale;
 }
 }
 
 

+ 1 - 1
scene/audio/audio_stream_player.cpp

@@ -111,7 +111,7 @@ float AudioStreamPlayer::get_volume_db() const {
 }
 }
 
 
 void AudioStreamPlayer::set_pitch_scale(float p_pitch_scale) {
 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;
 	pitch_scale = p_pitch_scale;
 
 
 	for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
 	for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {

+ 1 - 1
servers/audio/effects/audio_effect_pitch_shift.cpp

@@ -309,7 +309,7 @@ Ref<AudioEffectInstance> AudioEffectPitchShift::instantiate() {
 }
 }
 
 
 void AudioEffectPitchShift::set_pitch_scale(float p_pitch_scale) {
 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;
 	pitch_scale = p_pitch_scale;
 }
 }