(Android Phoenix) Set configurable audio latency
This commit is contained in:
parent
e6f527e992
commit
0245f926d1
|
@ -10,6 +10,18 @@
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
</string-array>
|
</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">
|
<string-array name="aspect_ratios">
|
||||||
<item>Full screen</item>
|
<item>Full screen</item>
|
||||||
<item>Auto</item>
|
<item>Auto</item>
|
||||||
|
|
|
@ -114,11 +114,13 @@
|
||||||
android:summary="Enable dynamic rate control (recommended)."
|
android:summary="Enable dynamic rate control (recommended)."
|
||||||
android:title="Dynamic Rate Control"
|
android:title="Dynamic Rate Control"
|
||||||
android:dependency="audio_enable" />
|
android:dependency="audio_enable" />
|
||||||
<CheckBoxPreference
|
<ListPreference
|
||||||
android:defaultValue="false"
|
android:entries="@array/audio_latency_options"
|
||||||
android:key="audio_high_latency"
|
android:entryValues="@array/audio_latency_options_values"
|
||||||
android:summary="Use (very) high latency audio. Necessary for older Android devices with poor audio drivers."
|
android:defaultValue="64"
|
||||||
android:title="High latency audio"
|
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" />
|
android:dependency="audio_enable" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
|
|
|
@ -366,17 +366,22 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||||
boolean lowLatency = hasLowLatencyAudio();
|
boolean lowLatency = hasLowLatencyAudio();
|
||||||
Log.i(TAG, "Audio is low latency: " + (lowLatency ? "yes" : "no"));
|
Log.i(TAG, "Audio is low latency: " + (lowLatency ? "yes" : "no"));
|
||||||
|
|
||||||
if (lowLatency && !prefs.getBoolean("audio_high_latency", false)) {
|
|
||||||
config.setInt("audio_latency", 64);
|
config.setInt("audio_latency", 64);
|
||||||
|
if (lowLatency) {
|
||||||
config.setInt("audio_block_frames", buffersize);
|
config.setInt("audio_block_frames", buffersize);
|
||||||
} else {
|
} else {
|
||||||
config.setInt("audio_latency", prefs.getBoolean(
|
|
||||||
"audio_high_latency", false) ? 160 : 64);
|
|
||||||
config.setInt("audio_block_frames", 0);
|
config.setInt("audio_block_frames", 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
config.setInt("audio_latency",
|
String latency_audio = prefs.getString("audio_latency", "64");
|
||||||
prefs.getBoolean("audio_high_latency", false) ? 160 : 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",
|
config.setBoolean("audio_enable",
|
||||||
|
@ -682,6 +687,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||||
false);
|
false);
|
||||||
edit.putBoolean("input_autodetect_enable",
|
edit.putBoolean("input_autodetect_enable",
|
||||||
true);
|
true);
|
||||||
|
edit.putString("audio_latency", "64");
|
||||||
|
edit.putBoolean("audio_latency_auto", true);
|
||||||
edit.commit();
|
edit.commit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -703,7 +710,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||||
false);
|
false);
|
||||||
edit.putBoolean("input_autodetect_enable",
|
edit.putBoolean("input_autodetect_enable",
|
||||||
true);
|
true);
|
||||||
edit.putBoolean("audio_high_latency", true);
|
edit.putString("audio_latency", "160");
|
||||||
|
edit.putBoolean("audio_latency_auto", false);
|
||||||
edit.commit();
|
edit.commit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -725,6 +733,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||||
false);
|
false);
|
||||||
edit.putBoolean("input_autodetect_enable",
|
edit.putBoolean("input_autodetect_enable",
|
||||||
true);
|
true);
|
||||||
|
edit.putString("audio_latency", "64");
|
||||||
|
edit.putBoolean("audio_latency_auto", true);
|
||||||
edit.commit();
|
edit.commit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -749,6 +759,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||||
true);
|
true);
|
||||||
edit.putString("video_refresh_rate", Double
|
edit.putString("video_refresh_rate", Double
|
||||||
.valueOf(59.19132938771038).toString());
|
.valueOf(59.19132938771038).toString());
|
||||||
|
edit.putString("audio_latency", "128");
|
||||||
|
edit.putBoolean("audio_latency_auto", false);
|
||||||
edit.commit();
|
edit.commit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -768,6 +780,8 @@ public class MainMenuActivity extends PreferenceActivity {
|
||||||
.edit();
|
.edit();
|
||||||
edit.putString("video_refresh_rate", Double
|
edit.putString("video_refresh_rate", Double
|
||||||
.valueOf(59.65).toString());
|
.valueOf(59.65).toString());
|
||||||
|
edit.putString("audio_latency", "64");
|
||||||
|
edit.putBoolean("audio_latency_auto", false);
|
||||||
edit.commit();
|
edit.commit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue