Restrict set_pitch_scale to positive scales for AudioStreamPlayer*

Fixes #20459.

Co-authored-by: Tiago José Sousa Magalhães <crakylps@gmail.com>
This commit is contained in:
Chaosus 2018-08-20 11:25:48 +03:00 committed by Rémi Verschelde
parent a3fe19dd10
commit 27731a86d2
5 changed files with 7 additions and 4 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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();