Merge pull request #5975 from raven02/patch-32
Audio : add low/medium/high audio latency mode
This commit is contained in:
commit
155dcee5a6
4 changed files with 22 additions and 5 deletions
|
@ -403,7 +403,7 @@ static ConfigSetting soundSettings[] = {
|
||||||
ConfigSetting("Enable", &g_Config.bEnableSound, true),
|
ConfigSetting("Enable", &g_Config.bEnableSound, true),
|
||||||
ConfigSetting("VolumeBGM", &g_Config.iBGMVolume, 7),
|
ConfigSetting("VolumeBGM", &g_Config.iBGMVolume, 7),
|
||||||
ConfigSetting("VolumeSFX", &g_Config.iSFXVolume, 7),
|
ConfigSetting("VolumeSFX", &g_Config.iSFXVolume, 7),
|
||||||
ConfigSetting("LowLatency", &g_Config.bLowLatencyAudio, false),
|
ConfigSetting("AudioLatency", &g_Config.IaudioLatency, 1),
|
||||||
|
|
||||||
ConfigSetting(false),
|
ConfigSetting(false),
|
||||||
};
|
};
|
||||||
|
|
|
@ -148,7 +148,7 @@ public:
|
||||||
|
|
||||||
// Sound
|
// Sound
|
||||||
bool bEnableSound;
|
bool bEnableSound;
|
||||||
bool bLowLatencyAudio;
|
int IaudioLatency; // 0 = low , 1 = medium(default) , 2 = high
|
||||||
int iSFXVolume;
|
int iSFXVolume;
|
||||||
int iBGMVolume;
|
int iBGMVolume;
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,12 @@
|
||||||
atomic_flag atomicLock_;
|
atomic_flag atomicLock_;
|
||||||
recursive_mutex mutex_;
|
recursive_mutex mutex_;
|
||||||
|
|
||||||
|
enum latency {
|
||||||
|
LOW_LATENCY = 0,
|
||||||
|
MEDIUM_LATENCY = 1,
|
||||||
|
HIGH_LATENCY = 2,
|
||||||
|
};
|
||||||
|
|
||||||
int eventAudioUpdate = -1;
|
int eventAudioUpdate = -1;
|
||||||
int eventHostAudioUpdate = -1;
|
int eventHostAudioUpdate = -1;
|
||||||
int mixFrequency = 44100;
|
int mixFrequency = 44100;
|
||||||
|
@ -92,16 +98,26 @@ void hleHostAudioUpdate(u64 userdata, int cyclesLate) {
|
||||||
void __AudioInit() {
|
void __AudioInit() {
|
||||||
mixFrequency = 44100;
|
mixFrequency = 44100;
|
||||||
|
|
||||||
if (g_Config.bLowLatencyAudio) {
|
switch (g_Config.IaudioLatency) {
|
||||||
|
case LOW_LATENCY:
|
||||||
chanQueueMaxSizeFactor = 1;
|
chanQueueMaxSizeFactor = 1;
|
||||||
chanQueueMinSizeFactor = 1;
|
chanQueueMinSizeFactor = 1;
|
||||||
hwBlockSize = 16;
|
hwBlockSize = 16;
|
||||||
hostAttemptBlockSize = 256;
|
hostAttemptBlockSize = 256;
|
||||||
} else {
|
break;
|
||||||
|
case MEDIUM_LATENCY:
|
||||||
chanQueueMaxSizeFactor = 2;
|
chanQueueMaxSizeFactor = 2;
|
||||||
chanQueueMinSizeFactor = 1;
|
chanQueueMinSizeFactor = 1;
|
||||||
hwBlockSize = 64;
|
hwBlockSize = 64;
|
||||||
hostAttemptBlockSize = 512;
|
hostAttemptBlockSize = 512;
|
||||||
|
break;
|
||||||
|
case HIGH_LATENCY:
|
||||||
|
chanQueueMaxSizeFactor = 4;
|
||||||
|
chanQueueMinSizeFactor = 2;
|
||||||
|
hwBlockSize = 64;
|
||||||
|
hostAttemptBlockSize = 512;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
audioIntervalUs = (int)(1000000ULL * hwBlockSize / hwSampleRate);
|
audioIntervalUs = (int)(1000000ULL * hwBlockSize / hwSampleRate);
|
||||||
|
|
|
@ -234,7 +234,8 @@ void GameSettingsScreen::CreateViews() {
|
||||||
bgmVol->SetEnabledPtr(&g_Config.bEnableSound);
|
bgmVol->SetEnabledPtr(&g_Config.bEnableSound);
|
||||||
|
|
||||||
audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound")));
|
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);
|
lowAudio->SetEnabledPtr(&g_Config.bEnableSound);
|
||||||
|
|
||||||
audioSettings->Add(new ItemHeader(a->T("Audio hacks")));
|
audioSettings->Add(new ItemHeader(a->T("Audio hacks")));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue