mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-04 22:59:49 +00:00
Added SDL_HINT_ANDROID_LOW_LATENCY_AUDIO
This commit is contained in:
@@ -100,6 +100,22 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE"
|
||||
|
||||
/**
|
||||
* A variable to control whether low latency audio should be enabled.
|
||||
*
|
||||
* Some devices have poor quality output when this is enabled, but this is usually an improvement in audio latency.
|
||||
*
|
||||
* The variable can be set to the following values:
|
||||
*
|
||||
* - "0": Low latency audio is not enabled.
|
||||
* - "1": Low latency audio is enabled. (default)
|
||||
*
|
||||
* This hint should be set before SDL audio is initialized.
|
||||
*
|
||||
* \since This hint is available since SDL 3.1.8.
|
||||
*/
|
||||
#define SDL_HINT_ANDROID_LOW_LATENCY_AUDIO "SDL_ANDROID_LOW_LATENCY_AUDIO"
|
||||
|
||||
/**
|
||||
* A variable to control whether we trap the Android back button to handle it
|
||||
* manually.
|
||||
|
||||
@@ -316,7 +316,7 @@ static bool BuildAAudioStream(SDL_AudioDevice *device)
|
||||
ctx.AAudioStreamBuilder_setErrorCallback(builder, AAUDIO_errorCallback, device);
|
||||
ctx.AAudioStreamBuilder_setDataCallback(builder, AAUDIO_dataCallback, device);
|
||||
// Some devices have flat sounding audio when low latency mode is enabled, but this is a better experience for most people
|
||||
if (SDL_GetHintBoolean("SDL_ANDROID_LOW_LATENCY_AUDIO", true)) {
|
||||
if (SDL_GetHintBoolean(SDL_HINT_ANDROID_LOW_LATENCY_AUDIO, true)) {
|
||||
SDL_Log("Low latency audio enabled\n");
|
||||
ctx.AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user