summaryrefslogtreecommitdiff
path: root/servers/audio/effects
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 /servers/audio/effects
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 'servers/audio/effects')
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.cpp6
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp
index ddd0a0db6b..c6d1217308 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.cpp
+++ b/servers/audio/effects/audio_effect_pitch_shift.cpp
@@ -305,9 +305,9 @@ Ref<AudioEffectInstance> AudioEffectPitchShift::instance() {
return ins;
}
-void AudioEffectPitchShift::set_pitch_scale(float p_adjust) {
-
- pitch_scale = p_adjust;
+void AudioEffectPitchShift::set_pitch_scale(float p_pitch_scale) {
+ ERR_FAIL_COND(p_pitch_scale <= 0.0);
+ pitch_scale = p_pitch_scale;
}
float AudioEffectPitchShift::get_pitch_scale() const {
diff --git a/servers/audio/effects/audio_effect_pitch_shift.h b/servers/audio/effects/audio_effect_pitch_shift.h
index f1c78d752f..78f92a0261 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.h
+++ b/servers/audio/effects/audio_effect_pitch_shift.h
@@ -100,7 +100,7 @@ protected:
public:
Ref<AudioEffectInstance> instance();
- void set_pitch_scale(float p_adjust);
+ void set_pitch_scale(float p_pitch_scale);
float get_pitch_scale() const;
AudioEffectPitchShift();