Switch to low/medium/high audio latency mode

This commit is contained in:
raven02 committed 2014-04-27 22:11:26 +08:00
1 parent 4eb7991530
commit eda3d48d53
4 files changed
+22 -5

No files matched your search

+1 -1
View File
@@ -403,7 +403,7 @@ static ConfigSetting soundSettings[] = {
ConfigSetting("Enable", &g_Config.bEnableSound, true),
ConfigSetting("VolumeBGM", &g_Config.iBGMVolume, 7),
ConfigSetting("VolumeSFX", &g_Config.iSFXVolume, 7),
ConfigSetting("LowLatency", &g_Config.bLowLatencyAudio, false),
ConfigSetting("AudioLatency", &g_Config.IaudioLatency, 1),
ConfigSetting(false),
};
+1 -1
View File
@@ -148,7 +148,7 @@ public:
// Sound
bool bEnableSound;
bool bLowLatencyAudio;
int IaudioLatency; // 0 = low , 1 = medium(default) , 2 = high
int iSFXVolume;
int iBGMVolume;
+18 -2
View File
@@ -37,6 +37,12 @@
atomic_flag atomicLock_;
recursive_mutex mutex_;
enum latency {
LOW_LATENCY = 0,
MEDIUM_LATENCY = 1,
HIGH_LATENCY = 2,
};
int eventAudioUpdate = -1;
int eventHostAudioUpdate = -1;
int mixFrequency = 44100;
@@ -92,16 +98,26 @@ void hleHostAudioUpdate(u64 userdata, int cyclesLate) {
void __AudioInit() {
mixFrequency = 44100;
if (g_Config.bLowLatencyAudio) {
switch (g_Config.IaudioLatency) {
case LOW_LATENCY:
chanQueueMaxSizeFactor = 1;
chanQueueMinSizeFactor = 1;
hwBlockSize = 16;
hostAttemptBlockSize = 256;
} else {
break;
case MEDIUM_LATENCY:
chanQueueMaxSizeFactor = 2;
chanQueueMinSizeFactor = 1;
hwBlockSize = 64;
hostAttemptBlockSize = 512;
break;
case HIGH_LATENCY:
chanQueueMaxSizeFactor = 4;
chanQueueMinSizeFactor = 2;
hwBlockSize = 64;
hostAttemptBlockSize = 512;
break;
}
audioIntervalUs = (int)(1000000ULL * hwBlockSize / hwSampleRate);
+2 -1
View File
@@ -243,7 +243,8 @@ void GameSettingsScreen::CreateViews() {
bgmVol->SetEnabledPtr(&g_Config.bEnableSound);
audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound")));
CheckBox *lowAudio = audioSettings->Add(new CheckBox(&g_Config.bLowLatencyAudio, a->T("Low latency audio")));
static const char *latency[] = { "Low", "Medium", "High" };
PopupMultiChoice *lowAudio = audioSettings->Add(new PopupMultiChoice(&g_Config.IaudioLatency, a->T("Audio Latency"), latency, 0, ARRAY_SIZE(latency), gs, screenManager()));
lowAudio->SetEnabledPtr(&g_Config.bEnableSound);
audioSettings->Add(new ItemHeader(a->T("Audio hacks")));