Add a --audio-output-latency command-line argument

This allows optimizing the audio output latency on higher-end CPUs,
especially in projects that do not expose a way to override this setting.
This commit is contained in:
Hugo Locurcio
2023-06-08 19:46:05 +02:00
parent 281b7b9fdf
commit 6f1152bdbe
17 changed files with 46 additions and 12 deletions
+1 -1
View File
@@ -111,7 +111,7 @@ Error AudioDriverALSA::init_output_device() {
// In ALSA the period size seems to be the one that will determine the actual latency
// Ref: https://www.alsa-project.org/main/index.php/FramesPeriods
unsigned int periods = 2;
int latency = GLOBAL_GET("audio/driver/output_latency");
int latency = Engine::get_singleton()->get_audio_output_latency();
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
buffer_size = buffer_frames * periods;
period_size = buffer_frames;