HW/AudioInterface: Avoid ppcState global.

This commit is contained in:
Admiral H. Curtiss 2023-01-10 06:44:59 +01:00
parent b52e8fd295
commit 078a460446
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 7 additions and 5 deletions

View File

@ -173,16 +173,18 @@ void IncreaseSampleCount(const u32 amount)
if (!IsPlaying())
return;
auto& state = Core::System::GetInstance().GetAudioInterfaceState().GetData();
auto& system = Core::System::GetInstance();
auto& state = system.GetAudioInterfaceState().GetData();
const u32 old_sample_counter = state.sample_counter + 1;
state.sample_counter += amount;
if ((state.interrupt_timing - old_sample_counter) <= (state.sample_counter - old_sample_counter))
{
DEBUG_LOG_FMT(
AUDIO_INTERFACE, "GenerateAudioInterrupt {:08x}:{:08x} at PC {:08x} control.AIINTVLD={}",
state.sample_counter, state.interrupt_timing, PowerPC::ppcState.pc, state.control.AIINTVLD);
DEBUG_LOG_FMT(AUDIO_INTERFACE,
"GenerateAudioInterrupt {:08x}:{:08x} at PC {:08x} control.AIINTVLD={}",
state.sample_counter, state.interrupt_timing, system.GetPPCState().pc,
state.control.AIINTVLD);
GenerateAudioInterrupt();
}
}
@ -382,7 +384,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
auto& core_timing = system.GetCoreTiming();
auto& state = system.GetAudioInterfaceState().GetData();
DEBUG_LOG_FMT(AUDIO_INTERFACE, "AI_INTERRUPT_TIMING={:08x} at PC: {:08x}", val,
PowerPC::ppcState.pc);
system.GetPPCState().pc);
state.interrupt_timing = val;
core_timing.RemoveEvent(state.event_type_ai);
core_timing.ScheduleEvent(GetAIPeriod(), state.event_type_ai);