summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorChaosus <chaosus89@gmail.com>2018-08-20 11:25:48 +0300
committerRémi Verschelde <rverschelde@gmail.com>2018-08-22 00:11:53 +0200
commit27731a86d2003e0b98a217d191dc7e180ddf043b (patch)
treec29621e317f4d944d2c26b4b427988d0345bbe62 /scene
parenta3fe19dd109c1d689d74e14ba6ff60929653d4c9 (diff)
Restrict set_pitch_scale to positive scales for AudioStreamPlayer*
Fixes #20459. Co-authored-by: Tiago José Sousa Magalhães <crakylps@gmail.com>
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/audio_stream_player_2d.cpp1
-rw-r--r--scene/3d/audio_stream_player_3d.cpp1
-rw-r--r--scene/audio/audio_player.cpp1
3 files changed, 3 insertions, 0 deletions
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index 507499a324..559e041dbf 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -296,6 +296,7 @@ float AudioStreamPlayer2D::get_volume_db() const {
}
void AudioStreamPlayer2D::set_pitch_scale(float p_pitch_scale) {
+ 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 5f0ac3dd80..8504a18f54 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -626,6 +626,7 @@ float AudioStreamPlayer3D::get_max_db() const {
}
void AudioStreamPlayer3D::set_pitch_scale(float p_pitch_scale) {
+ 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_player.cpp b/scene/audio/audio_player.cpp
index 863b278b62..7a9f2bd8d0 100644
--- a/scene/audio/audio_player.cpp
+++ b/scene/audio/audio_player.cpp
@@ -192,6 +192,7 @@ float AudioStreamPlayer::get_volume_db() const {
}
void AudioStreamPlayer::set_pitch_scale(float p_pitch_scale) {
+ ERR_FAIL_COND(p_pitch_scale <= 0.0);
pitch_scale = p_pitch_scale;
}
float AudioStreamPlayer::get_pitch_scale() const {