summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/audio_stream.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index d7b2c2c5e0..6048c47347 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -76,7 +76,14 @@ 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];
- _mix_internal(internal_buffer + 4, INTERNAL_BUFFER_LEN);
+ if (is_playing()) {
+ _mix_internal(internal_buffer + 4, INTERNAL_BUFFER_LEN);
+ } else {
+ //fill with silence, not playing
+ for (int i = 0; i < INTERNAL_BUFFER_LEN; ++i) {
+ internal_buffer[i + 4] = AudioFrame(0, 0);
+ }
+ }
mix_offset -= (INTERNAL_BUFFER_LEN << FP_BITS);
}
}