[Project64] Try to fix sync to audio
This commit is contained in:
parent
9ab7a83c26
commit
eddd90bbeb
|
@ -65,6 +65,10 @@ EXPORT void CALL PluginLoaded(void)
|
||||||
{
|
{
|
||||||
PluginInit();
|
PluginInit();
|
||||||
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
|
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
|
||||||
|
if (g_settings != NULL)
|
||||||
|
{
|
||||||
|
g_settings->SetSyncViaAudioEnabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void CALL AiDacrateChanged(int SystemType)
|
EXPORT void CALL AiDacrateChanged(int SystemType)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
CSettings * g_settings = NULL;
|
CSettings * g_settings = NULL;
|
||||||
|
|
||||||
CSettings::CSettings() :
|
CSettings::CSettings() :
|
||||||
|
m_Set_SyncViaAudioEnabled(0),
|
||||||
m_Set_EnableAudio(0),
|
m_Set_EnableAudio(0),
|
||||||
m_Set_FixedAudio(0),
|
m_Set_FixedAudio(0),
|
||||||
m_Set_SyncAudio(0),
|
m_Set_SyncAudio(0),
|
||||||
|
@ -81,11 +82,7 @@ CSettings::~CSettings()
|
||||||
void CSettings::RegisterSettings(void)
|
void CSettings::RegisterSettings(void)
|
||||||
{
|
{
|
||||||
SetModuleName("default");
|
SetModuleName("default");
|
||||||
short Set_SyncViaAudioEnabled = FindSystemSettingId("SyncViaAudioEnabled");
|
m_Set_SyncViaAudioEnabled = FindSystemSettingId("SyncViaAudioEnabled");
|
||||||
if (Set_SyncViaAudioEnabled != 0)
|
|
||||||
{
|
|
||||||
SetSystemSetting(Set_SyncViaAudioEnabled, 1);
|
|
||||||
}
|
|
||||||
m_Set_EnableAudio = FindSystemSettingId("Enable Audio");
|
m_Set_EnableAudio = FindSystemSettingId("Enable Audio");
|
||||||
m_Set_FixedAudio = FindSystemSettingId("Fixed Audio");
|
m_Set_FixedAudio = FindSystemSettingId("Fixed Audio");
|
||||||
m_Set_SyncAudio = FindSystemSettingId("Sync Audio");
|
m_Set_SyncAudio = FindSystemSettingId("Sync Audio");
|
||||||
|
@ -109,6 +106,14 @@ void CSettings::RegisterSettings(void)
|
||||||
LogLevelChanged();
|
LogLevelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettings::SetSyncViaAudioEnabled(bool Enabled)
|
||||||
|
{
|
||||||
|
if (m_Set_SyncViaAudioEnabled != 0)
|
||||||
|
{
|
||||||
|
SetSystemSetting(m_Set_SyncViaAudioEnabled, Enabled ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSettings::SetAudioEnabled(bool Enabled)
|
void CSettings::SetAudioEnabled(bool Enabled)
|
||||||
{
|
{
|
||||||
if (m_Set_EnableAudio != 0)
|
if (m_Set_EnableAudio != 0)
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
inline bool FlushLogs(void) const { return m_FlushLogs; }
|
inline bool FlushLogs(void) const { return m_FlushLogs; }
|
||||||
inline const char * log_dir(void) const { return m_log_dir; }
|
inline const char * log_dir(void) const { return m_log_dir; }
|
||||||
|
|
||||||
|
void SetSyncViaAudioEnabled(bool Enabled);
|
||||||
void SetAudioEnabled(bool Enabled);
|
void SetAudioEnabled(bool Enabled);
|
||||||
void SetVolume(uint32_t Volume);
|
void SetVolume(uint32_t Volume);
|
||||||
void SetTinyBuffer(bool TinyBuffer);
|
void SetTinyBuffer(bool TinyBuffer);
|
||||||
|
@ -45,6 +46,7 @@ private:
|
||||||
void RegisterSettings(void);
|
void RegisterSettings(void);
|
||||||
void LogLevelChanged(void);
|
void LogLevelChanged(void);
|
||||||
|
|
||||||
|
short m_Set_SyncViaAudioEnabled;
|
||||||
short m_Set_EnableAudio;
|
short m_Set_EnableAudio;
|
||||||
short m_Set_FixedAudio;
|
short m_Set_FixedAudio;
|
||||||
short m_Set_SyncAudio;
|
short m_Set_SyncAudio;
|
||||||
|
|
|
@ -37,6 +37,8 @@ CAudioPlugin::~CAudioPlugin()
|
||||||
|
|
||||||
bool CAudioPlugin::LoadFunctions(void)
|
bool CAudioPlugin::LoadFunctions(void)
|
||||||
{
|
{
|
||||||
|
g_Settings->SaveBool(Setting_SyncViaAudioEnabled, false);
|
||||||
|
|
||||||
// Find entries for functions in DLL
|
// Find entries for functions in DLL
|
||||||
void(CALL *InitiateAudio)(void);
|
void(CALL *InitiateAudio)(void);
|
||||||
LoadFunction(InitiateAudio);
|
LoadFunction(InitiateAudio);
|
||||||
|
@ -62,7 +64,6 @@ bool CAudioPlugin::LoadFunctions(void)
|
||||||
|
|
||||||
bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
{
|
{
|
||||||
g_Settings->SaveBool(Setting_SyncViaAudioEnabled, false);
|
|
||||||
struct AUDIO_INFO
|
struct AUDIO_INFO
|
||||||
{
|
{
|
||||||
void * hwnd;
|
void * hwnd;
|
||||||
|
|
|
@ -363,6 +363,11 @@ bool CPlugins::Reset(CN64System * System)
|
||||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
if (!m_RSP->Initiate(this, System)) { return false; }
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (System)
|
||||||
|
{
|
||||||
|
System->RefreshSyncToAudio();
|
||||||
|
}
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Done");
|
WriteTrace(TracePlugins, TraceDebug, "Done");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,6 @@ void CGameSettings::RefreshGameSettings()
|
||||||
m_DelaySI = g_Settings->LoadBool(Game_DelaySI);
|
m_DelaySI = g_Settings->LoadBool(Game_DelaySI);
|
||||||
m_DelayDP = g_Settings->LoadBool(Game_DelayDP);
|
m_DelayDP = g_Settings->LoadBool(Game_DelayDP);
|
||||||
m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio);
|
m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio);
|
||||||
m_bSyncToAudio = g_Settings->LoadBool(Game_SyncViaAudio) && g_Settings->LoadBool(Setting_SyncViaAudioEnabled);
|
|
||||||
m_FullSpeed = g_Settings->LoadBool(Game_FullSpeed);
|
m_FullSpeed = g_Settings->LoadBool(Game_FullSpeed);
|
||||||
m_b32Bit = g_Settings->LoadBool(Game_32Bit);
|
m_b32Bit = g_Settings->LoadBool(Game_32Bit);
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
@ -79,6 +78,7 @@ void CGameSettings::RefreshGameSettings()
|
||||||
}
|
}
|
||||||
if (m_OverClockModifier < 1) { m_OverClockModifier = 1; }
|
if (m_OverClockModifier < 1) { m_OverClockModifier = 1; }
|
||||||
if (m_OverClockModifier > 20) { m_OverClockModifier = 20; }
|
if (m_OverClockModifier > 20) { m_OverClockModifier = 20; }
|
||||||
|
RefreshSyncToAudio();
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Done");
|
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,3 +87,8 @@ void CGameSettings::SpeedChanged(int SpeedLimit)
|
||||||
m_FullSpeed = (g_System->m_SystemType == SYSTEM_PAL ? 50 : 60) == SpeedLimit;
|
m_FullSpeed = (g_System->m_SystemType == SYSTEM_PAL ? 50 : 60) == SpeedLimit;
|
||||||
g_Settings->SaveBool(Game_FullSpeed, m_FullSpeed);
|
g_Settings->SaveBool(Game_FullSpeed, m_FullSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGameSettings::RefreshSyncToAudio(void)
|
||||||
|
{
|
||||||
|
m_bSyncToAudio = g_Settings->LoadBool(Game_SyncViaAudio) && g_Settings->LoadBool(Setting_SyncViaAudioEnabled);
|
||||||
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ public:
|
||||||
inline static CPU_TYPE CpuType(void) { return m_CpuType; }
|
inline static CPU_TYPE CpuType(void) { return m_CpuType; }
|
||||||
inline static uint32_t OverClockModifier(void) { return m_OverClockModifier; }
|
inline static uint32_t OverClockModifier(void) { return m_OverClockModifier; }
|
||||||
|
|
||||||
|
void RefreshSyncToAudio(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void SpeedChanged(int32_t SpeedLimit);
|
static void SpeedChanged(int32_t SpeedLimit);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue