Audio: Rewrote sync to audio
This commit is contained in:
parent
42dbc691bd
commit
6ac9d18e7f
|
@ -207,12 +207,6 @@ void CInterpreterCPU::InPermLoop (void) {
|
|||
g_Notify->DisplayError(GS(MSG_PERM_LOOP));
|
||||
g_System->CloseCpu();
|
||||
} else {
|
||||
/* check sound playing */
|
||||
g_System->SyncToAudio();
|
||||
|
||||
/* check RSP running */
|
||||
/* check RDP running */
|
||||
|
||||
if (*g_NextTimer > 0) {
|
||||
*g_NextTimer = 0 - g_System->CountPerOp();
|
||||
g_SystemTimer->UpdateTimers();
|
||||
|
|
|
@ -91,6 +91,10 @@ void CAudio::TimerDone ( void )
|
|||
g_SystemTimer->SetTimer(CSystemTimer::AiTimer,m_SecondBuff * m_CountsPerByte,false);
|
||||
m_SecondBuff = 0;
|
||||
} else {
|
||||
if (g_Reg->m_AudioIntrReg == 0)
|
||||
{
|
||||
g_System->SyncToAudio();
|
||||
}
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||
g_Reg->CheckInterrupts();
|
||||
m_Status &= 0x7FFFFFFF;
|
||||
|
|
|
@ -1628,52 +1628,29 @@ void CN64System::RunRSP ( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
void CN64System::SyncToAudio ( void ) {
|
||||
if (!bBasicMode() && !bLimitFPS() )
|
||||
void CN64System::SyncToAudio ( void )
|
||||
{
|
||||
if (!bSyncToAudio() || !bLimitFPS())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!bFixedAudio())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!bSyncToAudio())
|
||||
{
|
||||
return;
|
||||
}
|
||||
// if (m_Reg.GetCurrentTimerType() != AiTimer)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
if (g_Audio->GetLength() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DWORD (__cdecl* AiReadLength) ( void );
|
||||
AiReadLength = g_Plugins->Audio()->ReadLength;
|
||||
if (AiReadLength() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SPECIAL_TIMERS CPU_UsageAddr = Timer_None;
|
||||
if (bShowCPUPer())
|
||||
|
||||
if (bShowCPUPer()) { CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_Idel); }
|
||||
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_Idel);
|
||||
}
|
||||
while (!m_EndEmulation)
|
||||
{
|
||||
Sleep(10);
|
||||
if (AiReadLength() == 0)
|
||||
{
|
||||
break;
|
||||
if (g_Reg->m_AudioIntrReg != 0)
|
||||
{
|
||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Audio Interrupt done (%d)",i);
|
||||
break;
|
||||
}
|
||||
Sleep(1);
|
||||
}
|
||||
if (bShowCPUPer())
|
||||
{
|
||||
m_CPU_Usage.StartTimer(CPU_UsageAddr != Timer_None ? CPU_UsageAddr : Timer_R4300 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CN64System::RefreshScreen ( void ) {
|
||||
|
|
Loading…
Reference in New Issue