mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-24 10:24:55 +00:00
Revert "Remove g_settings.audio.block_frames - never used"
This reverts commit 9ed3f3847c608b26c792c6dcbc3711ed946226b3.
This commit is contained in:
parent
ddf0dcb165
commit
d476f0df91
@ -172,6 +172,13 @@ public final class UserPreferences
|
||||
int optimalRate = getOptimalSamplingRate(ctx);
|
||||
config.setInt("audio_out_rate", optimalRate);
|
||||
|
||||
// Refactor this entire mess and make this usable for per-core config
|
||||
if (Build.VERSION.SDK_INT >= 17 && prefs.getBoolean("audio_latency_auto", true))
|
||||
{
|
||||
int buffersize = getLowLatencyBufferSize(ctx);
|
||||
config.setInt("audio_block_frames", buffersize);
|
||||
}
|
||||
|
||||
config.setBoolean("audio_enable", prefs.getBoolean("audio_enable", true));
|
||||
config.setBoolean("video_smooth", prefs.getBoolean("video_smooth", true));
|
||||
config.setBoolean("video_allow_rotate", prefs.getBoolean("video_allow_rotate", true));
|
||||
@ -406,6 +413,23 @@ public final class UserPreferences
|
||||
.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the optimal buffer size for low-latency audio playback.
|
||||
*
|
||||
* @param ctx the current {@link Context}.
|
||||
*
|
||||
* @return the optimal output buffer size in decimal PCM frames.
|
||||
*/
|
||||
@TargetApi(17)
|
||||
private static int getLowLatencyBufferSize(Context ctx)
|
||||
{
|
||||
AudioManager manager = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE);
|
||||
int buffersize = Integer.parseInt(manager
|
||||
.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER));
|
||||
Log.i(TAG, "Queried ideal buffer size (frames): " + buffersize);
|
||||
return buffersize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the optimal audio sampling rate.
|
||||
* <p>
|
||||
|
@ -249,6 +249,7 @@ struct settings
|
||||
char driver[32];
|
||||
bool enable;
|
||||
unsigned out_rate;
|
||||
unsigned block_frames;
|
||||
float in_rate;
|
||||
char device[PATH_MAX];
|
||||
unsigned latency;
|
||||
|
@ -315,6 +315,7 @@ void config_set_defaults(void)
|
||||
|
||||
g_settings.audio.enable = audio_enable;
|
||||
g_settings.audio.out_rate = out_rate;
|
||||
g_settings.audio.block_frames = 0;
|
||||
g_settings.audio.in_rate = out_rate;
|
||||
if (audio_device)
|
||||
strlcpy(g_settings.audio.device, audio_device, sizeof(g_settings.audio.device));
|
||||
@ -966,6 +967,7 @@ bool config_load_file(const char *path, bool set_defaults)
|
||||
// Audio settings.
|
||||
CONFIG_GET_BOOL(audio.enable, "audio_enable");
|
||||
CONFIG_GET_INT(audio.out_rate, "audio_out_rate");
|
||||
CONFIG_GET_INT(audio.block_frames, "audio_block_frames");
|
||||
CONFIG_GET_STRING(audio.device, "audio_device");
|
||||
CONFIG_GET_INT(audio.latency, "audio_latency");
|
||||
CONFIG_GET_BOOL(audio.sync, "audio_sync");
|
||||
@ -1358,6 +1360,7 @@ bool config_save_file(const char *path)
|
||||
#endif
|
||||
config_set_int(conf, "audio_latency", g_settings.audio.latency);
|
||||
config_set_bool(conf, "audio_sync", g_settings.audio.sync);
|
||||
config_set_int(conf, "audio_block_frames", g_settings.audio.block_frames);
|
||||
config_set_int(conf, "rewind_granularity", g_settings.rewind_granularity);
|
||||
config_set_path(conf, "video_shader", g_settings.video.shader_path);
|
||||
config_set_bool(conf, "video_shader_enable", g_settings.video.shader_enable);
|
||||
|
@ -632,6 +632,7 @@ const rarch_setting_t* setting_data_get_list(void)
|
||||
CONFIG_UINT(g_settings.audio.latency, "audio_latency", "Latency", g_defaults.settings.out_latency)
|
||||
CONFIG_BOOL(g_settings.audio.rate_control, "audio_rate_control", "Enable Rate Control", rate_control)
|
||||
CONFIG_FLOAT(g_settings.audio.rate_control_delta, "audio_rate_control_delta", "Rate Control Delta", rate_control_delta)
|
||||
CONFIG_UINT(g_settings.audio.block_frames, "audio_block_frames", "Block Frames", DEFAULT_ME_YO)
|
||||
END_SUB_GROUP()
|
||||
|
||||
WITH_FEATURE(SD_FEATURE_AUDIO_DEVICE) START_SUB_GROUP("Misc")
|
||||
|
Loading…
x
Reference in New Issue
Block a user