Merge pull request #90861 from aaronp64/audio_stream_player_nan

Check for NaN in `set_volume_db` functions
This commit is contained in:
Rémi Verschelde 2024-04-19 16:28:11 +02:00
commit e34399cdcb
No known key found for this signature in database
GPG Key ID: C3336907360768E1
3 changed files with 3 additions and 0 deletions

View File

@ -196,6 +196,7 @@ Ref<AudioStream> AudioStreamPlayer2D::get_stream() const {
}
void AudioStreamPlayer2D::set_volume_db(float p_volume) {
ERR_FAIL_COND_MSG(Math::is_nan(p_volume), "Volume can't be set to NaN.");
internal->volume_db = p_volume;
}

View File

@ -496,6 +496,7 @@ Ref<AudioStream> AudioStreamPlayer3D::get_stream() const {
}
void AudioStreamPlayer3D::set_volume_db(float p_volume) {
ERR_FAIL_COND_MSG(Math::is_nan(p_volume), "Volume can't be set to NaN.");
internal->volume_db = p_volume;
}

View File

@ -59,6 +59,7 @@ Ref<AudioStream> AudioStreamPlayer::get_stream() const {
}
void AudioStreamPlayer::set_volume_db(float p_volume) {
ERR_FAIL_COND_MSG(Math::is_nan(p_volume), "Volume can't be set to NaN.");
internal->volume_db = p_volume;
Vector<AudioFrame> volume_vector = _get_volume_vector();