Added missing audio delay setting

This commit is contained in:
SSimco 2024-10-13 12:35:16 +03:00
parent 0992908d69
commit c58cbb4787
4 changed files with 28 additions and 0 deletions

View File

@ -333,4 +333,17 @@ Java_info_cemu_Cemu_nativeinterface_NativeSettings_setAudioDeviceVolume([[maybe_
auto& deviceVolume = tv ? g_config.data().tv_volume : g_config.data().pad_volume;
deviceVolume = volume;
g_config.Save();
}
extern "C" [[maybe_unused]] JNIEXPORT jint JNICALL
Java_info_cemu_Cemu_nativeinterface_NativeSettings_getAudioLatency([[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz)
{
return g_config.data().audio_delay;
}
extern "C" [[maybe_unused]] JNIEXPORT void JNICALL
Java_info_cemu_Cemu_nativeinterface_NativeSettings_setAudioLatency([[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz, jint latency)
{
g_config.data().audio_delay = latency;
g_config.Save();
}

View File

@ -64,6 +64,12 @@ public class NativeSettings {
public static native int getAudioDeviceVolume(boolean tv);
public static final int AUDIO_BLOCK_COUNT = 24;
public static native void setAudioLatency(int latency);
public static native int getAudioLatency();
public static final int OVERLAY_SCREEN_POSITION_DISABLED = 0;
public static final int OVERLAY_SCREEN_POSITION_TOP_LEFT = 1;
public static final int OVERLAY_SCREEN_POSITION_TOP_CENTER = 2;

View File

@ -37,6 +37,14 @@ public class AudioSettingsFragment extends Fragment {
GenericRecyclerViewAdapter genericRecyclerViewAdapter = new GenericRecyclerViewAdapter();
SliderRecyclerViewItem latencySlider = new SliderRecyclerViewItem(getString(R.string.audio_latency),
0,
NativeSettings.AUDIO_BLOCK_COUNT - 1,
NativeSettings.getAudioLatency(),
value -> NativeSettings.setAudioLatency((int) value),
value -> (int) (value * 12) + "ms");
genericRecyclerViewAdapter.addRecyclerViewItem(latencySlider);
ToggleRecyclerViewItem tvDeviceToggle = new ToggleRecyclerViewItem(getString(R.string.tv),
getString(R.string.tv_audio_description), NativeSettings.getAudioDeviceEnabled(true),
checked -> NativeSettings.setAudioDeviceEnabled(checked, true));

View File

@ -222,4 +222,5 @@
<string name="cpu_mode_multi_core_recompiler">Multi-core recompiler</string>
<string name="cpu_mode">CPU mode</string>
<string name="thread_quantum">Thread quantum</string>
<string name="audio_latency">Latency</string>
</resources>