Skip to content

Commit

Permalink
Merge pull request #90861 from aaronp64/audio_stream_player_nan
Browse files Browse the repository at this point in the history
Check for NaN in `set_volume_db` functions
  • Loading branch information
akien-mga committed Apr 19, 2024
2 parents 21140aa + 58931c0 commit e34399c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions scene/2d/audio_stream_player_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions scene/3d/audio_stream_player_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions scene/audio/audio_stream_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e34399c

Please sign in to comment.