summaryrefslogtreecommitdiffstats
path: root/src/audio_core/renderer
diff options
context:
space:
mode:
authorKelebek1 <eeeedddccc@hotmail.co.uk>2023-09-16 21:48:45 +0200
committerKelebek1 <eeeedddccc@hotmail.co.uk>2023-09-18 11:38:14 +0200
commit5d7571114e2621eeda85d3c4784b9dd5df2f8853 (patch)
tree4053f4c0e98772f352241db4de2de3287fcdb6b2 /src/audio_core/renderer
parentMerge pull request #11519 from german77/system-policy (diff)
downloadyuzu-5d7571114e2621eeda85d3c4784b9dd5df2f8853.tar
yuzu-5d7571114e2621eeda85d3c4784b9dd5df2f8853.tar.gz
yuzu-5d7571114e2621eeda85d3c4784b9dd5df2f8853.tar.bz2
yuzu-5d7571114e2621eeda85d3c4784b9dd5df2f8853.tar.lz
yuzu-5d7571114e2621eeda85d3c4784b9dd5df2f8853.tar.xz
yuzu-5d7571114e2621eeda85d3c4784b9dd5df2f8853.tar.zst
yuzu-5d7571114e2621eeda85d3c4784b9dd5df2f8853.zip
Diffstat (limited to 'src/audio_core/renderer')
-rw-r--r--src/audio_core/renderer/command/command_processing_time_estimator.cpp4
-rw-r--r--src/audio_core/renderer/system.cpp10
2 files changed, 8 insertions, 6 deletions
diff --git a/src/audio_core/renderer/command/command_processing_time_estimator.cpp b/src/audio_core/renderer/command/command_processing_time_estimator.cpp
index a48a016b1..0f7aff1b4 100644
--- a/src/audio_core/renderer/command/command_processing_time_estimator.cpp
+++ b/src/audio_core/renderer/command/command_processing_time_estimator.cpp
@@ -27,12 +27,12 @@ u32 CommandProcessingTimeEstimatorVersion1::Estimate(
u32 CommandProcessingTimeEstimatorVersion1::Estimate(
const AdpcmDataSourceVersion1Command& command) const {
- return static_cast<u32>(command.pitch * 0.25f * 1.2f);
+ return static_cast<u32>(command.pitch * 0.46f * 1.2f);
}
u32 CommandProcessingTimeEstimatorVersion1::Estimate(
const AdpcmDataSourceVersion2Command& command) const {
- return static_cast<u32>(command.pitch * 0.25f * 1.2f);
+ return static_cast<u32>(command.pitch * 0.46f * 1.2f);
}
u32 CommandProcessingTimeEstimatorVersion1::Estimate(
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<u8> 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<f32>(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<u8> in_command_buffer,
const auto end_estimated_time{drop_voice_param *
static_cast<f32>(command_buffer.estimated_process_time)};
+
+ const auto dsp_time_limit{((time_limit_percent / 100.0f) * 2'880'000.0f) *
+ (static_cast<f32>(render_time_limit_percent) / 100.0f)};
+
const auto estimated_time{start_estimated_time - end_estimated_time};
- const auto time_limit{static_cast<u32>(
- estimated_time + (((time_limit_percent / 100.0f) * 2'880'000.0) *
- (static_cast<f32>(render_time_limit_percent) / 100.0f)))};
+ const auto time_limit{static_cast<u32>(std::max(dsp_time_limit + estimated_time, 0.0f))};
num_voices_dropped =
DropVoices(command_buffer, static_cast<u32>(start_estimated_time), time_limit);
}