From 5d7571114e2621eeda85d3c4784b9dd5df2f8853 Mon Sep 17 00:00:00 2001 From: Kelebek1 Date: Sat, 16 Sep 2023 20:48:45 +0100 Subject: Do not consider voice commands in time estimation, fix adpcm estimate --- src/audio_core/renderer/system.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/audio_core/renderer/system.cpp') diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index d29754634..31f92087c 100644 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp @@ -684,11 +684,11 @@ u64 System::GenerateCommand(std::span in_command_buffer, sink_context, splitter_context, perf_manager}; voice_context.SortInfo(); + command_generator.GenerateVoiceCommands(); const auto start_estimated_time{drop_voice_param * static_cast(command_buffer.estimated_process_time)}; - command_generator.GenerateVoiceCommands(); command_generator.GenerateSubMixCommands(); command_generator.GenerateFinalMixCommands(); command_generator.GenerateSinkCommands(); @@ -708,11 +708,13 @@ u64 System::GenerateCommand(std::span in_command_buffer, const auto end_estimated_time{drop_voice_param * static_cast(command_buffer.estimated_process_time)}; + + const auto dsp_time_limit{((time_limit_percent / 100.0f) * 2'880'000.0f) * + (static_cast(render_time_limit_percent) / 100.0f)}; + const auto estimated_time{start_estimated_time - end_estimated_time}; - const auto time_limit{static_cast( - estimated_time + (((time_limit_percent / 100.0f) * 2'880'000.0) * - (static_cast(render_time_limit_percent) / 100.0f)))}; + const auto time_limit{static_cast(std::max(dsp_time_limit + estimated_time, 0.0f))}; num_voices_dropped = DropVoices(command_buffer, static_cast(start_estimated_time), time_limit); } -- cgit v1.2.3