summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/audio_stream.cpp2
-rw-r--r--servers/audio/audio_stream.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 618ebd526d..eef8aba0c4 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -138,7 +138,7 @@ void AudioStreamPlaybackMicrophone::_mix_internal(AudioFrame *p_buffer, int p_fr
unsigned int input_size = AudioDriver::get_singleton()->get_input_size();
// p_frames is multipled by two since an AudioFrame is stereo
- if ((p_frames * 2) > input_size) {
+ if ((p_frames + MICROPHONE_PLAYBACK_DELAY * 2) > input_size) {
for (int i = 0; i < p_frames; i++) {
p_buffer[i] = AudioFrame(0.0f, 0.0f);
}
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index f0f756129e..66e1b6ee2f 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -122,6 +122,8 @@ class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled {
GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlayback)
friend class AudioStreamMicrophone;
+ const int MICROPHONE_PLAYBACK_DELAY = 256;
+
bool active;
unsigned int input_ofs;