AudioInterface: Use IsPlaying method
This commit is contained in:
parent
48c9c224cf
commit
f7a2972899
|
@ -295,18 +295,18 @@ void GenerateAISInterrupt()
|
||||||
|
|
||||||
static void IncreaseSampleCount(const u32 amount)
|
static void IncreaseSampleCount(const u32 amount)
|
||||||
{
|
{
|
||||||
if (s_control.PSTAT)
|
if (!IsPlaying())
|
||||||
{
|
return;
|
||||||
const u32 old_sample_counter = s_sample_counter + 1;
|
|
||||||
s_sample_counter += amount;
|
|
||||||
|
|
||||||
if ((s_interrupt_timing - old_sample_counter) <= (s_sample_counter - old_sample_counter))
|
const u32 old_sample_counter = s_sample_counter + 1;
|
||||||
{
|
s_sample_counter += amount;
|
||||||
DEBUG_LOG_FMT(AUDIO_INTERFACE,
|
|
||||||
"GenerateAudioInterrupt {:08x}:{:08x} at PC {:08x} s_control.AIINTVLD={}",
|
if ((s_interrupt_timing - old_sample_counter) <= (s_sample_counter - old_sample_counter))
|
||||||
s_sample_counter, s_interrupt_timing, PowerPC::ppcState.pc, s_control.AIINTVLD);
|
{
|
||||||
GenerateAudioInterrupt();
|
DEBUG_LOG_FMT(AUDIO_INTERFACE,
|
||||||
}
|
"GenerateAudioInterrupt {:08x}:{:08x} at PC {:08x} s_control.AIINTVLD={}",
|
||||||
|
s_sample_counter, s_interrupt_timing, PowerPC::ppcState.pc, s_control.AIINTVLD);
|
||||||
|
GenerateAudioInterrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,17 +337,17 @@ u32 Get48KHzSampleRateDivisor()
|
||||||
|
|
||||||
static void Update(u64 userdata, s64 cycles_late)
|
static void Update(u64 userdata, s64 cycles_late)
|
||||||
{
|
{
|
||||||
if (s_control.PSTAT)
|
if (!IsPlaying())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const u64 diff = CoreTiming::GetTicks() - s_last_cpu_time;
|
||||||
|
if (diff > s_cpu_cycles_per_sample)
|
||||||
{
|
{
|
||||||
const u64 diff = CoreTiming::GetTicks() - s_last_cpu_time;
|
const u32 samples = static_cast<u32>(diff / s_cpu_cycles_per_sample);
|
||||||
if (diff > s_cpu_cycles_per_sample)
|
s_last_cpu_time += samples * s_cpu_cycles_per_sample;
|
||||||
{
|
IncreaseSampleCount(samples);
|
||||||
const u32 samples = static_cast<u32>(diff / s_cpu_cycles_per_sample);
|
|
||||||
s_last_cpu_time += samples * s_cpu_cycles_per_sample;
|
|
||||||
IncreaseSampleCount(samples);
|
|
||||||
}
|
|
||||||
CoreTiming::ScheduleEvent(GetAIPeriod() - cycles_late, event_type_ai);
|
|
||||||
}
|
}
|
||||||
|
CoreTiming::ScheduleEvent(GetAIPeriod() - cycles_late, event_type_ai);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetAIPeriod()
|
int GetAIPeriod()
|
||||||
|
|
Loading…
Reference in New Issue