diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-12-19 18:55:43 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-19 18:55:43 -0300 |
commit | 85f5953d5a0e6c1c1e5066b486e809e529a86889 (patch) | |
tree | 3c3ee2c549d8521d84ffaf631e60425db59e1928 /servers/audio/audio_stream.cpp | |
parent | fc103566e677493b7ecde44b8ccea3f40b5a01ec (diff) | |
parent | 139daf0e035645054129b9e31a188721fea0973a (diff) |
Merge pull request #14787 from hpvb/dont-try-to-mix-ended-sample
Don't try to mix a sample that has already ended
Diffstat (limited to 'servers/audio/audio_stream.cpp')
-rw-r--r-- | servers/audio/audio_stream.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index d7b2c2c5e0..15d4a11223 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -76,6 +76,13 @@ void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale, internal_buffer[1] = internal_buffer[INTERNAL_BUFFER_LEN + 1]; internal_buffer[2] = internal_buffer[INTERNAL_BUFFER_LEN + 2]; internal_buffer[3] = internal_buffer[INTERNAL_BUFFER_LEN + 3]; + if (!is_playing()) { + for (int i = 4; i < INTERNAL_BUFFER_LEN; ++i) { + internal_buffer[i] = AudioFrame(0, 0); + } + + return; + } _mix_internal(internal_buffer + 4, INTERNAL_BUFFER_LEN); mix_offset -= (INTERNAL_BUFFER_LEN << FP_BITS); } |