Skip to content

Commit

Permalink
Fix code consistency between AudioStreamPlayer2D and AudioStreamPlayer3D
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickeon committed Nov 27, 2024
1 parent bbc5469 commit 06bb994
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions scene/3d/audio_stream_player_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ void AudioStreamPlayer3D::play(float p_from_pos) {
setplay.set(p_from_pos);

// Sample handling.
if (stream_playback->get_is_sample()) {
if (stream_playback->get_is_sample() && stream_playback->get_sample_playback().is_valid()) {
Ref<AudioSamplePlayback> sample_playback = stream_playback->get_sample_playback();
sample_playback->offset = p_from_pos;
sample_playback->bus = _get_actual_bus();
Expand All @@ -563,10 +563,7 @@ void AudioStreamPlayer3D::play(float p_from_pos) {
}

void AudioStreamPlayer3D::seek(float p_seconds) {
if (is_playing()) {
stop();
play(p_seconds);
}
internal->seek(p_seconds);
}

void AudioStreamPlayer3D::stop() {
Expand Down

0 comments on commit 06bb994

Please sign in to comment.