mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-24 05:31:15 +00:00
(Android Phoenix) Set configurable audio latency
This commit is contained in:
parent
e6f527e992
commit
0245f926d1
@ -10,6 +10,18 @@
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="audio_latency_options">
|
||||
<item> 64ms (Low)</item>
|
||||
<item>128ms (Medium)</item>
|
||||
<item>160ms (High)</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="audio_latency_options_values">
|
||||
<item>64</item>
|
||||
<item>128</item>
|
||||
<item>160</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="aspect_ratios">
|
||||
<item>Full screen</item>
|
||||
<item>Auto</item>
|
||||
|
@ -114,11 +114,13 @@
|
||||
android:summary="Enable dynamic rate control (recommended)."
|
||||
android:title="Dynamic Rate Control"
|
||||
android:dependency="audio_enable" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="audio_high_latency"
|
||||
android:summary="Use (very) high latency audio. Necessary for older Android devices with poor audio drivers."
|
||||
android:title="High latency audio"
|
||||
<ListPreference
|
||||
android:entries="@array/audio_latency_options"
|
||||
android:entryValues="@array/audio_latency_options_values"
|
||||
android:defaultValue="64"
|
||||
android:key="audio_latency"
|
||||
android:summary="Set the amount of desired audio latency. Your mileage may vary on the device you are using."
|
||||
android:title="Audio latency"
|
||||
android:dependency="audio_enable" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
|
@ -366,17 +366,22 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
boolean lowLatency = hasLowLatencyAudio();
|
||||
Log.i(TAG, "Audio is low latency: " + (lowLatency ? "yes" : "no"));
|
||||
|
||||
if (lowLatency && !prefs.getBoolean("audio_high_latency", false)) {
|
||||
config.setInt("audio_latency", 64);
|
||||
if (lowLatency) {
|
||||
config.setInt("audio_block_frames", buffersize);
|
||||
} else {
|
||||
config.setInt("audio_latency", prefs.getBoolean(
|
||||
"audio_high_latency", false) ? 160 : 64);
|
||||
config.setInt("audio_block_frames", 0);
|
||||
}
|
||||
} else {
|
||||
config.setInt("audio_latency",
|
||||
prefs.getBoolean("audio_high_latency", false) ? 160 : 64);
|
||||
String latency_audio = prefs.getString("audio_latency", "64");
|
||||
|
||||
if (latency_audio.equals("64")) {
|
||||
config.setInt("audio_latency", 64);
|
||||
} else if (latency_audio.equals("128")) {
|
||||
config.setInt("audio_latency", 128);
|
||||
} else if (latency_audio.equals("160")) {
|
||||
config.setInt("audio_latency", 160);
|
||||
}
|
||||
}
|
||||
|
||||
config.setBoolean("audio_enable",
|
||||
@ -682,6 +687,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
false);
|
||||
edit.putBoolean("input_autodetect_enable",
|
||||
true);
|
||||
edit.putString("audio_latency", "64");
|
||||
edit.putBoolean("audio_latency_auto", true);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
@ -703,7 +710,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
false);
|
||||
edit.putBoolean("input_autodetect_enable",
|
||||
true);
|
||||
edit.putBoolean("audio_high_latency", true);
|
||||
edit.putString("audio_latency", "160");
|
||||
edit.putBoolean("audio_latency_auto", false);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
@ -725,6 +733,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
false);
|
||||
edit.putBoolean("input_autodetect_enable",
|
||||
true);
|
||||
edit.putString("audio_latency", "64");
|
||||
edit.putBoolean("audio_latency_auto", true);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
@ -749,6 +759,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
true);
|
||||
edit.putString("video_refresh_rate", Double
|
||||
.valueOf(59.19132938771038).toString());
|
||||
edit.putString("audio_latency", "128");
|
||||
edit.putBoolean("audio_latency_auto", false);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
@ -768,6 +780,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||
.edit();
|
||||
edit.putString("video_refresh_rate", Double
|
||||
.valueOf(59.65).toString());
|
||||
edit.putString("audio_latency", "64");
|
||||
edit.putBoolean("audio_latency_auto", false);
|
||||
edit.commit();
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user