diff options
author | Marcelo Fernandez <marcelofg55@gmail.com> | 2017-08-29 16:47:44 -0300 |
---|---|---|
committer | Marcelo Fernandez <marcelofg55@gmail.com> | 2017-09-01 11:12:13 -0300 |
commit | f231eadc9e2487c70db04f912578ec853f11737c (patch) | |
tree | 4e41ad5a1608dcb0f77e21c312c46d0a26613399 /servers/audio_server.cpp | |
parent | 06d7e36898d274c2403dcfbe5a83a9d858af0661 (diff) | |
download | redot-engine-f231eadc9e2487c70db04f912578ec853f11737c.tar.gz |
Corrections to audio buffer size calculations
Diffstat (limited to 'servers/audio_server.cpp')
-rw-r--r-- | servers/audio_server.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index c0343399c3..3139c6bb7a 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -155,6 +155,29 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) { todo -= to_copy; to_mix -= to_copy; } + +#ifdef DEBUG_ENABLED + if (OS::get_singleton() && OS::get_singleton()->is_stdout_verbose()) { + static uint64_t first_ticks = 0; + static uint64_t last_ticks = 0; + static uint64_t ticks = 0; + static int count = 0; + static int total = 0; + + ticks = OS::get_singleton()->get_ticks_msec(); + if ((ticks - first_ticks) > 10 * 1000) { + print_line("Audio Driver " + String(AudioDriver::get_singleton()->get_name()) + " average latency: " + itos(total / count) + "ms (frame=" + itos(p_frames) + ")"); + first_ticks = ticks; + total = 0; + count = 0; + } + + total += ticks - last_ticks; + count++; + + last_ticks = ticks; + } +#endif } void AudioServer::_mix_step() { |