mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-08 09:09:04 +00:00
AudioInterface: Use IsPlaying method
This commit is contained in:
parent
48c9c224cf
commit
f7a2972899
1 changed files with 20 additions and 20 deletions
|
@ -295,8 +295,9 @@ 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;
|
const u32 old_sample_counter = s_sample_counter + 1;
|
||||||
s_sample_counter += amount;
|
s_sample_counter += amount;
|
||||||
|
|
||||||
|
@ -307,7 +308,6 @@ static void IncreaseSampleCount(const u32 amount)
|
||||||
s_sample_counter, s_interrupt_timing, PowerPC::ppcState.pc, s_control.AIINTVLD);
|
s_sample_counter, s_interrupt_timing, PowerPC::ppcState.pc, s_control.AIINTVLD);
|
||||||
GenerateAudioInterrupt();
|
GenerateAudioInterrupt();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsPlaying()
|
bool IsPlaying()
|
||||||
|
@ -337,8 +337,9 @@ 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;
|
const u64 diff = CoreTiming::GetTicks() - s_last_cpu_time;
|
||||||
if (diff > s_cpu_cycles_per_sample)
|
if (diff > s_cpu_cycles_per_sample)
|
||||||
{
|
{
|
||||||
|
@ -347,7 +348,6 @@ static void Update(u64 userdata, s64 cycles_late)
|
||||||
IncreaseSampleCount(samples);
|
IncreaseSampleCount(samples);
|
||||||
}
|
}
|
||||||
CoreTiming::ScheduleEvent(GetAIPeriod() - cycles_late, event_type_ai);
|
CoreTiming::ScheduleEvent(GetAIPeriod() - cycles_late, event_type_ai);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetAIPeriod()
|
int GetAIPeriod()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue