mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Merge pull request #78013 from Calinou/cli-add-audio-output-latency-argument
Add a `--audio-output-latency` command-line argument
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -131,7 +131,7 @@ Error AudioDriverCoreAudio::init() {
|
||||
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &strdesc, sizeof(strdesc));
|
||||
ERR_FAIL_COND_V(result != noErr, FAILED);
|
||||
|
||||
int latency = GLOBAL_GET("audio/driver/output_latency");
|
||||
int latency = Engine::get_singleton()->get_audio_output_latency();
|
||||
// Sample rate is independent of channels (ref: https://stackoverflow.com/questions/11048825/audio-sample-frequency-rely-on-channels)
|
||||
buffer_frames = closest_power_of_2(latency * mix_rate / 1000);
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ Error AudioDriverPulseAudio::init_output_device() {
|
||||
break;
|
||||
}
|
||||
|
||||
int tmp_latency = GLOBAL_GET("audio/driver/output_latency");
|
||||
int tmp_latency = Engine::get_singleton()->get_audio_output_latency();
|
||||
buffer_frames = closest_power_of_2(tmp_latency * mix_rate / 1000);
|
||||
pa_buffer_size = buffer_frames * pa_map.channels;
|
||||
|
||||
|
||||
@@ -555,7 +555,7 @@ Error AudioDriverWASAPI::finish_input_device() {
|
||||
Error AudioDriverWASAPI::init() {
|
||||
mix_rate = _get_configured_mix_rate();
|
||||
|
||||
target_latency_ms = GLOBAL_GET("audio/driver/output_latency");
|
||||
target_latency_ms = Engine::get_singleton()->get_audio_output_latency();
|
||||
|
||||
Error err = init_output_device();
|
||||
if (err != OK) {
|
||||
|
||||
@@ -45,7 +45,7 @@ Error AudioDriverXAudio2::init() {
|
||||
speaker_mode = SPEAKER_MODE_STEREO;
|
||||
channels = 2;
|
||||
|
||||
int latency = GLOBAL_GET("audio/driver/output_latency");
|
||||
int latency = Engine::get_singleton()->get_audio_output_latency();
|
||||
buffer_size = closest_power_of_2(latency * mix_rate / 1000);
|
||||
|
||||
samples_in = memnew_arr(int32_t, buffer_size * channels);
|
||||
|
||||
Reference in New Issue
Block a user