Added Performance.AUDIO_OUTPUT_LATENCY

This commit is contained in:
Marcelo Fernandez
2018-07-16 22:43:47 -03:00
parent e1f2feec2e
commit 3930e755e4
4 changed files with 20 additions and 0 deletions

View File

@ -234,6 +234,13 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
todo -= to_copy;
to_mix -= to_copy;
}
// Calculate latency for Performance.AUDIO_OUTPUT_LATENCY
if (OS::get_singleton()) {
uint64_t ticks = OS::get_singleton()->get_ticks_usec();
output_latency = (ticks - output_latency_ticks) / 1000000.f;
output_latency_ticks = ticks;
}
}
void AudioServer::_mix_step() {
@ -1178,6 +1185,8 @@ AudioServer::AudioServer() {
mix_frames = 0;
channel_count = 0;
to_mix = 0;
output_latency = 0;
output_latency_ticks = 0;
}
AudioServer::~AudioServer() {