1
0
Fork 0

Merge pull request #99734 from Mickeon/audio-stream-player-3d-seek-fix

Fix code consistency between AudioStreamPlayer2D and AudioStreamPlayer3D
This commit is contained in:
Rémi Verschelde 2024-11-29 22:02:29 +01:00
commit 08b931b656
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 2 additions and 5 deletions

View File

@ -553,7 +553,7 @@ void AudioStreamPlayer3D::play(float p_from_pos) {
setplay.set(p_from_pos); setplay.set(p_from_pos);
// Sample handling. // 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(); Ref<AudioSamplePlayback> sample_playback = stream_playback->get_sample_playback();
sample_playback->offset = p_from_pos; sample_playback->offset = p_from_pos;
sample_playback->bus = _get_actual_bus(); sample_playback->bus = _get_actual_bus();
@ -563,10 +563,7 @@ void AudioStreamPlayer3D::play(float p_from_pos) {
} }
void AudioStreamPlayer3D::seek(float p_seconds) { void AudioStreamPlayer3D::seek(float p_seconds) {
if (is_playing()) { internal->seek(p_seconds);
stop();
play(p_seconds);
}
} }
void AudioStreamPlayer3D::stop() { void AudioStreamPlayer3D::stop() {