SPU: Always run, not only when enabled

This commit is contained in:
Connor McLaughlin 2020-03-14 15:01:23 +10:00
parent c3cb6ef393
commit 90d6babfb0

View file

@ -626,8 +626,6 @@ void SPU::IncrementCaptureBufferPosition()
void SPU::Execute(TickCount ticks) void SPU::Execute(TickCount ticks)
{ {
DebugAssert(m_SPUCNT.enable || m_SPUCNT.cd_audio_enable);
u32 remaining_frames = static_cast<u32>((ticks + m_ticks_carry) / SYSCLK_TICKS_PER_SPU_TICK); u32 remaining_frames = static_cast<u32>((ticks + m_ticks_carry) / SYSCLK_TICKS_PER_SPU_TICK);
m_ticks_carry = (ticks + m_ticks_carry) % SYSCLK_TICKS_PER_SPU_TICK; m_ticks_carry = (ticks + m_ticks_carry) % SYSCLK_TICKS_PER_SPU_TICK;
@ -697,19 +695,13 @@ void SPU::Execute(TickCount ticks)
void SPU::UpdateEventInterval() void SPU::UpdateEventInterval()
{ {
if (!m_SPUCNT.enable && !m_SPUCNT.cd_audio_enable)
{
m_sample_event->Deactivate();
return;
}
// Don't generate more than the audio buffer since in a single slice, otherwise we'll both overflow the buffers when // Don't generate more than the audio buffer since in a single slice, otherwise we'll both overflow the buffers when
// we do write it, and the audio thread will underflow since it won't have enough data it the game isn't messing with // we do write it, and the audio thread will underflow since it won't have enough data it the game isn't messing with
// the SPU state. // the SPU state.
const u32 max_slice_frames = m_system->GetHostInterface()->GetAudioStream()->GetBufferSize(); const u32 max_slice_frames = m_system->GetHostInterface()->GetAudioStream()->GetBufferSize();
// TODO: Make this predict how long until the interrupt will be hit instead... // TODO: Make this predict how long until the interrupt will be hit instead...
const u32 interval = m_SPUCNT.irq9_enable ? 1 : max_slice_frames; const u32 interval = (m_SPUCNT.enable && m_SPUCNT.irq9_enable) ? 1 : max_slice_frames;
const TickCount interval_ticks = static_cast<TickCount>(interval) * SYSCLK_TICKS_PER_SPU_TICK; const TickCount interval_ticks = static_cast<TickCount>(interval) * SYSCLK_TICKS_PER_SPU_TICK;
if (m_sample_event->IsActive() && m_sample_event->GetInterval() == interval_ticks) if (m_sample_event->IsActive() && m_sample_event->GetInterval() == interval_ticks)
return; return;