Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --audio-output-latency command line argument to override the audio mix latency on any project #5450

Closed
Calinou opened this issue Sep 18, 2022 · 2 comments · Fixed by godotengine/godot#78013
Milestone

Comments

@Calinou
Copy link
Member

Calinou commented Sep 18, 2022

Related to #1923, #5448 and #5449.

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

This is a continuation of godotengine/godot-docs#6186 (except it's about audio latency, rather than visual latency).

When playing a game made by someone else, it's sometimes desired to override the audio output latency if the developer doesn't provide any way to control it. This is common in gamejam games, for instance.

If you have a CPU with fast single-core performance, you can often decrease audio latency significantly without introducing audio stutter or popping. Games' default configurations have to work well on low-end CPUs, so it's not uncommon to be able to divide a game's audio latency by 2 or even 3 in commercially released games simply by reducing the output latency setting.

This is particularly important in rythm games, but also in any kind of competitive game where acknowledging sound cues as early as possible can give you an advantage. See this video for more information.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I propose adding a --audio-output-latency <ms> CLI argument that handles overall V-Sync status when the project starts:

  --audio-output-latency <ms>    Audio buffer length in milliseconds. Lower values result in less lag but can introduce popping if the CPU can't keep up.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

main/main.cpp should be modified to accomodate for the new CLI argument.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

It can technically be an add-on, but the point here is that this functionality must be built-in to achieve the desired goal (which is, adjusting audio output latency on any project made with Godot).

@ellenhp
Copy link

ellenhp commented Jun 9, 2023

A starting point would be adding the ability for the latency to be adjusted in the first place. Right now the mix buffer is fixed in size so we'd need to change that first.

edit: to be clear I fully support this proposal :)

@Calinou
Copy link
Member Author

Calinou commented Jun 9, 2023

A starting point would be adding the ability for the latency to be adjusted in the first place. Right now the mix buffer is fixed in size so we'd need to change that first.

Yes, I agree it should be possible to do this at run-time somehow. I've seen some games be able to do this without requiring a restart of their audio subsystem (e.g. snd_restart in Source games), but I don't know how they achieve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants