summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-17 14:06:55 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-17 14:06:55 +0100
commit9583c201716be4961d898a3daab20337f893b97c (patch)
tree2564cd0cdfd87451bb8873bc18a1f0f981b1a317
parent1e3f42fccbf680f9e8d70af5ff114373d5e4ebab (diff)
parent20416169347ee2c365f01f6d7987dd78315488d5 (diff)
Merge pull request #70515 from stmSi/fix-hanging-audio-pitch-scale
Fix hanging if audiostream's pitch_scale is NaN
-rw-r--r--scene/2d/audio_stream_player_2d.cpp2
-rw-r--r--scene/3d/audio_stream_player_3d.cpp2
-rw-r--r--scene/audio/audio_stream_player.cpp2
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.cpp2
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 902fba38bf..c175edb6cb 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/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) {
- ERR_FAIL_COND(p_pitch_scale <= 0.0);
+ ERR_FAIL_COND(!(p_pitch_scale > 0.0));
pitch_scale = p_pitch_scale;
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
AudioServer::get_singleton()->set_playback_pitch_scale(playback, p_pitch_scale);
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index 77bf15125e..ac626d0d2a 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/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) {
- ERR_FAIL_COND(p_pitch_scale <= 0.0);
+ ERR_FAIL_COND(!(p_pitch_scale > 0.0));
pitch_scale = p_pitch_scale;
}
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index 7533a56b59..6c37d6f81d 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/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) {
- ERR_FAIL_COND(p_pitch_scale <= 0.0);
+ ERR_FAIL_COND(!(p_pitch_scale > 0.0));
pitch_scale = p_pitch_scale;
for (Ref<AudioStreamPlayback> &playback : stream_playbacks) {
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp
index 2693b2a56a..11c1d44472 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.cpp
+++ b/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) {
- ERR_FAIL_COND(p_pitch_scale <= 0.0);
+ ERR_FAIL_COND(!(p_pitch_scale > 0.0));
pitch_scale = p_pitch_scale;
}