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:
parent
a3fe19dd10
commit
27731a86d2
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue