[Audio] Have sync audio only if plugin enables it

This commit is contained in:
zilmar 2018-12-08 21:23:06 +10:30
parent 0e2e8eef10
commit 88386600ed
8 changed files with 29 additions and 4 deletions

View File

@ -81,6 +81,11 @@ CSettings::~CSettings()
void CSettings::RegisterSettings(void)
{
SetModuleName("default");
short Set_SyncViaAudioEnabled = FindSystemSettingId("SyncViaAudioEnabled");
if (Set_SyncViaAudioEnabled != 0)
{
SetSystemSetting(Set_SyncViaAudioEnabled, 1);
}
m_Set_EnableAudio = FindSystemSettingId("Enable Audio");
m_Set_FixedAudio = FindSystemSettingId("Fixed Audio");
m_Set_SyncAudio = FindSystemSettingId("Sync Audio");

View File

@ -62,6 +62,7 @@ bool CAudioPlugin::LoadFunctions(void)
bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
{
g_Settings->SaveBool(Setting_SyncViaAudioEnabled, false);
struct AUDIO_INFO
{
void * hwnd;

View File

@ -127,6 +127,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Setting_EnableDisk, new CSettingTypeTempBool(false));
AddHandler(Setting_LanguageDirDefault, new CSettingTypeRelativePath("Lang", ""));
AddHandler(Setting_LanguageDir, new CSettingTypeApplicationPath("Lang Directory", "Directory", Setting_LanguageDirDefault));
AddHandler(Setting_SyncViaAudioEnabled, new CSettingTypeTempBool(false, "SyncViaAudioEnabled"));
AddHandler(Default_RDRamSize, new CSettingTypeApplication("Defaults", "RDRAM Size", 0x400000u));
AddHandler(Default_UseHleGfx, new CSettingTypeApplication("Defaults", "HLE GFX", true));

View File

@ -57,7 +57,7 @@ void CGameSettings::RefreshGameSettings()
m_DelaySI = g_Settings->LoadBool(Game_DelaySI);
m_DelayDP = g_Settings->LoadBool(Game_DelayDP);
m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio);
m_bSyncToAudio = g_Settings->LoadBool(Game_SyncViaAudio);
m_bSyncToAudio = g_Settings->LoadBool(Game_SyncViaAudio) && g_Settings->LoadBool(Setting_SyncViaAudioEnabled);
m_FullSpeed = g_Settings->LoadBool(Game_FullSpeed);
m_b32Bit = g_Settings->LoadBool(Game_32Bit);
#ifdef ANDROID

View File

@ -62,9 +62,17 @@ void CSettingTypeTempBool::Save(uint32_t /*Index*/, bool Value)
m_changed = true;
}
void CSettingTypeTempBool::Save(uint32_t /*Index*/, uint32_t /*Value*/)
void CSettingTypeTempBool::Save(uint32_t /*Index*/, uint32_t Value)
{
if (Value == 0 || Value != 0)
{
m_value = Value != 0;
m_changed = true;
}
else
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
}
void CSettingTypeTempBool::Save(uint32_t /*Index*/, const std::string & /*Value*/)

View File

@ -60,6 +60,7 @@ enum SettingID
Setting_LanguageDirDefault,
Setting_CurrentLanguage,
Setting_EnableDisk,
Setting_SyncViaAudioEnabled,
//Default Settings
Default_RDRamSize,

View File

@ -61,6 +61,10 @@ CDefaultsOptionsPage::CDefaultsOptionsPage(HWND hParent, const RECT & rcDispay)
AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO), Default_SyncViaAudio);
AddModCheckBox(GetDlgItem(IDC_ROM_FIXEDAUDIO), Default_FixedAudio);
if (!g_Settings->LoadBool(Setting_SyncViaAudioEnabled))
{
GetDlgItem(IDC_SYNC_AUDIO).EnableWindow(false);
}
UpdatePageSettings();
}

View File

@ -89,6 +89,11 @@ CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
TxtBox = AddModTextBox(GetDlgItem(IDC_OVER_CLOCK_MODIFIER), Game_OverClockModifier, false);
TxtBox->SetTextField(GetDlgItem(IDC_OVER_CLOCK_MODIFIER_TEXT));
if (!g_Settings->LoadBool(Setting_SyncViaAudioEnabled))
{
GetDlgItem(IDC_SYNC_AUDIO).EnableWindow(false);
}
UpdatePageSettings();
}